| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 * Evaluates the code in the console as if user typed it manually and invokes | 971 * Evaluates the code in the console as if user typed it manually and invokes |
| 972 * the callback when the result message is received and added to the console. | 972 * the callback when the result message is received and added to the console. |
| 973 * @param {string} code | 973 * @param {string} code |
| 974 * @param {function(string)} callback | 974 * @param {function(string)} callback |
| 975 */ | 975 */ |
| 976 TestSuite.prototype.evaluateInConsole_ = function(code, callback) | 976 TestSuite.prototype.evaluateInConsole_ = function(code, callback) |
| 977 { | 977 { |
| 978 function innerEvaluate() | 978 function innerEvaluate() |
| 979 { | 979 { |
| 980 WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionCo
ntext, showConsoleAndEvaluate, this); | 980 WebInspector.context.removeFlavorChangeListener(WebInspector.ExecutionCo
ntext, showConsoleAndEvaluate, this); |
| 981 var consoleView = WebInspector.ConsolePanel._view(); | 981 var consoleView = WebInspector.ConsoleView.instance(); |
| 982 consoleView._prompt.setText(code); | 982 consoleView._prompt.setText(code); |
| 983 consoleView._promptElement.dispatchEvent(TestSuite.createKeyEvent("Enter
")); | 983 consoleView._promptElement.dispatchEvent(TestSuite.createKeyEvent("Enter
")); |
| 984 | 984 |
| 985 this.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessageAdde
dForTest", | 985 this.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessageAdde
dForTest", |
| 986 function(viewMessage) { | 986 function(viewMessage) { |
| 987 callback(viewMessage.toMessageElement().deepTextContent()); | 987 callback(viewMessage.toMessageElement().deepTextContent()); |
| 988 }.bind(this)); | 988 }.bind(this)); |
| 989 } | 989 } |
| 990 | 990 |
| 991 function showConsoleAndEvaluate() | 991 function showConsoleAndEvaluate() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 */ | 1070 */ |
| 1071 TestSuite.createKeyEvent = function(keyIdentifier) | 1071 TestSuite.createKeyEvent = function(keyIdentifier) |
| 1072 { | 1072 { |
| 1073 var evt = document.createEvent("KeyboardEvent"); | 1073 var evt = document.createEvent("KeyboardEvent"); |
| 1074 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); | 1074 evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel *
/, null /* view */, keyIdentifier, ""); |
| 1075 return evt; | 1075 return evt; |
| 1076 }; | 1076 }; |
| 1077 | 1077 |
| 1078 window.uiTests = new TestSuite(window.domAutomationController); | 1078 window.uiTests = new TestSuite(window.domAutomationController); |
| 1079 })(window); | 1079 })(window); |
| OLD | NEW |