| 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 enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 var completer = new Completer(); | 53 var completer = new Completer(); |
| 54 Timer.run(() => completer.complete(function())); | 54 Timer.run(() => completer.complete(function())); |
| 55 | 55 |
| 56 return completer.future; | 56 return completer.future; |
| 57 } | 57 } |
| 58 | 58 |
| 59 /** A completer that waits until all added [Future]s complete. */ | 59 /** A completer that waits until all added [Future]s complete. */ |
| 60 // TODO(rnystrom): Copied from web_components. Remove from here when it gets | 60 // TODO(rnystrom): Copied from web_components. Remove from here when it gets |
| 61 // added to dart:core. (See #6626.) | 61 // added to dart:core. (See #6626.) |
| 62 class FutureGroup { | 62 class FutureGroup { |
| 63 const _FINISHED = -1; | 63 static const _FINISHED = -1; |
| 64 int _pending = 0; | 64 int _pending = 0; |
| 65 Completer<List> _completer = new Completer<List>(); | 65 Completer<List> _completer = new Completer<List>(); |
| 66 final List<Future> futures = <Future>[]; | 66 final List<Future> futures = <Future>[]; |
| 67 bool wasCompleted = false; | 67 bool wasCompleted = false; |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Wait for [task] to complete (assuming this barrier has not already been | 70 * Wait for [task] to complete (assuming this barrier has not already been |
| 71 * marked as completed, otherwise you'll get an exception indicating that a | 71 * marked as completed, otherwise you'll get an exception indicating that a |
| 72 * future has already been completed). | 72 * future has already been completed). |
| 73 */ | 73 */ |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 * files to that directory. It creates a [BrowserTestCase], which has | 900 * files to that directory. It creates a [BrowserTestCase], which has |
| 901 * two sequential steps to be run by the [ProcessQueue] when the test is | 901 * two sequential steps to be run by the [ProcessQueue] when the test is |
| 902 * executed: a compilation step and an execution step, both with the | 902 * executed: a compilation step and an execution step, both with the |
| 903 * appropriate executable and arguments. The [expectations] object can be | 903 * appropriate executable and arguments. The [expectations] object can be |
| 904 * either a Set<String> if the test is a regular test, or a Map<String | 904 * either a Set<String> if the test is a regular test, or a Map<String |
| 905 * subTestName, Set<String>> if we are running a browser multi-test (one | 905 * subTestName, Set<String>> if we are running a browser multi-test (one |
| 906 * compilation and many browser runs). | 906 * compilation and many browser runs). |
| 907 */ | 907 */ |
| 908 void enqueueBrowserTest(TestInformation info, | 908 void enqueueBrowserTest(TestInformation info, |
| 909 String testName, | 909 String testName, |
| 910 Object expectations, | 910 expectations, |
| 911 bool isWrappingRequired) { | 911 bool isWrappingRequired) { |
| 912 // TODO(kustermann/ricow): This method should be refactored. | 912 // TODO(kustermann/ricow): This method should be refactored. |
| 913 Map optionsFromFile = info.optionsFromFile; | 913 Map optionsFromFile = info.optionsFromFile; |
| 914 Path filePath = info.filePath; | 914 Path filePath = info.filePath; |
| 915 String filename = filePath.toString(); | 915 String filename = filePath.toString(); |
| 916 bool isWebTest = optionsFromFile['containsDomImport']; | 916 bool isWebTest = optionsFromFile['containsDomImport']; |
| 917 | 917 |
| 918 final String compiler = configuration['compiler']; | 918 final String compiler = configuration['compiler']; |
| 919 final String runtime = configuration['runtime']; | 919 final String runtime = configuration['runtime']; |
| 920 | 920 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 // compiled, move the input scripts over with the script so they can | 992 // compiled, move the input scripts over with the script so they can |
| 993 // be accessed. | 993 // be accessed. |
| 994 String result = new File.fromPath(fromPath).readAsStringSync(); | 994 String result = new File.fromPath(fromPath).readAsStringSync(); |
| 995 new File('$tempDir/$baseName.dart').writeAsStringSync(result); | 995 new File('$tempDir/$baseName.dart').writeAsStringSync(result); |
| 996 } | 996 } |
| 997 } | 997 } |
| 998 | 998 |
| 999 | 999 |
| 1000 // Variables for browser multi-tests. | 1000 // Variables for browser multi-tests. |
| 1001 List<String> subtestNames = info.optionsFromFile['subtestNames']; | 1001 List<String> subtestNames = info.optionsFromFile['subtestNames']; |
| 1002 TestCase multitestParentTest; | 1002 BrowserTestCase multitestParentTest; |
| 1003 int subtestIndex = 0; | 1003 int subtestIndex = 0; |
| 1004 // Construct the command that executes the browser test | 1004 // Construct the command that executes the browser test |
| 1005 do { | 1005 do { |
| 1006 List<Command> commandSet = new List<Command>.from(commands); | 1006 List<Command> commandSet = new List<Command>.from(commands); |
| 1007 if (subtestIndex != 0) { | 1007 if (subtestIndex != 0) { |
| 1008 // NOTE: The first time we enter this loop, all the compilation | 1008 // NOTE: The first time we enter this loop, all the compilation |
| 1009 // commands will be executed. On subsequent loop iterations, we | 1009 // commands will be executed. On subsequent loop iterations, we |
| 1010 // don't need to do any compilations. Thus we set "commandSet = []". | 1010 // don't need to do any compilations. Thus we set "commandSet = []". |
| 1011 commandSet = []; | 1011 commandSet = []; |
| 1012 } | 1012 } |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 * $pass tests are expected to pass | 1965 * $pass tests are expected to pass |
| 1966 * $failOk tests are expected to fail that we won't fix | 1966 * $failOk tests are expected to fail that we won't fix |
| 1967 * $fail tests are expected to fail that we should fix | 1967 * $fail tests are expected to fail that we should fix |
| 1968 * $crash tests are expected to crash that we should fix | 1968 * $crash tests are expected to crash that we should fix |
| 1969 * $timeout tests are allowed to timeout | 1969 * $timeout tests are allowed to timeout |
| 1970 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1970 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1971 """; | 1971 """; |
| 1972 print(report); | 1972 print(report); |
| 1973 } | 1973 } |
| 1974 } | 1974 } |
| OLD | NEW |