Index: LayoutTests/dart/spawn-uri.html |
diff --git a/LayoutTests/dart/spawn-uri.html b/LayoutTests/dart/spawn-uri.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..83b562f176642fde052ab2f9b8470ea7a40ef33c |
--- /dev/null |
+++ b/LayoutTests/dart/spawn-uri.html |
@@ -0,0 +1,49 @@ |
+<html> |
+<body> |
+ |
+<script> |
+if (window.testRunner) { |
+ window.testRunner.dumpAsText(); |
+ window.testRunner.waitUntilDone(); |
+ window.addEventListener('message', function (e) { |
+ window.testRunner.notifyDone(); |
+ }); |
+} |
+</script> |
+ |
+<div id="dart"> |
+main(msg, replyTo) { |
+ print("Hello World"); |
+ replyTo.send("done"); |
+} |
+</div> |
+ |
+<script type="application/dart"> |
+import 'dart:html'; |
+import 'dart:isolate'; |
+import 'dart:js'; |
+ |
+void main() { |
+ var code = querySelector('#dart'); |
+ var dataUri = 'data:application/dart;base64,${window.btoa(code.text)}'; |
+ // TODO(17738): Expand this test to validate parameters are passed and |
+ // the correct future is returned. |
+ var port = new ReceivePort(); |
+ try { |
+ var isolate = Isolate.spawnUri(Uri.parse(dataUri), [], port.sendPort); |
+ port.listen(_notifyDone); |
+ isolate.catchError((x) { print("Isolate error $x"); _notifyDone();}); |
+ } catch (e) { |
+ print("Spawn failed: $e"); |
+ _notifyDone(); |
+ } |
+ code.remove(); |
+} |
+ |
+_notifyDone([_]) { |
+ window.postMessage('test-done', '*'); |
+} |
+</script> |
+ |
+</body> |
+</html> |