Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: tests/html/worker_api_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/isolates_test.dart ('k') | tests/isolate/browser/compute_this_script_browser_stream_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/worker_api_test.dart
diff --git a/tests/html/worker_api_test.dart b/tests/html/worker_api_test.dart
index 947c9188a9ee90857cdf28d03e34cba9c707ada7..e1ab1a4d8af9afb7d0da6a795ec66c103f166073 100644
--- a/tests/html/worker_api_test.dart
+++ b/tests/html/worker_api_test.dart
@@ -8,24 +8,25 @@ import 'dart:isolate';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
-worker() {
- port.receive((String uri, SendPort replyTo) {
- try {
- var url = Url.createObjectUrl(new Blob([''], 'application/javascript'));
- Url.revokeObjectUrl(url);
- replyTo.send('Hello from Worker');
- } catch (e) {
- replyTo.send('Error: $e');
- }
- port.close();
- });
+worker(message) {
+ var uri = message[0];
+ var replyTo = message[1];
+ try {
+ var url = Url.createObjectUrl(new Blob([''], 'application/javascript'));
+ Url.revokeObjectUrl(url);
+ replyTo.send('Hello from Worker');
+ } catch (e) {
+ replyTo.send('Error: $e');
+ }
}
main() {
useHtmlConfiguration();
test('Use Worker API in Worker', () {
- spawnFunction(worker).call('').then(
- expectAsync1((reply) => expect(reply, equals('Hello from Worker'))));
+ var response = new ReceivePort();
+ var remote = Isolate.spawn(worker, ['', response.sendPort]);
+ remote.then((_) => response.first)
+ .then(expectAsync1((reply) => expect(reply, equals('Hello from Worker'))));
});
}
« no previous file with comments | « tests/html/isolates_test.dart ('k') | tests/isolate/browser/compute_this_script_browser_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698