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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 this.takeControl(); | 253 this.takeControl(); |
254 }; | 254 }; |
255 | 255 |
256 /** | 256 /** |
257 * Tests that scripts tab is populated with inspected scripts even if it | 257 * Tests that scripts tab is populated with inspected scripts even if it |
258 * hadn't been shown by the moment inspected paged refreshed. | 258 * hadn't been shown by the moment inspected paged refreshed. |
259 * @see http://crbug.com/26312 | 259 * @see http://crbug.com/26312 |
260 */ | 260 */ |
261 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function
() { | 261 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function
() { |
262 var test = this; | 262 var test = this; |
263 var debuggerModel = SDK.DebuggerModel.fromTarget(SDK.targetManager.mainTarge
t()); | 263 var debuggerModel = SDK.targetManager.mainTarget().model(SDK.DebuggerModel); |
264 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared,
waitUntilScriptIsParsed); | 264 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared,
waitUntilScriptIsParsed); |
265 | 265 |
266 this.showPanel('elements').then(function() { | 266 this.showPanel('elements').then(function() { |
267 // Reload inspected page. It will reset the debugger agent. | 267 // Reload inspected page. It will reset the debugger agent. |
268 test.evaluateInConsole_('window.location.reload(true);', function(resultTe
xt) {}); | 268 test.evaluateInConsole_('window.location.reload(true);', function(resultTe
xt) {}); |
269 }); | 269 }); |
270 | 270 |
271 function waitUntilScriptIsParsed() { | 271 function waitUntilScriptIsParsed() { |
272 debuggerModel.removeEventListener(SDK.DebuggerModel.Events.GlobalObjectCle
ared, waitUntilScriptIsParsed); | 272 debuggerModel.removeEventListener(SDK.DebuggerModel.Events.GlobalObjectCle
ared, waitUntilScriptIsParsed); |
273 test.showPanel('sources').then(function() { | 273 test.showPanel('sources').then(function() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 }); | 338 }); |
339 }); | 339 }); |
340 | 340 |
341 // Wait until all scripts are added to the debugger. | 341 // Wait until all scripts are added to the debugger. |
342 this.takeControl(); | 342 this.takeControl(); |
343 }; | 343 }; |
344 | 344 |
345 // Tests that debugger works correctly if pause event occurs when DevTools | 345 // Tests that debugger works correctly if pause event occurs when DevTools |
346 // frontend is being loaded. | 346 // frontend is being loaded. |
347 TestSuite.prototype.testPauseWhenLoadingDevTools = function() { | 347 TestSuite.prototype.testPauseWhenLoadingDevTools = function() { |
348 var debuggerModel = SDK.DebuggerModel.fromTarget(SDK.targetManager.mainTarge
t()); | 348 var debuggerModel = SDK.targetManager.mainTarget().model(SDK.DebuggerModel); |
349 if (debuggerModel.debuggerPausedDetails) | 349 if (debuggerModel.debuggerPausedDetails) |
350 return; | 350 return; |
351 | 351 |
352 this.showPanel('sources').then(function() { | 352 this.showPanel('sources').then(function() { |
353 // Script execution can already be paused. | 353 // Script execution can already be paused. |
354 | 354 |
355 this._waitForScriptPause(this.releaseControl.bind(this)); | 355 this._waitForScriptPause(this.releaseControl.bind(this)); |
356 }.bind(this)); | 356 }.bind(this)); |
357 | 357 |
358 this.takeControl(); | 358 this.takeControl(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 function callback() { | 570 function callback() { |
571 Protocol.InspectorBackend.deprecatedRunAfterPendingDispatches(this.release
Control.bind(this)); | 571 Protocol.InspectorBackend.deprecatedRunAfterPendingDispatches(this.release
Control.bind(this)); |
572 } | 572 } |
573 }; | 573 }; |
574 | 574 |
575 TestSuite.prototype.testPauseInSharedWorkerInitialization2 = function() { | 575 TestSuite.prototype.testPauseInSharedWorkerInitialization2 = function() { |
576 this.takeControl(); | 576 this.takeControl(); |
577 this._waitForTargets(2, callback.bind(this)); | 577 this._waitForTargets(2, callback.bind(this)); |
578 | 578 |
579 function callback() { | 579 function callback() { |
580 var target = SDK.targetManager.targets(SDK.Target.Capability.JS)[0]; | 580 var debuggerModel = SDK.targetManager.models(SDK.DebuggerModel)[0]; |
581 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | |
582 if (debuggerModel.isPaused()) { | 581 if (debuggerModel.isPaused()) { |
583 this.releaseControl(); | 582 this.releaseControl(); |
584 return; | 583 return; |
585 } | 584 } |
586 this._waitForScriptPause(this.releaseControl.bind(this)); | 585 this._waitForScriptPause(this.releaseControl.bind(this)); |
587 } | 586 } |
588 }; | 587 }; |
589 | 588 |
590 TestSuite.prototype.enableTouchEmulation = function() { | 589 TestSuite.prototype.enableTouchEmulation = function() { |
591 var deviceModeModel = new Emulation.DeviceModeModel(function() {}); | 590 var deviceModeModel = new Emulation.DeviceModeModel(function() {}); |
592 deviceModeModel._target = SDK.targetManager.mainTarget(); | 591 deviceModeModel._target = SDK.targetManager.mainTarget(); |
593 deviceModeModel._applyTouch(true, true); | 592 deviceModeModel._applyTouch(true, true); |
594 }; | 593 }; |
595 | 594 |
596 TestSuite.prototype.enableAutoAttachToCreatedPages = function() { | 595 TestSuite.prototype.enableAutoAttachToCreatedPages = function() { |
597 Common.settingForTest('autoAttachToCreatedPages').set(true); | 596 Common.settingForTest('autoAttachToCreatedPages').set(true); |
598 }; | 597 }; |
599 | 598 |
600 TestSuite.prototype.waitForDebuggerPaused = function() { | 599 TestSuite.prototype.waitForDebuggerPaused = function() { |
601 var debuggerModel = SDK.DebuggerModel.fromTarget(SDK.targetManager.mainTarge
t()); | 600 var debuggerModel = SDK.targetManager.mainTarget().model(SDK.DebuggerModel); |
602 if (debuggerModel.debuggerPausedDetails) | 601 if (debuggerModel.debuggerPausedDetails) |
603 return; | 602 return; |
604 | 603 |
605 this.takeControl(); | 604 this.takeControl(); |
606 this._waitForScriptPause(this.releaseControl.bind(this)); | 605 this._waitForScriptPause(this.releaseControl.bind(this)); |
607 }; | 606 }; |
608 | 607 |
609 TestSuite.prototype.switchToPanel = function(panelName) { | 608 TestSuite.prototype.switchToPanel = function(panelName) { |
610 this.showPanel(panelName).then(this.releaseControl.bind(this)); | 609 this.showPanel(panelName).then(this.releaseControl.bind(this)); |
611 this.takeControl(); | 610 this.takeControl(); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 if (runtimeModel.executionContexts().length >= n) | 1103 if (runtimeModel.executionContexts().length >= n) |
1105 callback.call(null); | 1104 callback.call(null); |
1106 else | 1105 else |
1107 this.addSniffer(SDK.RuntimeModel.prototype, '_executionContextCreated',
checkForExecutionContexts.bind(this)); | 1106 this.addSniffer(SDK.RuntimeModel.prototype, '_executionContextCreated',
checkForExecutionContexts.bind(this)); |
1108 } | 1107 } |
1109 }; | 1108 }; |
1110 | 1109 |
1111 | 1110 |
1112 window.uiTests = new TestSuite(window.domAutomationController); | 1111 window.uiTests = new TestSuite(window.domAutomationController); |
1113 })(window); | 1112 })(window); |
OLD | NEW |