| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 * the callback when the result message is received and added to the console. | 1102 * the callback when the result message is received and added to the console. |
| 1103 * @param {string} code | 1103 * @param {string} code |
| 1104 * @param {function(string)} callback | 1104 * @param {function(string)} callback |
| 1105 */ | 1105 */ |
| 1106 TestSuite.prototype.evaluateInConsole_ = function(code, callback) | 1106 TestSuite.prototype.evaluateInConsole_ = function(code, callback) |
| 1107 { | 1107 { |
| 1108 function innerEvaluate() | 1108 function innerEvaluate() |
| 1109 { | 1109 { |
| 1110 WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionCo
ntext, showConsoleAndEvaluate, this); | 1110 WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionCo
ntext, showConsoleAndEvaluate, this); |
| 1111 var consoleView = WebInspector.ConsoleView.instance(); | 1111 var consoleView = WebInspector.ConsoleView.instance(); |
| 1112 consoleView._prompt.setText(code); | 1112 consoleView._prompt._appendCommand(code); |
| 1113 consoleView._prompt.element.dispatchEvent(TestSuite.createKeyEvent("Ente
r")); | |
| 1114 | 1113 |
| 1115 this.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessageAdde
dForTest", | 1114 this.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessageAdde
dForTest", |
| 1116 function(viewMessage) { | 1115 function(viewMessage) { |
| 1117 callback(viewMessage.toMessageElement().deepTextContent()); | 1116 callback(viewMessage.toMessageElement().deepTextContent()); |
| 1118 }.bind(this)); | 1117 }.bind(this)); |
| 1119 } | 1118 } |
| 1120 | 1119 |
| 1121 function showConsoleAndEvaluate() | 1120 function showConsoleAndEvaluate() |
| 1122 { | 1121 { |
| 1123 WebInspector.console.showPromise().then(innerEvaluate.bind(this)); | 1122 WebInspector.console.showPromise().then(innerEvaluate.bind(this)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 /** | 1211 /** |
| 1213 * Key event with given key identifier. | 1212 * Key event with given key identifier. |
| 1214 */ | 1213 */ |
| 1215 TestSuite.createKeyEvent = function(key) | 1214 TestSuite.createKeyEvent = function(key) |
| 1216 { | 1215 { |
| 1217 return new KeyboardEvent("keydown", {bubbles: true, cancelable:true, key: ke
y}); | 1216 return new KeyboardEvent("keydown", {bubbles: true, cancelable:true, key: ke
y}); |
| 1218 }; | 1217 }; |
| 1219 | 1218 |
| 1220 window.uiTests = new TestSuite(window.domAutomationController); | 1219 window.uiTests = new TestSuite(window.domAutomationController); |
| 1221 })(window); | 1220 })(window); |
| OLD | NEW |