| OLD | NEW |
| 1 | 1 |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 var a = 1; | 8 var a = 1; |
| 9 function testFunction() | 9 function testFunction() |
| 10 { | 10 { |
| 11 var var1 = 2; | 11 var var1 = 2; |
| 12 var var2 = 3; | 12 var var2 = 3; |
| 13 var arr1 = [1,2,3]; | 13 var arr1 = [1,2,3]; |
| 14 var arr2 = new Uint8Array(new ArrayBuffer(Math.pow(2, 29))); | 14 var arr2 = new Uint8Array(new ArrayBuffer(Math.pow(2, 29))); |
| 15 debugger; | 15 debugger; |
| 16 } | 16 } |
| 17 | 17 |
| 18 function test() | 18 function test() |
| 19 { | 19 { |
| 20 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon
text); | |
| 21 InspectorTest.runDebuggerTestSuite([ | 20 InspectorTest.runDebuggerTestSuite([ |
| 22 function step1(next) | 21 function step1(next) |
| 23 { | 22 { |
| 24 InspectorTest.runTestFunctionAndWaitUntilPaused(next); | 23 InspectorTest.runTestFunctionAndWaitUntilPaused(next); |
| 25 }, | 24 }, |
| 26 | 25 |
| 27 function step2(next) | 26 function step2(next) |
| 28 { | 27 { |
| 29 executionContext.completionsForExpression("", "var").then(checkAgain
stGolden.bind(this, ["var1", "var2"], [], next)); | 28 WebInspector.JavaScriptAutocomplete.completionsForExpression("", "va
r").then(checkAgainstGolden.bind(this, ["var1", "var2"], [], next)); |
| 30 }, | 29 }, |
| 31 | 30 |
| 32 function step3(next) | 31 function step3(next) |
| 33 { | 32 { |
| 34 executionContext.completionsForExpression("", "di").then(checkAgains
tGolden.bind(this, ["dir", "dirxml"], [], next)); | 33 WebInspector.JavaScriptAutocomplete.completionsForExpression("", "di
").then(checkAgainstGolden.bind(this, ["dir", "dirxml"], [], next)); |
| 35 }, | 34 }, |
| 36 | 35 |
| 37 function step4(next) | 36 function step4(next) |
| 38 { | 37 { |
| 39 executionContext.completionsForExpression("", "win").then(checkAgain
stGolden.bind(this, ["window"], [], next)); | 38 WebInspector.JavaScriptAutocomplete.completionsForExpression("", "wi
n").then(checkAgainstGolden.bind(this, ["window"], [], next)); |
| 40 }, | 39 }, |
| 41 | 40 |
| 42 function step5(next) | 41 function step5(next) |
| 43 { | 42 { |
| 44 executionContext.completionsForExpression("", "t").then(checkAgainst
Golden.bind(this, ["this"], [], next)); | 43 WebInspector.JavaScriptAutocomplete.completionsForExpression("", "t"
).then(checkAgainstGolden.bind(this, ["this"], [], next)); |
| 45 }, | 44 }, |
| 46 | 45 |
| 47 function step6(next) | 46 function step6(next) |
| 48 { | 47 { |
| 49 executionContext.completionsForExpression("var1", "toExp").then(chec
kAgainstGolden.bind(this, ["toExponential"], [], next)); | 48 WebInspector.JavaScriptAutocomplete.completionsForExpression("var1",
"toExp").then(checkAgainstGolden.bind(this, ["toExponential"], [], next)); |
| 50 }, | 49 }, |
| 51 | 50 |
| 52 function step7(next) | 51 function step7(next) |
| 53 { | 52 { |
| 54 executionContext.completionsForExpression("123", "toExp").then(check
AgainstGolden.bind(this, [], ["toExponential"], next)); | 53 WebInspector.JavaScriptAutocomplete.completionsForExpression("123",
"toExp").then(checkAgainstGolden.bind(this, [], ["toExponential"], next)); |
| 55 }, | 54 }, |
| 56 | 55 |
| 57 function step8(next) | 56 function step8(next) |
| 58 { | 57 { |
| 59 executionContext.completionsForExpression("", "").then(checkAgainst
Golden.bind(this, [], ["$"], next)); | 58 WebInspector.JavaScriptAutocomplete.completionsForExpression("", ""
).then(checkAgainstGolden.bind(this, [], ["$"], next)); |
| 60 }, | 59 }, |
| 61 | 60 |
| 62 function step9(next) | 61 function step9(next) |
| 63 { | 62 { |
| 64 executionContext.completionsForExpression("", "", true).then(checkAg
ainstGolden.bind(this, ["$", "window"], [], next)); | 63 WebInspector.JavaScriptAutocomplete.completionsForExpression("", "",
true).then(checkAgainstGolden.bind(this, ["$", "window"], [], next)); |
| 65 }, | 64 }, |
| 66 | 65 |
| 67 function step10(next) | 66 function step10(next) |
| 68 { | 67 { |
| 69 executionContext.completionsForExpression("console", "log('bar');").
then(checkAgainstGolden.bind(this, [], ["$"], next)); | 68 WebInspector.JavaScriptAutocomplete.completionsForExpression("consol
e", "log('bar');").then(checkAgainstGolden.bind(this, [], ["$"], next)); |
| 70 }, | 69 }, |
| 71 | 70 |
| 72 function step11(next) | 71 function step11(next) |
| 73 { | 72 { |
| 74 executionContext.completionsForExpression("arr1.", "").then(checkAga
instGolden.bind(this, ["length"], ["1", "2", "3"], next)); | 73 WebInspector.JavaScriptAutocomplete.completionsForExpression("arr1."
, "").then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); |
| 75 }, | 74 }, |
| 76 | 75 |
| 77 function step12(next) | 76 function step12(next) |
| 78 { | 77 { |
| 79 executionContext.completionsForExpression("arr1[", "").then(checkAga
instGolden.bind(this, ["\"length\"]"], ["3]"], next)); | 78 WebInspector.JavaScriptAutocomplete.completionsForExpression("arr1["
, "").then(checkAgainstGolden.bind(this, ["\"length\"]"], ["3]"], next)); |
| 80 }, | 79 }, |
| 81 | 80 |
| 82 function step13_ShouldNotCrash(next) | 81 function step13_ShouldNotCrash(next) |
| 83 { | 82 { |
| 84 executionContext.completionsForExpression("arr2.", "").then(checkAg
ainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); | 83 WebInspector.JavaScriptAutocomplete.completionsForExpression("arr2."
, "").then(checkAgainstGolden.bind(this, ["length"], ["1", "2", "3"], next)); |
| 85 }, | 84 }, |
| 86 ]); | 85 ]); |
| 87 | 86 |
| 88 function checkAgainstGolden(golden, antiGolden, continuation, completions) | 87 function checkAgainstGolden(golden, antiGolden, continuation, completions) |
| 89 { | 88 { |
| 90 var failed = false; | 89 var failed = false; |
| 91 for (var i = 0; i < golden.length; ++i) { | 90 for (var i = 0; i < golden.length; ++i) { |
| 92 if (completions.indexOf(golden[i]) === -1) { | 91 if (completions.indexOf(golden[i]) === -1) { |
| 93 failed = true; | 92 failed = true; |
| 94 InspectorTest.addResult("FAIL: NOT FOUND: " + golden[i]); | 93 InspectorTest.addResult("FAIL: NOT FOUND: " + golden[i]); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 112 </script> | 111 </script> |
| 113 </head> | 112 </head> |
| 114 | 113 |
| 115 <body onload="runTest()"> | 114 <body onload="runTest()"> |
| 116 <p> | 115 <p> |
| 117 Test that completions in the context of the call frame will result in names | 116 Test that completions in the context of the call frame will result in names |
| 118 of its scope variables. | 117 of its scope variables. |
| 119 </p> | 118 </p> |
| 120 </body> | 119 </body> |
| 121 </html> | 120 </html> |
| OLD | NEW |