9cf7d6fa93
Bug: https://github.com/dart-lang/sdk/issues/31587 Bug: https://github.com/dart-lang/sdk/issues/31696 Change-Id: I2b37ad97da0520db08f43981fdbc48b094942a0e Reviewed-on: https://dart-review.googlesource.com/34306 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
30 lines
817 B
Dart
30 lines
817 B
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// 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 "dart:isolate";
|
|
import "package:unittest/unittest.dart";
|
|
|
|
Uri toDartDataUri(String source) {
|
|
return Uri.parse("data:application/dart;charset=utf-8,"
|
|
"${Uri.encodeComponent(source)}");
|
|
}
|
|
|
|
main() {
|
|
test('Simple response', () {
|
|
String source = """
|
|
import "dart:isolate";
|
|
main(List args, SendPort replyPort) {
|
|
replyPort.send(42);
|
|
}
|
|
""";
|
|
|
|
RawReceivePort receivePort;
|
|
receivePort = new RawReceivePort(expectAsync((message) {
|
|
expect(message, equals(42));
|
|
receivePort.close();
|
|
}));
|
|
Isolate.spawnUri(toDartDataUri(source), [], receivePort.sendPort);
|
|
});
|
|
}
|