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

Unified Diff: runtime/tests/vm/dart/hello_fuchsia_test.dart

Issue 2591523002: Fuchsia: Adds File::Copy() (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/file_fuchsia.cc ('K') | « runtime/bin/file_fuchsia.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/tests/vm/dart/hello_fuchsia_test.dart
diff --git a/runtime/tests/vm/dart/hello_fuchsia_test.dart b/runtime/tests/vm/dart/hello_fuchsia_test.dart
index ce9cd7da7fe07ea3b22ca17885b71472a80364d1..1acd69796306cd658fcae5adb8b5d0ab3b7258c8 100644
--- a/runtime/tests/vm/dart/hello_fuchsia_test.dart
+++ b/runtime/tests/vm/dart/hello_fuchsia_test.dart
@@ -403,6 +403,25 @@ void testPlatformEnvironment() {
}
}
+Future testCopy() async {
+ final String sourceName = "foo";
+ final String destName = "bar";
+ Directory tmp = await Directory.systemTemp.createTemp("testCopy");
+ File sourceFile = new File("${tmp.path}/$sourceName");
+ File destFile = new File("${tmp.path}/$destName");
+ List<int> data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
siva 2016/12/20 00:04:22 I think we should make this data bigger (potential
zra 2016/12/20 17:43:58 Changed to 10KB.
+ await sourceFile.writeAsBytes(data);
+ await sourceFile.copy(destFile.path);
+ List<int> resultData = await destFile.readAsBytes();
+ assert(data.length == resultData.length);
+ for (int i = 0; i < data.length; i++) {
+ assert(data[i] == resultData[i]);
+ }
+ await sourceFile.delete();
+ await destFile.delete();
+ await tmp.delete();
+}
+
main() async {
print("Hello, Fuchsia!");
@@ -446,5 +465,9 @@ main() async {
await testProcess();
print("testProcess done");
+ print("testCopy");
+ await testCopy();
+ print("testCopy done");
+
print("Goodbyte, Fuchsia!");
}
« runtime/bin/file_fuchsia.cc ('K') | « runtime/bin/file_fuchsia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698