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

Side by Side Diff: tests/isolate/src/SerializationTest.dart

Issue 9422019: isolates refactor: this change introduces 'dart:isolate' as a library. This is a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart test program for testing serialization of messages without spawning 5 // Dart test program for testing serialization of messages without spawning
6 // isolates. 6 // isolates.
7 7
8 // --------------------------------------------------------------------------- 8 // ---------------------------------------------------------------------------
9 // Serialization test. 9 // Serialization test.
10 // --------------------------------------------------------------------------- 10 // ---------------------------------------------------------------------------
11 #library('SerializationTest'); 11 #library('SerializationTest');
12 #import("dart:coreimpl"); 12 #import("dart:isolate");
13 #import("../../../lib/isolate/frog/messages.dart");
13 14
14 main() { 15 main() {
15 testAllTypes(copy); 16 testAllTypes(_copy);
16 testAllTypes(serialize); 17 testAllTypes(_serialize);
17 } 18 }
18 19
19 copy(x) { 20 _copy(x) {
20 return new Copier().traverse(x); 21 return new Copier().traverse(x);
21 } 22 }
22 23
23 serialize(x) { 24 _serialize(x) {
24 Serializer serializer = new Serializer(); 25 Serializer serializer = new Serializer();
25 Deserializer deserializer = new Deserializer(); 26 Deserializer deserializer = new Deserializer();
26 return deserializer.deserialize(serializer.traverse(x)); 27 return deserializer.deserialize(serializer.traverse(x));
27 } 28 }
28 29
29 void testAllTypes(Function f) { 30 void testAllTypes(Function f) {
30 copyAndVerify(0, f); 31 copyAndVerify(0, f);
31 copyAndVerify(499, f); 32 copyAndVerify(499, f);
32 copyAndVerify(true, f); 33 copyAndVerify(true, f);
33 copyAndVerify(false, f); 34 copyAndVerify(false, f);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Expect.isTrue(copy is Map); 84 Expect.isTrue(copy is Map);
84 Expect.equals(o.length, copy.length); 85 Expect.equals(o.length, copy.length);
85 o.forEach((key, value) { 86 o.forEach((key, value) {
86 Expect.isTrue(copy.containsKey(key)); 87 Expect.isTrue(copy.containsKey(key));
87 verify(value, copy[key]); 88 verify(value, copy[key]);
88 }); 89 });
89 } else { 90 } else {
90 Expect.fail("Unexpected object encountered"); 91 Expect.fail("Unexpected object encountered");
91 } 92 }
92 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698