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 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 bool isTestFile(String filename) { | 720 bool isTestFile(String filename) { |
| 721 // Use the specified predicate, if provided. | 721 // Use the specified predicate, if provided. |
| 722 if (isTestFilePredicate != null) return isTestFilePredicate(filename); | 722 if (isTestFilePredicate != null) return isTestFilePredicate(filename); |
| 723 return filename.endsWith("Test.dart"); | 723 return filename.endsWith("Test.dart"); |
| 724 } | 724 } |
| 725 | 725 |
| 726 bool isHtmlTestFile(String filename) => filename.endsWith('_htmltest.html'); | 726 bool isHtmlTestFile(String filename) => filename.endsWith('_htmltest.html'); |
| 727 | 727 |
| 728 List<String> additionalOptions(Path filePath) => []; | 728 List<String> additionalOptions(Path filePath) => []; |
| 729 | 729 |
| 730 Map<String, String> localPackageDirectories; | 730 forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) async { |
| 731 await updateDartium(); | |
| 732 doTest = onTest; | |
| 733 testExpectations = await readExpectations(); | |
| 731 | 734 |
| 732 void forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) { | 735 // Check if we have already found and generated the tests for this suite. |
| 733 discoverPackagesInRepository().then((Map packageDirectories) { | 736 if (!testCache.containsKey(suiteName)) { |
|
kustermann
2017/04/04 15:04:43
Can't you get rid of the discoverPackagesInReposit
Bill Hesse
2017/04/04 15:22:28
There is another use of it, in the PkgBuildTestSui
| |
| 734 localPackageDirectories = packageDirectories; | 737 cachedTests = testCache[suiteName] = []; |
| 735 return updateDartium(); | 738 await enqueueTests(); |
| 736 }).then((_) { | 739 } else { |
| 737 doTest = onTest; | 740 for (var info in testCache[suiteName]) { |
| 738 | 741 enqueueTestCaseFromTestInformation(info); |
| 739 return readExpectations(); | |
| 740 }).then((expectations) { | |
| 741 testExpectations = expectations; | |
| 742 | |
| 743 // Checked if we have already found and generated the tests for | |
| 744 // this suite. | |
| 745 if (!testCache.containsKey(suiteName)) { | |
| 746 cachedTests = testCache[suiteName] = []; | |
| 747 return enqueueTests(); | |
| 748 } else { | |
| 749 // We rely on enqueueing completing asynchronously. | |
|
Bill Hesse
2017/04/04 14:58:49
An await function always returns asynchronously, w
kustermann
2017/04/04 15:04:11
Acknowledged.
| |
| 750 return asynchronously(() { | |
| 751 for (var info in testCache[suiteName]) { | |
| 752 enqueueTestCaseFromTestInformation(info); | |
| 753 } | |
| 754 }); | |
| 755 } | 742 } |
| 756 }).then((_) { | 743 } |
| 757 testExpectations = null; | 744 testExpectations = null; |
| 758 cachedTests = null; | 745 cachedTests = null; |
| 759 doTest = null; | 746 doTest = null; |
| 760 if (onDone != null) onDone(); | 747 if (onDone != null) onDone(); |
| 761 }); | |
| 762 } | 748 } |
| 763 | 749 |
| 764 /** | 750 /** |
| 765 * If Content shell/Dartium is required, and not yet updated, waits for | 751 * If Content shell/Dartium is required, and not yet updated, waits for |
| 766 * the update then completes. Otherwise completes immediately. | 752 * the update then completes. Otherwise completes immediately. |
| 767 */ | 753 */ |
| 768 Future updateDartium() { | 754 Future updateDartium() { |
| 769 var completer = new Completer(); | 755 var completer = new Completer(); |
| 770 var updater = runtimeUpdater(configuration); | 756 var updater = runtimeUpdater(configuration); |
| 771 if (updater == null || updater.updated) { | 757 if (updater == null || updater.updated) { |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2421 } | 2407 } |
| 2422 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2408 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
| 2423 ++shortNameCounter; | 2409 ++shortNameCounter; |
| 2424 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 2410 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); |
| 2425 path = "short${shortNameCounter}_$pathEnd"; | 2411 path = "short${shortNameCounter}_$pathEnd"; |
| 2426 } | 2412 } |
| 2427 } | 2413 } |
| 2428 return path; | 2414 return path; |
| 2429 } | 2415 } |
| 2430 } | 2416 } |
| OLD | NEW |