| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 TestSuite.prototype.testWindowInitializedOnNavigateBack = function() | 916 TestSuite.prototype.testWindowInitializedOnNavigateBack = function() |
| 917 { | 917 { |
| 918 var messages = WebInspector.multitargetConsoleModel.messages(); | 918 var messages = WebInspector.multitargetConsoleModel.messages(); |
| 919 this.assertEquals(1, messages.length); | 919 this.assertEquals(1, messages.length); |
| 920 var text = messages[0].messageText; | 920 var text = messages[0].messageText; |
| 921 if (text.indexOf("Uncaught") !== -1) | 921 if (text.indexOf("Uncaught") !== -1) |
| 922 this.fail(text); | 922 this.fail(text); |
| 923 }; | 923 }; |
| 924 | 924 |
| 925 TestSuite.prototype.testConsoleContextNames = function() |
| 926 { |
| 927 var test = this; |
| 928 test.takeControl(); |
| 929 this.showPanel("console").then(() => this._waitForExecutionContexts(2, onExe
cutionContexts.bind(this))); |
| 930 |
| 931 function onExecutionContexts() |
| 932 { |
| 933 var consoleView = WebInspector.ConsoleView.instance(); |
| 934 var options = consoleView._consoleContextSelector._selectElement.options
; |
| 935 var values = []; |
| 936 for (var i = 0; i < options.length; ++i) |
| 937 values.push(options[i].value.trim()); |
| 938 test.assertEquals("top", values[0]); |
| 939 test.assertEquals("Simple content script", values[1]); |
| 940 test.releaseControl(); |
| 941 } |
| 942 } |
| 943 |
| 925 TestSuite.prototype.waitForTestResultsInConsole = function() | 944 TestSuite.prototype.waitForTestResultsInConsole = function() |
| 926 { | 945 { |
| 927 var messages = WebInspector.multitargetConsoleModel.messages(); | 946 var messages = WebInspector.multitargetConsoleModel.messages(); |
| 928 for (var i = 0; i < messages.length; ++i) { | 947 for (var i = 0; i < messages.length; ++i) { |
| 929 var text = messages[i].messageText; | 948 var text = messages[i].messageText; |
| 930 if (text === "PASS") | 949 if (text === "PASS") |
| 931 return; | 950 return; |
| 932 else if (/^FAIL/.test(text)) | 951 else if (/^FAIL/.test(text)) |
| 933 this.fail(text); // This will throw. | 952 this.fail(text); // This will throw. |
| 934 } | 953 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1188 |
| 1170 function checkTargets() | 1189 function checkTargets() |
| 1171 { | 1190 { |
| 1172 if (WebInspector.targetManager.targets().length >= n) | 1191 if (WebInspector.targetManager.targets().length >= n) |
| 1173 callback.call(null); | 1192 callback.call(null); |
| 1174 else | 1193 else |
| 1175 this.addSniffer(WebInspector.TargetManager.prototype, "addTarget", c
heckTargets.bind(this)); | 1194 this.addSniffer(WebInspector.TargetManager.prototype, "addTarget", c
heckTargets.bind(this)); |
| 1176 } | 1195 } |
| 1177 } | 1196 } |
| 1178 | 1197 |
| 1198 TestSuite.prototype._waitForExecutionContexts = function(n, callback) |
| 1199 { |
| 1200 var runtimeModel = WebInspector.targetManager.mainTarget().runtimeModel; |
| 1201 checkForExecutionContexts.call(this); |
| 1202 |
| 1203 function checkForExecutionContexts() |
| 1204 { |
| 1205 if (runtimeModel.executionContexts().length >= n) |
| 1206 callback.call(null); |
| 1207 else |
| 1208 this.addSniffer(WebInspector.RuntimeModel.prototype, "_executionCont
extCreated", checkForExecutionContexts.bind(this)); |
| 1209 } |
| 1210 } |
| 1211 |
| 1179 /** | 1212 /** |
| 1180 * Key event with given key identifier. | 1213 * Key event with given key identifier. |
| 1181 */ | 1214 */ |
| 1182 TestSuite.createKeyEvent = function(key) | 1215 TestSuite.createKeyEvent = function(key) |
| 1183 { | 1216 { |
| 1184 return new KeyboardEvent("keydown", {bubbles: true, cancelable:true, key: ke
y}); | 1217 return new KeyboardEvent("keydown", {bubbles: true, cancelable:true, key: ke
y}); |
| 1185 }; | 1218 }; |
| 1186 | 1219 |
| 1187 window.uiTests = new TestSuite(window.domAutomationController); | 1220 window.uiTests = new TestSuite(window.domAutomationController); |
| 1188 })(window); | 1221 })(window); |
| OLD | NEW |