Index: tools/testing/dart/browser_test.dart |
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart |
index 862375d87227a878bfbe1774b83823cd1a9b6ab5..b58a1ba1faa1b4e1aa80155bab980d46d3c0d579 100644 |
--- a/tools/testing/dart/browser_test.dart |
+++ b/tools/testing/dart/browser_test.dart |
@@ -2,6 +2,8 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+import 'utils.dart'; |
+ |
String getHtmlContents(String title, String scriptType, String scriptPath) { |
return """ |
<!DOCTYPE html> |
@@ -38,7 +40,13 @@ String getHtmlContents(String title, String scriptType, String scriptPath) { |
/// The [testName] is the short name of the test without any subdirectory path |
/// or extension, like "math_test". The [testJSDir] is the relative path to the |
/// build directory where the dartdevc-generated JS file is stored. |
-String dartdevcHtml(String testName, String testJSDir) => """ |
+String dartdevcHtml(String testName, String testJSDir, String buildDir) { |
+ var packagePaths = testPackages |
+ .map((package) => ' "$package": "/root_dart/$buildDir/gen/utils/' |
+ 'dartdevc/pkg/$package",') |
+ .join("\n"); |
+ |
+ return """ |
<!DOCTYPE html> |
<html> |
<head> |
@@ -60,10 +68,9 @@ String dartdevcHtml(String testName, String testJSDir) => """ |
<script> |
var require = { |
baseUrl: "/root_dart/$testJSDir", |
- // TODO(29923): Add paths to the packages that are used in tests once they |
- // are being built. Right now, they are compiled into the test module itself. |
paths: { |
"dart_sdk": "/root_dart/pkg/dev_compiler/lib/js/amd/dart_sdk", |
+$packagePaths |
} |
}; |
@@ -75,8 +82,17 @@ window.ddcSettings = { |
<script type="text/javascript" |
src="/root_dart/third_party/requirejs/require.js"></script> |
<script type="text/javascript"> |
-requirejs(["$testName", "dart_sdk"], |
- function($testName, dart_sdk) { |
+requirejs(["$testName", "dart_sdk", "async_helper"], |
+ function($testName, dart_sdk, async_helper) { |
+ function finish() { |
+ // dev_compiler's test runner (language_test.js) uses this to notify the |
+ // test results, but it isn't needed for test.dart. |
+ } |
+ |
+ // TODO(rnystrom): This uses DDC's forked version of async_helper. Unfork |
+ // these packages when possible. |
+ async_helper.async_helper.asyncTestInitialize(finish); |
+ |
dart_sdk._isolate_helper.startRootIsolate(function() {}, []); |
dartMainRunner($testName.$testName.main); |
}); |
@@ -84,6 +100,7 @@ requirejs(["$testName", "dart_sdk"], |
</body> |
</html> |
"""; |
+} |
String dartTestWrapper(String libraryPathComponent) { |
return """ |