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

Side by Side Diff: tools/test.dart

Issue 11641005: Add cross-origin test with credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /** 6 /**
7 * This file is the entrypoint of the dart test suite. This suite is used 7 * This file is the entrypoint of the dart test suite. This suite is used
8 * to test: 8 * to test:
9 * 9 *
10 * 1. the dart vm 10 * 1. the dart vm
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // Extract global options from first configuration. 75 // Extract global options from first configuration.
76 var firstConf = configurations[0]; 76 var firstConf = configurations[0];
77 Map<String, RegExp> selectors = firstConf['selectors']; 77 Map<String, RegExp> selectors = firstConf['selectors'];
78 var maxProcesses = firstConf['tasks']; 78 var maxProcesses = firstConf['tasks'];
79 var progressIndicator = firstConf['progress']; 79 var progressIndicator = firstConf['progress'];
80 BuildbotProgressIndicator.stepName = firstConf['step_name']; 80 BuildbotProgressIndicator.stepName = firstConf['step_name'];
81 var verbose = firstConf['verbose']; 81 var verbose = firstConf['verbose'];
82 var printTiming = firstConf['time']; 82 var printTiming = firstConf['time'];
83 var listTests = firstConf['list']; 83 var listTests = firstConf['list'];
84 84
85 if (!firstConf['append_flaky_log']) { 85 if (!firstConf['append_flaky_log']) {
86 var file = new File(TestUtils.flakyFileName()); 86 var file = new File(TestUtils.flakyFileName());
87 if (file.existsSync()) { 87 if (file.existsSync()) {
88 file.deleteSync(); 88 file.deleteSync();
89 } 89 }
90 } 90 }
91 91
92 // Print the configurations being run by this execution of 92 // Print the configurations being run by this execution of
93 // test.dart. However, don't do it if the silent progress indicator 93 // test.dart. However, don't do it if the silent progress indicator
94 // is used. This is only needed because of the junit tests. 94 // is used. This is only needed because of the junit tests.
95 if (progressIndicator != 'silent') { 95 if (progressIndicator != 'silent') {
96 List output_words = configurations.length > 1 ? 96 List output_words = configurations.length > 1 ?
97 ['Test configurations:'] : ['Test configuration:']; 97 ['Test configurations:'] : ['Test configuration:'];
98 for (Map conf in configurations) { 98 for (Map conf in configurations) {
99 List settings = 99 List settings =
100 ['compiler', 'runtime', 'mode', 'arch'].map((name) => conf[name]); 100 ['compiler', 'runtime', 'mode', 'arch'].map((name) => conf[name]);
101 if (conf['checked']) settings.add('checked'); 101 if (conf['checked']) settings.add('checked');
102 output_words.add(Strings.join(settings, '_')); 102 output_words.add(Strings.join(settings, '_'));
103 } 103 }
104 print(Strings.join(output_words, ' ')); 104 print(Strings.join(output_words, ' '));
105 } 105 }
106 106
107 // Start global http servers that serve the entire dart repo.
108 // The http server is available on window.location.port, and a second server
109 // for cross-domain tests can be found by calling getCrossOriginPortNumber().
110 List serverList = [];
111 if (!listTests) {
112 // Only start the server if we are running browser tests.
113 var runningBrowserTests = configurations.some((config) {
114 return TestUtils.isBrowserRuntime(config['runtime']);
115 });
116 if (runningBrowserTests) {
117 serverList.add(startHttpServer('127.0.0.1'));
118 // We start two servers so that we can test cross-domain tests.
119 serverList.add(startHttpServer('127.0.0.1', serverList[0].port));
120 }
121 }
122
107 var configurationIterator = configurations.iterator(); 123 var configurationIterator = configurations.iterator();
108 void enqueueConfiguration(ProcessQueue queue) { 124 void enqueueConfiguration(ProcessQueue queue) {
109 if (!configurationIterator.hasNext) return; 125 if (!configurationIterator.hasNext) return;
110 126
111 var conf = configurationIterator.next(); 127 var conf = configurationIterator.next();
112 for (String key in selectors.keys) { 128 for (String key in selectors.keys) {
113 if (key == 'co19') { 129 if (key == 'co19') {
114 queue.addTestSuite(new Co19TestSuite(conf)); 130 queue.addTestSuite(new Co19TestSuite(conf));
115 } else if (conf['runtime'] == 'vm' && key == 'vm') { 131 } else if (conf['runtime'] == 'vm' && key == 'vm') {
116 // vm tests contain both cc tests (added here) and dart tests (added in 132 // vm tests contain both cc tests (added here) and dart tests (added in
117 // [TEST_SUITE_DIRECTORIES]). 133 // [TEST_SUITE_DIRECTORIES]).
118 queue.addTestSuite(new VMTestSuite(conf)); 134 queue.addTestSuite(new VMTestSuite(conf));
119 } else if (conf['compiler'] == 'dartc' && key == 'dartc') { 135 } else if (conf['compiler'] == 'dartc' && key == 'dartc') {
120 queue.addTestSuite(new SamplesDartcTestSuite(conf)); 136 queue.addTestSuite(new SamplesDartcTestSuite(conf));
121 queue.addTestSuite(new JUnitDartcTestSuite(conf)); 137 queue.addTestSuite(new JUnitDartcTestSuite(conf));
122 } 138 }
123 } 139 }
124 140
125 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { 141 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) {
126 final name = testSuiteDir.filename; 142 final name = testSuiteDir.filename;
127 if (selectors.containsKey(name)) { 143 if (selectors.containsKey(name)) {
128 queue.addTestSuite( 144 queue.addTestSuite(
129 new StandardTestSuite.forDirectory(conf, testSuiteDir)); 145 new StandardTestSuite.forDirectory(conf, testSuiteDir, serverList));
130 } 146 }
131 } 147 }
132 } 148 }
133 149
134 // Start global http server that serves the entire dart repo.
135 // The http server is available on localhost:9876 for any
136 // test that needs to load resources from the repo over http.
137 if (!listTests) {
138 // Only start the server if we are running browser tests.
139 var runningBrowserTests = configurations.some((config) {
140 return TestUtils.isBrowserRuntime(config['runtime']);
141 });
142 if (runningBrowserTests) startHttpServer('127.0.0.1', 9876);
143 }
144
145 // Start process queue. 150 // Start process queue.
146 new ProcessQueue(maxProcesses, 151 new ProcessQueue(maxProcesses,
147 progressIndicator, 152 progressIndicator,
148 startTime, 153 startTime,
149 printTiming, 154 printTiming,
150 enqueueConfiguration, 155 enqueueConfiguration,
151 () => terminateHttpServer(), 156 () => terminateHttpServers(serverList),
152 verbose, 157 verbose,
153 listTests); 158 listTests);
154 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698