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._appendCommand(code, true); |
25 consoleView._prompt.setText(code); | |
26 var event = new KeyboardEvent("keydown", { | |
27 key: "Enter", | |
28 bubbles: true, | |
29 cancelable: true | |
30 }); | |
31 consoleView._prompt.proxyElementForTests().dispatchEvent(event); | |
32 InspectorTest.addConsoleViewSniffer(function(commandResult) { | 25 InspectorTest.addConsoleViewSniffer(function(commandResult) { |
33 callback(commandResult.toMessageElement().deepTextContent()); | 26 callback(commandResult.toMessageElement().deepTextContent()); |
34 }); | 27 }); |
35 } | 28 } |
36 | 29 |
37 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) | 30 InspectorTest.addConsoleViewSniffer = function(override, opt_sticky) |
38 { | 31 { |
39 var sniffer = function (viewMessage) { | 32 var sniffer = function (viewMessage) { |
40 override(viewMessage); | 33 override(viewMessage); |
41 }; | 34 }; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if (consoleView._visibleViewMessages.length === expectedCount) { | 402 if (consoleView._visibleViewMessages.length === expectedCount) { |
410 InspectorTest.addResult("Message count: " + expectedCount); | 403 InspectorTest.addResult("Message count: " + expectedCount); |
411 callback(); | 404 callback(); |
412 } else { | 405 } else { |
413 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); | 406 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); |
414 } | 407 } |
415 } | 408 } |
416 } | 409 } |
417 | 410 |
418 } | 411 } |
OLD | NEW |