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 /** The default pipeline code for running a test file. */ | 5 /** The default pipeline code for running a test file. */ |
6 library pipeline; | 6 library pipeline; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 import 'dart:math'; | 10 import 'dart:math'; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 // Create the test controller Dart wrapper. | 152 // Create the test controller Dart wrapper. |
153 var directives, extras; | 153 var directives, extras; |
154 | 154 |
155 if (config["layout"]) { | 155 if (config["layout"]) { |
156 directives = ''' | 156 directives = ''' |
157 import 'dart:async'; | 157 import 'dart:async'; |
158 import 'dart:io'; | 158 import 'dart:io'; |
159 import 'dart:math'; | 159 import 'dart:math'; |
160 import 'dart:uri'; | |
161 part '${normalizePath('${config["runnerDir"]}/layout_test_controller.dart')}'; | 160 part '${normalizePath('${config["runnerDir"]}/layout_test_controller.dart')}'; |
162 '''; | 161 '''; |
163 extras = ''' | 162 extras = ''' |
164 baseUrl = 'file://${normalizePath('$tempHtmlFile')}'; | 163 baseUrl = 'file://${normalizePath('$tempHtmlFile')}'; |
165 tprint = (msg) => print('###\$msg'); | 164 tprint = (msg) => print('###\$msg'); |
166 notifyDone = (e) => exit(e); | 165 notifyDone = (e) => exit(e); |
167 '''; | 166 '''; |
168 } else if (config["runtime"] == "vm") { | 167 } else if (config["runtime"] == "vm") { |
169 directives = ''' | 168 directives = ''' |
170 import 'dart:async'; | 169 import 'dart:async'; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 '''); | 233 '''); |
235 | 234 |
236 // Create the child wrapper for layout tests. | 235 // Create the child wrapper for layout tests. |
237 if (config["layout"]) { | 236 if (config["layout"]) { |
238 logMessage('Creating $tempChildDartFile'); | 237 logMessage('Creating $tempChildDartFile'); |
239 writeFile(tempChildDartFile, ''' | 238 writeFile(tempChildDartFile, ''' |
240 library layout_test; | 239 library layout_test; |
241 import 'dart:math'; | 240 import 'dart:math'; |
242 import 'dart:isolate'; | 241 import 'dart:isolate'; |
243 import 'dart:html'; | 242 import 'dart:html'; |
244 import 'dart:uri'; | |
245 import 'package:unittest/unittest.dart' as unittest; | 243 import 'package:unittest/unittest.dart' as unittest; |
246 import '${normalizePath('$testFile')}' as test; | 244 import '${normalizePath('$testFile')}' as test; |
247 part '${normalizePath('${config["runnerDir"]}/layout_test_runner.dart')}'; | 245 part '${normalizePath('${config["runnerDir"]}/layout_test_runner.dart')}'; |
248 | 246 |
249 main() { | 247 main() { |
250 includeFilters = ${config["include"]}; | 248 includeFilters = ${config["include"]}; |
251 excludeFilters = ${config["exclude"]}; | 249 excludeFilters = ${config["exclude"]}; |
252 unittest.testState["port"] = $serverPort; | 250 unittest.testState["port"] = $serverPort; |
253 runTests(test.main); | 251 runTests(test.main); |
254 } | 252 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 cleanup(tempHtmlFile); | 358 cleanup(tempHtmlFile); |
361 cleanup(tempJsFile); | 359 cleanup(tempJsFile); |
362 cleanup(tempChildDartFile); | 360 cleanup(tempChildDartFile); |
363 cleanup(tempChildJsFile); | 361 cleanup(tempChildJsFile); |
364 cleanup(createTempName(tmpDir, "pubspec", "yaml")); | 362 cleanup(createTempName(tmpDir, "pubspec", "yaml")); |
365 cleanup(createTempName(tmpDir, "pubspec", "lock")); | 363 cleanup(createTempName(tmpDir, "pubspec", "lock")); |
366 cleanupDir(createTempName(tmpDir, "packages")); | 364 cleanupDir(createTempName(tmpDir, "packages")); |
367 } | 365 } |
368 completePipeline(stdout, stderr, exitcode); | 366 completePipeline(stdout, stderr, exitcode); |
369 } | 367 } |
OLD | NEW |