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

Side by Side Diff: tests/standalone/io/file_output_stream_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
« no previous file with comments | « tests/standalone/io/file_non_ascii_test.dart ('k') | tests/standalone/io/file_stat_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) 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 // Testing file input stream, VM-only, standalone test. 4 // Testing file input stream, VM-only, standalone test.
5 5
6 import "dart:io";
7
8 import "package:async_helper/async_helper.dart";
6 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
7 import "dart:io";
8 import "dart:isolate";
9 10
10 void testOpenOutputStreamSync() { 11 void testOpenOutputStreamSync() {
11 Directory tempDirectory = new Directory('').createTempSync(); 12 Directory tempDirectory = new Directory('').createTempSync();
12 13
13 // Create a port for waiting on the final result of this test. 14 asyncStart();
14 ReceivePort done = new ReceivePort();
15 done.receive((message, replyTo) {
16 tempDirectory.deleteSync();
17 done.close();
18 });
19
20 String fileName = "${tempDirectory.path}/test"; 15 String fileName = "${tempDirectory.path}/test";
21 File file = new File(fileName); 16 File file = new File(fileName);
22 file.createSync(); 17 file.createSync();
23 IOSink x = file.openWrite(); 18 IOSink x = file.openWrite();
24 var data = [65, 66, 67]; 19 var data = [65, 66, 67];
25 x.add(data); 20 x.add(data);
26 x.close(); 21 x.close();
27 x.done.then((_) { 22 x.done.then((_) {
28 Expect.listEquals(file.readAsBytesSync(), data); 23 Expect.listEquals(file.readAsBytesSync(), data);
29 file.deleteSync(); 24 file.deleteSync();
30 done.toSendPort().send("done"); 25 tempDirectory.deleteSync();
26 asyncEnd();
31 }); 27 });
32 } 28 }
33 29
34 30
35 main() { 31 main() {
36 testOpenOutputStreamSync(); 32 testOpenOutputStreamSync();
37 } 33 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_non_ascii_test.dart ('k') | tests/standalone/io/file_stat_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698