OLD | NEW |
1 var initialize_ConsoleTest = function() { | 1 var initialize_ConsoleTest = function() { |
2 | 2 |
3 InspectorTest.preloadModule("source_frame"); | 3 InspectorTest.preloadModule("source_frame"); |
4 InspectorTest.preloadPanel("console"); | 4 InspectorTest.preloadPanel("console"); |
5 | 5 |
6 InspectorTest.selectMainExecutionContext = function() | 6 InspectorTest.selectMainExecutionContext = function() |
7 { | 7 { |
8 var executionContexts = InspectorTest.mainTarget.runtimeModel.executionConte
xts(); | 8 var executionContexts = InspectorTest.mainTarget.runtimeModel.executionConte
xts(); |
9 for (var context of executionContexts) { | 9 for (var context of executionContexts) { |
10 if (context.isDefault) { | 10 if (context.isDefault) { |
11 WebInspector.context.setFlavor(WebInspector.ExecutionContext, contex
t); | 11 WebInspector.context.setFlavor(WebInspector.ExecutionContext, contex
t); |
12 return; | 12 return; |
13 } | 13 } |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 InspectorTest.evaluateInConsole = function(code, callback, dontForceMainContext) | 17 InspectorTest.evaluateInConsole = function(code, callback, dontForceMainContext) |
18 { | 18 { |
19 if (!dontForceMainContext) | 19 if (!dontForceMainContext) |
20 InspectorTest.selectMainExecutionContext(); | 20 InspectorTest.selectMainExecutionContext(); |
21 callback = InspectorTest.safeWrap(callback); | 21 callback = InspectorTest.safeWrap(callback); |
22 | 22 |
23 var consoleView = WebInspector.ConsoleView.instance(); | 23 var consoleView = WebInspector.ConsoleView.instance(); |
24 consoleView.visible = true; | 24 consoleView.visible = true; |
25 consoleView._prompt.setText(code); | 25 consoleView._prompt.setText(code); |
26 var event = new KeyboardEvent("keydown", { | 26 var event = new KeyboardEvent("keydown", { |
27 key: "Enter", | 27 key: "Enter", |
28 keyIdentifier: "Enter", | |
29 bubbles: true, | 28 bubbles: true, |
30 cancelable: true | 29 cancelable: true |
31 }); | 30 }); |
32 consoleView._prompt.proxyElementForTests().dispatchEvent(event); | 31 consoleView._prompt.proxyElementForTests().dispatchEvent(event); |
33 InspectorTest.addConsoleViewSniffer(function(commandResult) { | 32 InspectorTest.addConsoleViewSniffer(function(commandResult) { |
34 callback(commandResult.toMessageElement().deepTextContent()); | 33 callback(commandResult.toMessageElement().deepTextContent()); |
35 }); | 34 }); |
36 } | 35 } |
37 | 36 |
38 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) | 37 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 if (consoleView._visibleViewMessages.length === expectedCount) { | 407 if (consoleView._visibleViewMessages.length === expectedCount) { |
409 InspectorTest.addResult("Message count: " + expectedCount); | 408 InspectorTest.addResult("Message count: " + expectedCount); |
410 callback(); | 409 callback(); |
411 } else { | 410 } else { |
412 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); | 411 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); |
413 } | 412 } |
414 } | 413 } |
415 } | 414 } |
416 | 415 |
417 } | 416 } |
OLD | NEW |