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

Unified Diff: tests/isolate/message_stream2_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/isolate/message2_test.dart ('k') | tests/isolate/message_stream_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/message_stream2_test.dart
diff --git a/tests/isolate/message_stream2_test.dart b/tests/isolate/message_stream2_test.dart
deleted file mode 100644
index c9a6a6702c240987883651f4a7847625f0398764..0000000000000000000000000000000000000000
--- a/tests/isolate/message_stream2_test.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012, 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.
-
-// Dart test program for testing serialization of messages.
-// VMOptions=--enable_type_checks --enable_asserts
-
-library Message2Test;
-import 'dart:isolate';
-import '../../pkg/unittest/lib/unittest.dart';
-
-// ---------------------------------------------------------------------------
-// Message passing test 2.
-// ---------------------------------------------------------------------------
-
-class MessageTest {
- static void mapEqualsDeep(Map expected, Map actual) {
- expect(expected, isMap);
- expect(actual, isMap);
- expect(actual.length, expected.length);
- testForEachMap(key, value) {
- if (value is List) {
- listEqualsDeep(value, actual[key]);
- } else {
- expect(actual[key], value);
- }
- }
- expected.forEach(testForEachMap);
- }
-
- static void listEqualsDeep(List expected, List actual) {
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] is List) {
- listEqualsDeep(expected[i], actual[i]);
- } else if (expected[i] is Map) {
- mapEqualsDeep(expected[i], actual[i]);
- } else {
- expect(actual[i], expected[i]);
- }
- }
- }
-}
-
-void pingPong() {
- bool isFirst = true;
- IsolateSink replyTo;
- stream.listen((var message) {
- if (isFirst) {
- isFirst = false;
- replyTo = message;
- return;
- }
- // Bounce the received object back so that the sender
- // can make sure that the object matches.
- replyTo.add(message);
- });
-}
-
-main() {
- test("map is equal after it is sent back and forth", () {
- IsolateSink remote = streamSpawnFunction(pingPong);
- Map m = new Map();
- m[1] = "eins";
- m[2] = "deux";
- m[3] = "tre";
- m[4] = "four";
- MessageBox box = new MessageBox();
- remote.add(box.sink);
- remote.add(m);
- box.stream.listen(expectAsync1((var received) {
- MessageTest.mapEqualsDeep(m, received);
- remote.close();
- box.stream.close();
- }));
- });
-}
« no previous file with comments | « tests/isolate/message2_test.dart ('k') | tests/isolate/message_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698