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

Side by Side Diff: tests/standalone/io/file_write_as_test.dart

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart";
6 import 'dart:async'; 5 import 'dart:async';
7 import 'dart:io'; 6 import 'dart:io';
8 import 'dart:isolate'; 7
8 import "package:async_helper/async_helper.dart";
9 import "package:expect/expect.dart";
9 10
10 testWriteAsBytesSync(dir) { 11 testWriteAsBytesSync(dir) {
11 var f = new File('${dir.path}/bytes_sync.txt'); 12 var f = new File('${dir.path}/bytes_sync.txt');
12 var data = [50,50,50]; 13 var data = [50,50,50];
13 f.writeAsBytesSync(data); 14 f.writeAsBytesSync(data);
14 Expect.listEquals(data, f.readAsBytesSync()); 15 Expect.listEquals(data, f.readAsBytesSync());
15 f.writeAsBytesSync(data, mode: FileMode.APPEND); 16 f.writeAsBytesSync(data, mode: FileMode.APPEND);
16 var expected = [50, 50, 50, 50, 50, 50]; 17 var expected = [50, 50, 50, 50, 50, 50];
17 Expect.listEquals(expected, f.readAsBytesSync()); 18 Expect.listEquals(expected, f.readAsBytesSync());
18 } 19 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 Expect.equals('$data$data', str); 62 Expect.equals('$data$data', str);
62 completer.complete(true); 63 completer.complete(true);
63 }); 64 });
64 }); 65 });
65 }); 66 });
66 }); 67 });
67 return completer.future; 68 return completer.future;
68 } 69 }
69 70
70 main() { 71 main() {
71 var port = new ReceivePort(); 72 asyncStart();
72 var tempDir = new Directory('').createTempSync(); 73 var tempDir = new Directory('').createTempSync();
73 testWriteAsBytesSync(tempDir); 74 testWriteAsBytesSync(tempDir);
74 testWriteAsStringSync(tempDir); 75 testWriteAsStringSync(tempDir);
75 testWriteAsBytes(tempDir).then((_) { 76 testWriteAsBytes(tempDir).then((_) {
76 return testWriteAsString(tempDir); 77 return testWriteAsString(tempDir);
77 }).then((_) { 78 }).then((_) {
78 tempDir.deleteSync(recursive: true); 79 tempDir.deleteSync(recursive: true);
79 port.close(); 80 asyncEnd();
80 }); 81 });
81 } 82 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_typed_data_test.dart ('k') | tests/standalone/io/http_client_connect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698