| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 /** | 338 /** |
| 339 * Tests that scripts tab can be open and populated with inspected scripts. | 339 * Tests that scripts tab can be open and populated with inspected scripts. |
| 340 */ | 340 */ |
| 341 TestSuite.prototype.testShowScriptsTab = function() { | 341 TestSuite.prototype.testShowScriptsTab = function() { |
| 342 var parsedDebuggerTestPageHtml = false; | 342 var parsedDebuggerTestPageHtml = false; |
| 343 | 343 |
| 344 // Intercept parsedScriptSource calls to check that all expected scripts are | 344 // Intercept parsedScriptSource calls to check that all expected scripts are |
| 345 // added to the debugger. | 345 // added to the debugger. |
| 346 var test = this; | 346 var test = this; |
| 347 var receivedConsoleApiSource = false; |
| 347 this.addSniffer(WebInspector, 'parsedScriptSource', | 348 this.addSniffer(WebInspector, 'parsedScriptSource', |
| 348 function(sourceID, sourceURL, source, startingLine) { | 349 function(sourceID, sourceURL, source, startingLine) { |
| 349 if (sourceURL.search(/debugger_test_page.html$/) != -1) { | 350 if (sourceURL == undefined) { |
| 351 if (receivedConsoleApiSource) { |
| 352 test.fail('Unexpected script without URL'); |
| 353 } else { |
| 354 receivedConsoleApiSource = true; |
| 355 } |
| 356 } else if (sourceURL.search(/debugger_test_page.html$/) != -1) { |
| 350 if (parsedDebuggerTestPageHtml) { | 357 if (parsedDebuggerTestPageHtml) { |
| 351 test.fail('Unexpected parse event: ' + sourceURL); | 358 test.fail('Unexpected parse event: ' + sourceURL); |
| 352 } | 359 } |
| 353 parsedDebuggerTestPageHtml = true; | 360 parsedDebuggerTestPageHtml = true; |
| 354 } else { | 361 } else { |
| 355 test.fail('Unexpected script URL: ' + sourceURL); | 362 test.fail('Unexpected script URL: ' + sourceURL); |
| 356 } | 363 } |
| 357 | 364 |
| 358 if (!WebInspector.panels.scripts.visibleView) { | 365 if (!WebInspector.panels.scripts.visibleView) { |
| 359 test.fail('No visible script view: ' + sourceURL); | 366 test.fail('No visible script view: ' + sourceURL); |
| 360 } | 367 } |
| 361 | 368 |
| 362 if (parsedDebuggerTestPageHtml) { | 369 // There should be two scripts: one for the main page and another |
| 370 // one which is source of console API(see |
| 371 // InjectedScript._ensureCommandLineAPIInstalled). |
| 372 if (parsedDebuggerTestPageHtml && receivedConsoleApiSource) { |
| 363 test.releaseControl(); | 373 test.releaseControl(); |
| 364 } | 374 } |
| 365 }, true /* sticky */); | 375 }, true /* sticky */); |
| 366 | 376 |
| 367 this.showPanel('scripts'); | 377 this.showPanel('scripts'); |
| 368 | 378 |
| 369 // Wait until all scripts are added to the debugger. | 379 // Wait until all scripts are added to the debugger. |
| 370 this.takeControl(); | 380 this.takeControl(); |
| 371 }; | 381 }; |
| 372 | 382 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 /** | 588 /** |
| 579 * Run specified test on a fresh instance of the test suite. | 589 * Run specified test on a fresh instance of the test suite. |
| 580 * @param {string} name Name of a test method from TestSuite class. | 590 * @param {string} name Name of a test method from TestSuite class. |
| 581 */ | 591 */ |
| 582 uiTests.runTest = function(name) { | 592 uiTests.runTest = function(name) { |
| 583 new TestSuite().runTest(name); | 593 new TestSuite().runTest(name); |
| 584 }; | 594 }; |
| 585 | 595 |
| 586 | 596 |
| 587 } | 597 } |
| OLD | NEW |