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

Unified Diff: tests/standalone/io/file_typed_data_test.dart

Issue 14065006: Add support for typed data views on native threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review commetns Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/dart_api_message.cc ('K') | « runtime/vm/snapshot_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_typed_data_test.dart
diff --git a/tests/standalone/io/file_typed_data_test.dart b/tests/standalone/io/file_typed_data_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..027c191aad21af20b3ee9632c545a81857bce2b7
--- /dev/null
+++ b/tests/standalone/io/file_typed_data_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Dart test program for testing file I/O.
+
+import "package:expect/expect.dart";
+import 'dart:async';
+import 'dart:io';
+import 'dart:isolate';
+import 'dart:typeddata';
+
+void testWriteUint8ListAndView() {
+ ReceivePort port = new ReceivePort();
+ Uint8List list = new Uint8List(8);
+ for (int i = 0; i < 8; i++) list[i] = i;
+ var view = new Uint8List.view(list.buffer, 2, 4);
+
+ new Directory('').createTemp().then((temp) {
+ var file = new File("${temp.path}/test");
+ file.open(mode: FileMode.WRITE).then((raf) {
+ return raf.writeList(list, 0, 8);
+ }).then((raf) {
+ return raf.writeList(view, 0, 4);
+ }).then((raf) {
+ return raf.close();
+ }).then((_) {
+ var expected = [];
+ expected.addAll(list);
+ expected.addAll(view);
+ var content = file.readAsBytesSync();
+ Expect.listEquals(expected, content);
+ temp.deleteSync(recursive: true);
+ port.close();
+ });
+ });
+}
+
+
+main() {
+ testWriteUint8ListAndView();
+}
« runtime/vm/dart_api_message.cc ('K') | « runtime/vm/snapshot_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698