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

Side by Side Diff: runtime/tests/vm/dart/hello_fuchsia_test.dart

Issue 2591523002: Fuchsia: Adds File::Copy() (Closed)
Patch Set: Address comments Created 3 years, 12 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
« no previous file with comments | « runtime/bin/file_fuchsia.cc ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 "dart:async"; 5 import "dart:async";
6 import "dart:convert"; 6 import "dart:convert";
7 import "dart:io"; 7 import "dart:io";
8 8
9 testAddressParse() async { 9 testAddressParse() async {
10 print(new InternetAddress("1.0.2.3").rawAddress); 10 print(new InternetAddress("1.0.2.3").rawAddress);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 405 }
406 406
407 void testPlatformEnvironment() { 407 void testPlatformEnvironment() {
408 Map<String, String> env = Platform.environment; 408 Map<String, String> env = Platform.environment;
409 for (String k in env.keys) { 409 for (String k in env.keys) {
410 String v = env[k]; 410 String v = env[k];
411 print("$k = '$v'"); 411 print("$k = '$v'");
412 } 412 }
413 } 413 }
414 414
415 Future testCopy() async {
416 final String sourceName = "foo";
417 final String destName = "bar";
418 Directory tmp = await Directory.systemTemp.createTemp("testCopy");
419 File sourceFile = new File("${tmp.path}/$sourceName");
420 File destFile = new File("${tmp.path}/$destName");
421 List<int> data = new List<int>.generate(10 * 1024, (int i) => i & 0xff);
422 await sourceFile.writeAsBytes(data);
423 await sourceFile.copy(destFile.path);
424 List<int> resultData = await destFile.readAsBytes();
425 assert(data.length == resultData.length);
426 for (int i = 0; i < data.length; i++) {
427 assert(data[i] == resultData[i]);
428 }
429 await sourceFile.delete();
430 await destFile.delete();
431 await tmp.delete();
432 }
433
415 main() async { 434 main() async {
416 print("Hello, Fuchsia!"); 435 print("Hello, Fuchsia!");
417 436
418 print("testAddressParse"); 437 print("testAddressParse");
419 await testAddressParse(); 438 await testAddressParse();
420 print("testAddressParse done"); 439 print("testAddressParse done");
421 440
422 print("testSimpleBind"); 441 print("testSimpleBind");
423 await testSimpleBind(); 442 await testSimpleBind();
424 print("testSimpleBind done"); 443 print("testSimpleBind done");
(...skipping 27 matching lines...) Expand all
452 print("testPlatformEnvironment done"); 471 print("testPlatformEnvironment done");
453 472
454 print("testProcess"); 473 print("testProcess");
455 await testProcess(); 474 await testProcess();
456 print("testProcess done"); 475 print("testProcess done");
457 476
458 print("testProcessRunSync"); 477 print("testProcessRunSync");
459 testProcessRunSync(); 478 testProcessRunSync();
460 print("testProcessRunSync done"); 479 print("testProcessRunSync done");
461 480
481 print("testCopy");
482 await testCopy();
483 print("testCopy done");
484
462 print("Goodbyte, Fuchsia!"); 485 print("Goodbyte, Fuchsia!");
463 } 486 }
OLDNEW
« no previous file with comments | « runtime/bin/file_fuchsia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698