Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 expectedOutcomes, isNegative: isNegative, info: info) { | 398 expectedOutcomes, isNegative: isNegative, info: info) { |
| 399 numRetries = 2; // Allow two retries to compensate for flaky browser tests. | 399 numRetries = 2; // Allow two retries to compensate for flaky browser tests. |
| 400 observers = []; | 400 observers = []; |
| 401 } | 401 } |
| 402 | 402 |
| 403 List<String> get _lastArguments => commands.last.arguments; | 403 List<String> get _lastArguments => commands.last.arguments; |
| 404 | 404 |
| 405 List<String> get batchRunnerArguments => [_lastArguments[0], '--batch']; | 405 List<String> get batchRunnerArguments => [_lastArguments[0], '--batch']; |
| 406 | 406 |
| 407 List<String> get batchTestArguments => _lastArguments.sublist(1); | 407 List<String> get batchTestArguments => _lastArguments.sublist(1); |
| 408 | 408 |
|
kustermann
2013/05/29 08:16:11
I'd really prefer if you pass it in via the Browse
ricow1
2013/05/29 08:25:42
Done.
| |
| 409 String testingUrl; | |
| 410 | |
| 409 /** Add a test case to listen for when this current test has completed. */ | 411 /** Add a test case to listen for when this current test has completed. */ |
| 410 void addObserver(BrowserTestCase testCase) { | 412 void addObserver(BrowserTestCase testCase) { |
| 411 observers.add(testCase); | 413 observers.add(testCase); |
| 412 } | 414 } |
| 413 | 415 |
| 414 /** | 416 /** |
| 415 * Notify all of the test cases that are dependent on this one that they can | 417 * Notify all of the test cases that are dependent on this one that they can |
| 416 * proceed. | 418 * proceed. |
| 417 */ | 419 */ |
| 418 void notifyObservers() { | 420 void notifyObservers() { |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1654 return testRunner; | 1656 return testRunner; |
| 1655 } | 1657 } |
| 1656 print("Issue starting browser test runner"); | 1658 print("Issue starting browser test runner"); |
| 1657 io.exit(1); | 1659 io.exit(1); |
| 1658 }); | 1660 }); |
| 1659 } | 1661 } |
| 1660 return new Future.immediate(_browserTestRunners[runtime]); | 1662 return new Future.immediate(_browserTestRunners[runtime]); |
| 1661 } | 1663 } |
| 1662 | 1664 |
| 1663 void _startBrowserControllerTest(var test) { | 1665 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) { | 1666 var callback = (var output) { |
| 1667 var nextCommandIndex = test.commandOutputs.keys.length; | |
| 1671 new CommandOutput.fromCase(test, | 1668 new CommandOutput.fromCase(test, |
| 1672 test.commands[nextCommandIndex], | 1669 test.commands[nextCommandIndex], |
| 1673 0, | 1670 0, |
| 1674 false, | 1671 false, |
| 1675 output == "TIMEOUT", | 1672 output == "TIMEOUT", |
| 1676 encodeUtf8(output), | 1673 encodeUtf8(output), |
| 1677 [], | 1674 [], |
| 1678 const Duration(seconds: 1), | 1675 const Duration(seconds: 1), |
| 1679 false); | 1676 false); |
| 1680 test.completedHandler(test); | 1677 test.completedHandler(test); |
| 1681 }; | 1678 }; |
| 1682 BrowserTest browserTest = new BrowserTest(url, callback, test.timeout); | 1679 BrowserTest browserTest = new BrowserTest(test.testingUrl, |
| 1680 callback, | |
| 1681 test.timeout); | |
| 1683 _getBrowserTestRunner(test).then((testRunner) { | 1682 _getBrowserTestRunner(test).then((testRunner) { |
| 1684 testRunner.queueTest(browserTest); | 1683 testRunner.queueTest(browserTest); |
| 1685 }); | 1684 }); |
| 1686 } | 1685 } |
| 1687 | 1686 |
| 1688 void _tryRunTest() { | 1687 void _tryRunTest() { |
| 1689 _checkDone(); | 1688 _checkDone(); |
| 1690 // TODO(ricow): remove most of the hacked selenium code below when | 1689 // TODO(ricow): remove most of the hacked selenium code below when |
| 1691 // we have eliminated the need. | 1690 // we have eliminated the need. |
| 1692 | 1691 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1907 } | 1906 } |
| 1908 } | 1907 } |
| 1909 | 1908 |
| 1910 void eventAllTestsDone() { | 1909 void eventAllTestsDone() { |
| 1911 for (var listener in _eventListener) { | 1910 for (var listener in _eventListener) { |
| 1912 listener.allDone(); | 1911 listener.allDone(); |
| 1913 } | 1912 } |
| 1914 } | 1913 } |
| 1915 } | 1914 } |
| 1916 | 1915 |
| OLD | NEW |