Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger / debugger-completions-on-call-frame.html
blob535f01b19bc0693f0799c76eba54628a956d2841
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>
7 var a = 1;
8 function testFunction()
10 var var1 = 2;
11 var var2 = 3;
12 var arr1 = [1,2,3];
13 var arr2 = new Uint8Array(new ArrayBuffer(Math.pow(2, 29)));
14 debugger;
17 function test()
19 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
20 InspectorTest.runDebuggerTestSuite([
21 function step1(next)
23 InspectorTest.runTestFunctionAndWaitUntilPaused(next);
26 function step2(next)
28 executionContext.completionsForExpression("", "var", false, checkAgainstGolden.bind(this, ["var1", "var2"], [], next));
31 function step3(next)
33 executionContext.completionsForExpression("", "di", false, checkAgainstGolden.bind(this, ["dir", "dirxml"], [], next));
36 function step4(next)
38 executionContext.completionsForExpression("", "win", false, checkAgainstGolden.bind(this, ["window"], [], next));
41 function step5(next)
43 executionContext.completionsForExpression("", "t", false, checkAgainstGolden.bind(this, ["this"], [], next));
46 function step6(next)
48 executionContext.completionsForExpression("var1", "toExp", false, checkAgainstGolden.bind(this, ["toExponential"], [], next));
51 function step7(next)
53 executionContext.completionsForExpression("123", "toExp", false, checkAgainstGolden.bind(this, [], ["toExponential"], next));
56 function step8(next)
58 executionContext.completionsForExpression("", "", false, checkAgainstGolden.bind(this, [], ["$"], next));
61 function step9(next)
63 executionContext.completionsForExpression("", "", true, checkAgainstGolden.bind(this, ["$", "window"], [], next));
66 function step10(next)
68 executionContext.completionsForExpression("console", "log('bar');", false, checkAgainstGolden.bind(this, [], ["$"], next));
71 function step11(next)
73 executionContext.completionsForExpression("arr1.", "", false, checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next));
76 function step12(next)
78 executionContext.completionsForExpression("arr1[", "", false, checkAgainstGolden.bind(this, ["0]", "1]", "2]", "\"length\"]"], ["3]"], next));
81 function step13_ShouldNotCrash(next)
83 executionContext.completionsForExpression("arr2.", "", false, checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next));
85 ]);
87 function checkAgainstGolden(golden, antiGolden, continuation, completions)
89 var failed = false;
90 for (var i = 0; i < golden.length; ++i) {
91 if (completions.indexOf(golden[i]) === -1) {
92 failed = true;
93 InspectorTest.addResult("FAIL: NOT FOUND: " + golden[i]);
97 for (var i = 0; i < antiGolden.length; ++i) {
98 if (completions.indexOf(antiGolden[i]) !== -1) {
99 failed = true;
100 InspectorTest.addResult("FAIL: FOUND: " + antiGolden[i]);
104 if (!failed)
105 InspectorTest.addResult("PASS");
107 continuation();
111 </script>
112 </head>
114 <body onload="runTest()">
116 Test that completions in the context of the call frame will result in names
117 of its scope variables.
118 </p>
119 </body>
120 </html>