| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 import 'dart:isolate'; | 171 import 'dart:isolate'; |
| 172 import 'package:unittest/unittest.dart'; | 172 import 'package:unittest/unittest.dart'; |
| 173 import '${normalizePath('${config["testfile"]}')}' as test; | 173 import '${normalizePath('${config["testfile"]}')}' as test; |
| 174 part '${normalizePath('${config["runnerDir"]}/standard_test_runner.dart')}'; | 174 part '${normalizePath('${config["runnerDir"]}/standard_test_runner.dart')}'; |
| 175 '''; | 175 '''; |
| 176 extras = ''' | 176 extras = ''' |
| 177 includeFilters = ${config["include"]}; | 177 includeFilters = ${config["include"]}; |
| 178 excludeFilters = ${config["exclude"]}; | 178 excludeFilters = ${config["exclude"]}; |
| 179 tprint = (msg) => print('###\$msg'); | 179 tprint = (msg) => print('###\$msg'); |
| 180 notifyDone = (e) { exit(e); }; | 180 notifyDone = (e) { exit(e); }; |
| 181 testState["port"] = $serverPort; | |
| 182 '''; | 181 '''; |
| 183 } else { | 182 } else { |
| 184 directives = ''' | 183 directives = ''' |
| 185 import 'dart:async'; | 184 import 'dart:async'; |
| 186 import 'dart:html'; | 185 import 'dart:html'; |
| 187 import 'dart:isolate'; | 186 import 'dart:isolate'; |
| 188 import 'package:unittest/unittest.dart'; | 187 import 'package:unittest/unittest.dart'; |
| 189 import '${normalizePath('${config["testfile"]}')}' as test; | 188 import '${normalizePath('${config["testfile"]}')}' as test; |
| 190 part '${normalizePath('${config["runnerDir"]}/standard_test_runner.dart')}'; | 189 part '${normalizePath('${config["runnerDir"]}/standard_test_runner.dart')}'; |
| 191 '''; | 190 '''; |
| 192 extras = ''' | 191 extras = ''' |
| 193 includeFilters = ${config["include"]}; | 192 includeFilters = ${config["include"]}; |
| 194 excludeFilters = ${config["exclude"]}; | 193 excludeFilters = ${config["exclude"]}; |
| 195 tprint = (msg) => query('#console').appendText('###\$msg\\n'); | 194 tprint = (msg) => query('#console').appendText('###\$msg\\n'); |
| 196 notifyDone = (e) => window.postMessage('done', '*'); | 195 notifyDone = (e) => window.postMessage('done', '*'); |
| 197 testState["port"] = $serverPort; | |
| 198 '''; | 196 '''; |
| 199 } | 197 } |
| 200 | 198 |
| 201 var action = 'process(test.main, runTests)'; | 199 var action = 'process(test.main, runTests)'; |
| 202 if (config["layout-text"]) { | 200 if (config["layout-text"]) { |
| 203 action = 'runTextLayoutTests()'; | 201 action = 'runTextLayoutTests()'; |
| 204 } else if (config["layout-pixel"]) { | 202 } else if (config["layout-pixel"]) { |
| 205 action = 'runPixelLayoutTests()'; | 203 action = 'runPixelLayoutTests()'; |
| 206 } else if (config["list-tests"]) { | 204 } else if (config["list-tests"]) { |
| 207 action = 'process(test.main, listTests)'; | 205 action = 'process(test.main, listTests)'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 import 'dart:math'; | 238 import 'dart:math'; |
| 241 import 'dart:isolate'; | 239 import 'dart:isolate'; |
| 242 import 'dart:html'; | 240 import 'dart:html'; |
| 243 import 'package:unittest/unittest.dart' as unittest; | 241 import 'package:unittest/unittest.dart' as unittest; |
| 244 import '${normalizePath('$testFile')}' as test; | 242 import '${normalizePath('$testFile')}' as test; |
| 245 part '${normalizePath('${config["runnerDir"]}/layout_test_runner.dart')}'; | 243 part '${normalizePath('${config["runnerDir"]}/layout_test_runner.dart')}'; |
| 246 | 244 |
| 247 main() { | 245 main() { |
| 248 includeFilters = ${config["include"]}; | 246 includeFilters = ${config["include"]}; |
| 249 excludeFilters = ${config["exclude"]}; | 247 excludeFilters = ${config["exclude"]}; |
| 250 unittest.testState["port"] = $serverPort; | |
| 251 runTests(test.main); | 248 runTests(test.main); |
| 252 } | 249 } |
| 253 '''); | 250 '''); |
| 254 } | 251 } |
| 255 | 252 |
| 256 // Create the HTML wrapper and compile to Javascript if necessary. | 253 // Create the HTML wrapper and compile to Javascript if necessary. |
| 257 var isJavascript = config["runtime"] == 'drt-js'; | 254 var isJavascript = config["runtime"] == 'drt-js'; |
| 258 if (config["runtime"] == 'drt-dart' || isJavascript) { | 255 if (config["runtime"] == 'drt-dart' || isJavascript) { |
| 259 var bodyElements, runAsText; | 256 var bodyElements, runAsText; |
| 260 | 257 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 cleanup(tempHtmlFile); | 355 cleanup(tempHtmlFile); |
| 359 cleanup(tempJsFile); | 356 cleanup(tempJsFile); |
| 360 cleanup(tempChildDartFile); | 357 cleanup(tempChildDartFile); |
| 361 cleanup(tempChildJsFile); | 358 cleanup(tempChildJsFile); |
| 362 cleanup(createTempName(tmpDir, "pubspec", "yaml")); | 359 cleanup(createTempName(tmpDir, "pubspec", "yaml")); |
| 363 cleanup(createTempName(tmpDir, "pubspec", "lock")); | 360 cleanup(createTempName(tmpDir, "pubspec", "lock")); |
| 364 cleanupDir(createTempName(tmpDir, "packages")); | 361 cleanupDir(createTempName(tmpDir, "packages")); |
| 365 } | 362 } |
| 366 completePipeline(stdout, stderr, exitcode); | 363 completePipeline(stdout, stderr, exitcode); |
| 367 } | 364 } |
| OLD | NEW |