Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 15935008: Remove hackish way of getting the url for browser testing (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for executing tests. 6 * Classes and methods for executing tests.
7 * 7 *
8 * This module includes: 8 * This module includes:
9 * - Managing parallel execution of tests, including timeout checks. 9 * - Managing parallel execution of tests, including timeout checks.
10 * - Evaluating the output of each test as pass/fail/crash/timeout. 10 * - Evaluating the output of each test as pass/fail/crash/timeout.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 */ 386 */
387 bool waitingForOtherTest; 387 bool waitingForOtherTest;
388 388
389 /** 389 /**
390 * The set of test cases that wish to be notified when this test has 390 * The set of test cases that wish to be notified when this test has
391 * completed. 391 * completed.
392 */ 392 */
393 List<BrowserTestCase> observers; 393 List<BrowserTestCase> observers;
394 394
395 BrowserTestCase(displayName, commands, configuration, completedHandler, 395 BrowserTestCase(displayName, commands, configuration, completedHandler,
396 expectedOutcomes, info, isNegative, [this.waitingForOtherTest = false]) 396 expectedOutcomes, info, isNegative, this.testingUrl,
kustermann 2013/05/29 08:46:41 this.testingUrl -> this._testingUrl
397 [this.waitingForOtherTest = false])
397 : super(displayName, commands, configuration, completedHandler, 398 : super(displayName, commands, configuration, completedHandler,
398 expectedOutcomes, isNegative: isNegative, info: info) { 399 expectedOutcomes, isNegative: isNegative, info: info) {
399 numRetries = 2; // Allow two retries to compensate for flaky browser tests. 400 numRetries = 2; // Allow two retries to compensate for flaky browser tests.
400 observers = []; 401 observers = [];
401 } 402 }
402 403
403 List<String> get _lastArguments => commands.last.arguments; 404 List<String> get _lastArguments => commands.last.arguments;
404 405
405 List<String> get batchRunnerArguments => [_lastArguments[0], '--batch']; 406 List<String> get batchRunnerArguments => [_lastArguments[0], '--batch'];
406 407
407 List<String> get batchTestArguments => _lastArguments.sublist(1); 408 List<String> get batchTestArguments => _lastArguments.sublist(1);
408 409
410 String _testingUrl;
411
409 /** Add a test case to listen for when this current test has completed. */ 412 /** Add a test case to listen for when this current test has completed. */
410 void addObserver(BrowserTestCase testCase) { 413 void addObserver(BrowserTestCase testCase) {
411 observers.add(testCase); 414 observers.add(testCase);
412 } 415 }
413 416
414 /** 417 /**
415 * Notify all of the test cases that are dependent on this one that they can 418 * Notify all of the test cases that are dependent on this one that they can
416 * proceed. 419 * proceed.
417 */ 420 */
418 void notifyObservers() { 421 void notifyObservers() {
419 for (BrowserTestCase testCase in observers) { 422 for (BrowserTestCase testCase in observers) {
420 testCase.waitingForOtherTest = false; 423 testCase.waitingForOtherTest = false;
421 } 424 }
422 } 425 }
426
427 String get testingUrl => _testingUrl;
423 } 428 }
424 429
425 430
426 /** 431 /**
427 * CommandOutput records the output of a completed command: the process's exit 432 * CommandOutput records the output of a completed command: the process's exit
428 * code, the standard output and standard error, whether the process timed out, 433 * code, the standard output and standard error, whether the process timed out,
429 * and the time the process took to run. It also contains a pointer to the 434 * and the time the process took to run. It also contains a pointer to the
430 * [TestCase] this is the output of. 435 * [TestCase] this is the output of.
431 */ 436 */
432 abstract class CommandOutput { 437 abstract class CommandOutput {
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 return testRunner; 1659 return testRunner;
1655 } 1660 }
1656 print("Issue starting browser test runner"); 1661 print("Issue starting browser test runner");
1657 io.exit(1); 1662 io.exit(1);
1658 }); 1663 });
1659 } 1664 }
1660 return new Future.immediate(_browserTestRunners[runtime]); 1665 return new Future.immediate(_browserTestRunners[runtime]);
1661 } 1666 }
1662 1667
1663 void _startBrowserControllerTest(var test) { 1668 void _startBrowserControllerTest(var test) {
1664 // Get the url.
1665 // TODO(ricow): This is not needed when we have eliminated selenium.
1666 var nextCommandIndex = test.commandOutputs.keys.length;
1667 var url = test.commands[nextCommandIndex].toString().split("--out=")[1];
1668 // Remove trailing "
1669 url = url.split('"')[0];
1670 var callback = (var output) { 1669 var callback = (var output) {
1670 var nextCommandIndex = test.commandOutputs.keys.length;
1671 new CommandOutput.fromCase(test, 1671 new CommandOutput.fromCase(test,
1672 test.commands[nextCommandIndex], 1672 test.commands[nextCommandIndex],
1673 0, 1673 0,
1674 false, 1674 false,
1675 output == "TIMEOUT", 1675 output == "TIMEOUT",
1676 encodeUtf8(output), 1676 encodeUtf8(output),
1677 [], 1677 [],
1678 const Duration(seconds: 1), 1678 const Duration(seconds: 1),
1679 false); 1679 false);
1680 test.completedHandler(test); 1680 test.completedHandler(test);
1681 }; 1681 };
1682 BrowserTest browserTest = new BrowserTest(url, callback, test.timeout); 1682 BrowserTest browserTest = new BrowserTest(test.testingUrl,
1683 callback,
1684 test.timeout);
1683 _getBrowserTestRunner(test).then((testRunner) { 1685 _getBrowserTestRunner(test).then((testRunner) {
1684 testRunner.queueTest(browserTest); 1686 testRunner.queueTest(browserTest);
1685 }); 1687 });
1686 } 1688 }
1687 1689
1688 void _tryRunTest() { 1690 void _tryRunTest() {
1689 _checkDone(); 1691 _checkDone();
1690 // TODO(ricow): remove most of the hacked selenium code below when 1692 // TODO(ricow): remove most of the hacked selenium code below when
1691 // we have eliminated the need. 1693 // we have eliminated the need.
1692 1694
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 } 1909 }
1908 } 1910 }
1909 1911
1910 void eventAllTestsDone() { 1912 void eventAllTestsDone() {
1911 for (var listener in _eventListener) { 1913 for (var listener in _eventListener) {
1912 listener.allDone(); 1914 listener.allDone();
1913 } 1915 }
1914 } 1916 }
1915 } 1917 }
1916 1918
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698