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

Side by Side Diff: tests/isolate/mint_maker_test.dart

Issue 70103014: Make isolate tests work on drt (and hopefully dartium). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Retain isolate_stress_test in status file Created 7 years 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
« no previous file with comments | « tests/isolate/message_test.dart ('k') | tests/isolate/nested_spawn2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library MintMakerTest; 5 library MintMakerTest;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import '../../pkg/unittest/lib/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import "remote_unittest_helper.dart";
9 10
10 class Mint { 11 class Mint {
11 Map<SendPort, Purse> _registry; 12 Map<SendPort, Purse> _registry;
12 SendPort port; 13 SendPort port;
13 14
14 Mint() : _registry = new Map<SendPort, Purse>() { 15 Mint() : _registry = new Map<SendPort, Purse>() {
15 ReceivePort mintPort = new ReceivePort(); 16 ReceivePort mintPort = new ReceivePort();
16 port = mintPort.sendPort; 17 port = mintPort.sendPort;
17 serveMint(mintPort); 18 serveMint(mintPort);
18 } 19 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 _port.send(reply.sendPort); 148 _port.send(reply.sendPort);
148 } 149 }
149 } 150 }
150 151
151 _checkBalance(PurseWrapper wrapper, expected) { 152 _checkBalance(PurseWrapper wrapper, expected) {
152 wrapper.queryBalance(expectAsync1((int balance) { 153 wrapper.queryBalance(expectAsync1((int balance) {
153 expect(balance, equals(expected)); 154 expect(balance, equals(expected));
154 })); 155 }));
155 } 156 }
156 157
157 main() { 158 void main([args, port]) {
159 if (testRemote(main, port)) return;
158 test("creating purse, deposit, and query balance", () { 160 test("creating purse, deposit, and query balance", () {
159 MintMakerWrapper.create().then(expectAsync1((mintMaker) { 161 MintMakerWrapper.create().then(expectAsync1((mintMaker) {
160 mintMaker.makeMint(expectAsync1((MintWrapper mint) { 162 mintMaker.makeMint(expectAsync1((MintWrapper mint) {
161 mint.createPurse(100, expectAsync1((PurseWrapper purse) { 163 mint.createPurse(100, expectAsync1((PurseWrapper purse) {
162 _checkBalance(purse, 100); 164 _checkBalance(purse, 100);
163 purse.sproutPurse(expectAsync1((PurseWrapper sprouted) { 165 purse.sproutPurse(expectAsync1((PurseWrapper sprouted) {
164 _checkBalance(sprouted, 0); 166 _checkBalance(sprouted, 0);
165 _checkBalance(purse, 100); 167 _checkBalance(purse, 100);
166 168
167 sprouted.deposit(purse, 5); 169 sprouted.deposit(purse, 5);
168 _checkBalance(sprouted, 0 + 5); 170 _checkBalance(sprouted, 0 + 5);
169 _checkBalance(purse, 100 - 5); 171 _checkBalance(purse, 100 - 5);
170 172
171 sprouted.deposit(purse, 42); 173 sprouted.deposit(purse, 42);
172 _checkBalance(sprouted, 0 + 5 + 42); 174 _checkBalance(sprouted, 0 + 5 + 42);
173 _checkBalance(purse, 100 - 5 - 42); 175 _checkBalance(purse, 100 - 5 - 42);
174 })); 176 }));
175 })); 177 }));
176 })); 178 }));
177 })); 179 }));
178 }); 180 });
179 } 181 }
OLDNEW
« no previous file with comments | « tests/isolate/message_test.dart ('k') | tests/isolate/nested_spawn2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698