Index: tools/test.dart |
diff --git a/tools/test.dart b/tools/test.dart |
index 8d7388c0a2e29a4b6d4e39133614263e7575d189..80b4bb99fbef0cb57f0cc6fb51579d09bb9395b2 100755 |
--- a/tools/test.dart |
+++ b/tools/test.dart |
@@ -81,7 +81,7 @@ main() { |
var verbose = firstConf['verbose']; |
var printTiming = firstConf['time']; |
var listTests = firstConf['list']; |
- |
+ |
if (!firstConf['append_flaky_log']) { |
var file = new File(TestUtils.flakyFileName()); |
if (file.existsSync()) { |
@@ -104,6 +104,22 @@ main() { |
print(Strings.join(output_words, ' ')); |
} |
+ // Start global http servers that serve the entire dart repo. |
+ // The http server is available on window.location.port, and a second server |
+ // for cross-domain tests can be found by calling getCrossOriginPortNumber(). |
+ List serverList = []; |
+ if (!listTests) { |
+ // Only start the server if we are running browser tests. |
+ var runningBrowserTests = configurations.some((config) { |
+ return TestUtils.isBrowserRuntime(config['runtime']); |
+ }); |
+ if (runningBrowserTests) { |
+ serverList.add(startHttpServer('127.0.0.1')); |
+ // We start two servers so that we can test cross-domain tests. |
+ serverList.add(startHttpServer('127.0.0.1', serverList[0].port)); |
+ } |
+ } |
+ |
var configurationIterator = configurations.iterator(); |
void enqueueConfiguration(ProcessQueue queue) { |
if (!configurationIterator.hasNext) return; |
@@ -126,29 +142,18 @@ main() { |
final name = testSuiteDir.filename; |
if (selectors.containsKey(name)) { |
queue.addTestSuite( |
- new StandardTestSuite.forDirectory(conf, testSuiteDir)); |
+ new StandardTestSuite.forDirectory(conf, testSuiteDir, serverList)); |
} |
} |
} |
- // Start global http server that serves the entire dart repo. |
- // The http server is available on localhost:9876 for any |
- // test that needs to load resources from the repo over http. |
- if (!listTests) { |
- // Only start the server if we are running browser tests. |
- var runningBrowserTests = configurations.some((config) { |
- return TestUtils.isBrowserRuntime(config['runtime']); |
- }); |
- if (runningBrowserTests) startHttpServer('127.0.0.1', 9876); |
- } |
- |
// Start process queue. |
new ProcessQueue(maxProcesses, |
progressIndicator, |
startTime, |
printTiming, |
enqueueConfiguration, |
- () => terminateHttpServer(), |
+ () => terminateHttpServers(serverList), |
verbose, |
listTests); |
} |