- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / debugger-compile-and-run.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script>
6 var test = function()
7 {
8     InspectorTest.runDebuggerTestSuite([
9         function testSuccessfulCompileAndRun(next)
10         {
11             var expression = "var a = 1; var b = 2; a + b; ";
12             InspectorTest.addResult("Compiling script");
13             DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
14
15             function compileCallback(error, scriptId, syntaxErrorMessage)
16             {
17                 InspectorTest.assertTrue(!error);
18                 InspectorTest.assertTrue(!syntaxErrorMessage);
19                 InspectorTest.assertTrue(!!scriptId);
20                 var contextId = undefined;
21                 InspectorTest.addResult("Running script");
22                 DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
23             }
24
25             function runCallback(error, result, wasThrown)
26             {
27                 InspectorTest.assertTrue(!error);
28                 InspectorTest.assertTrue(!wasThrown);
29                 InspectorTest.addResult("Script result: " + result.value);
30                 next();
31             }
32         },
33
34         function testRunError(next)
35         {
36             var expression = "var a = 1; a + c; ";
37             InspectorTest.addResult("Compiling script");
38             DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
39
40             function compileCallback(error, scriptId, syntaxErrorMessage)
41             {
42                 InspectorTest.assertTrue(!error);
43                 InspectorTest.assertTrue(!syntaxErrorMessage);
44                 InspectorTest.assertTrue(!!scriptId);
45                 var contextId = undefined;
46                 InspectorTest.addResult("Running script");
47                 DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
48             }
49
50             function runCallback(error, result, wasThrown)
51             {
52                 InspectorTest.assertTrue(!error);
53                 InspectorTest.assertTrue(wasThrown);
54                 InspectorTest.addResult("Script run error: " + result.description);
55                 next();
56             }
57         },
58
59         function testCompileError(next)
60         {
61             var expression = "}";
62             InspectorTest.addResult("Compiling script");
63             DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
64
65             function compileCallback(error, scriptId, syntaxErrorMessage)
66             {
67                 InspectorTest.assertTrue(!error);
68                 InspectorTest.assertTrue(!scriptId);
69                 InspectorTest.addResult("Script compile error: " + syntaxErrorMessage);
70                 next();
71             }
72         }
73     ]);
74 }
75 </script>
76 </head>
77 <body onload="runTest()">
78 <p>Tests separate compilation and run.</p>
79 <a href="https://bugs.webkit.org/show_bug.cgi?id=89646">Bug 89646.</a>
80 </body>
81 </html>