OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * @fileoverview This file contains small testing framework along with the | 7 * @fileoverview This file contains small testing framework along with the |
8 * test suite for the frontend. These tests are a part of the continues build | 8 * test suite for the frontend. These tests are a part of the continues build |
9 * and are executed by the devtools_sanity_unittest.cc as a part of the | 9 * and are executed by the devtools_sanity_unittest.cc as a part of the |
10 * Interactive UI Test suite. | 10 * Interactive UI Test suite. |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 }, true /* sticky */); | 388 }, true /* sticky */); |
389 | 389 |
390 this.showPanel('scripts'); | 390 this.showPanel('scripts'); |
391 | 391 |
392 // Wait until all scripts are added to the debugger. | 392 // Wait until all scripts are added to the debugger. |
393 this.takeControl(); | 393 this.takeControl(); |
394 }; | 394 }; |
395 | 395 |
396 | 396 |
397 /** | 397 /** |
| 398 * Tests that scripts tab is populated with inspected scripts even if it |
| 399 * hadn't been shown by the moment inspected paged refreshed. |
| 400 * @see http://crbug.com/26312 |
| 401 */ |
| 402 TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = |
| 403 function() { |
| 404 var test = this; |
| 405 this.assertEquals(WebInspector.panels.elements, |
| 406 WebInspector.currentPanel, 'Elements panel should be current one.'); |
| 407 |
| 408 this.addSniffer(devtools.DebuggerAgent.prototype, 'reset', |
| 409 waitUntilScriptIsParsed); |
| 410 |
| 411 // Reload inspected page. It will reset the debugger agent. |
| 412 test.evaluateInConsole_( |
| 413 'window.location.reload(true);', |
| 414 function(resultText) { |
| 415 test.assertEquals('undefined', resultText, |
| 416 'Unexpected result of reload().'); |
| 417 }); |
| 418 |
| 419 function waitUntilScriptIsParsed() { |
| 420 var parsed = devtools.tools.getDebuggerAgent().parsedScripts_; |
| 421 for (var id in parsed) { |
| 422 var url = parsed[id].getUrl(); |
| 423 if (url && url.search('debugger_test_page.html$') != -1) { |
| 424 checkScriptsPanel(); |
| 425 return; |
| 426 } |
| 427 } |
| 428 test.addSniffer(devtools.DebuggerAgent.prototype, 'addScriptInfo_', |
| 429 waitUntilScriptIsParsed); |
| 430 } |
| 431 |
| 432 function checkScriptsPanel() { |
| 433 test.showPanel('scripts'); |
| 434 test.assertTrue(test._scriptsAreParsed(['debugger_test_page.html$']), |
| 435 'Inspected script not found in the scripts list'); |
| 436 test.releaseControl(); |
| 437 } |
| 438 |
| 439 // Wait until all scripts are added to the debugger. |
| 440 this.takeControl(); |
| 441 }; |
| 442 |
| 443 |
| 444 /** |
398 * Tests that scripts list contains content scripts. | 445 * Tests that scripts list contains content scripts. |
399 */ | 446 */ |
400 TestSuite.prototype.testContentScriptIsPresent = function() { | 447 TestSuite.prototype.testContentScriptIsPresent = function() { |
401 this.showPanel('scripts'); | 448 this.showPanel('scripts'); |
402 var test = this; | 449 var test = this; |
403 | 450 |
404 test._waitUntilScriptsAreParsed( | 451 test._waitUntilScriptsAreParsed( |
405 ['page_with_content_script.html$', 'simple_content_script.js$'], | 452 ['page_with_content_script.html$', 'simple_content_script.js$'], |
406 function() { | 453 function() { |
407 test.releaseControl(); | 454 test.releaseControl(); |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 /** | 1696 /** |
1650 * Run specified test on a fresh instance of the test suite. | 1697 * Run specified test on a fresh instance of the test suite. |
1651 * @param {string} name Name of a test method from TestSuite class. | 1698 * @param {string} name Name of a test method from TestSuite class. |
1652 */ | 1699 */ |
1653 uiTests.runTest = function(name) { | 1700 uiTests.runTest = function(name) { |
1654 new TestSuite().runTest(name); | 1701 new TestSuite().runTest(name); |
1655 }; | 1702 }; |
1656 | 1703 |
1657 | 1704 |
1658 } | 1705 } |
OLD | NEW |