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

Unified Diff: tests/html/typed_arrays_2_test.dart

Issue 12929005: dart:typeddata for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert status change Created 7 years, 9 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
Index: tests/html/typed_arrays_2_test.dart
diff --git a/tests/html/typed_arrays_2_test.dart b/tests/html/typed_arrays_2_test.dart
index 021de8cbe8f176e37d31139a5ef97a06127a2b7b..68adaf718868255e03b58bfbea708622d0a5f596 100644
--- a/tests/html/typed_arrays_2_test.dart
+++ b/tests/html/typed_arrays_2_test.dart
@@ -5,24 +5,23 @@
library TypedArrays2Test;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
-import 'dart:html';
-
+import 'dart:typeddata';
main() {
useHtmlConfiguration();
- // Only perform tests if ArrayBuffer is supported.
- if (!ArrayBuffer.supported) {
+ // Only perform tests if ByteBuffer is supported.
+ if (!ByteBuffer.supported) {
Anton Muhin 2013/03/19 12:31:24 we need to add that into the typeddata which shoul
blois 2013/03/19 17:26:11 I also just noticed that Uint8ClampedArray is not
return;
}
test('fromBufferTest_dynamic', () {
- var a1 = new Uint8Array(1024);
+ var a1 = new Uint8List(1024);
for (int i = 0; i < a1.length; i++) {
a1[i] = i; // 0,1,2,...,254,255,0,1,2,...
}
- var a2 = new Uint32Array.fromBuffer(a1.buffer);
+ var a2 = new Uint32List.fromBuffer(a1.buffer);
expect(1024 ~/ 4, a2.length);
expect(a2[0], 0x03020100);
expect(a2[1], 0x07060504);
@@ -31,20 +30,20 @@ main() {
expect(a2[51], 0xCFCECDCC);
expect(a2[64], 0x03020100);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 200);
expect(a2.length, (1024 - 200) ~/ 4);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);
expect(a2[14], 0x03020100);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 456, 20);
expect(a2.length, 20);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);
expect(a2[14], 0x03020100);
- // OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
+ // OPTIONALS a2 = new Uint32List.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 456, 30);
expect(a2.length, 30);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);
@@ -52,32 +51,32 @@ main() {
});
test('fromBufferTest_typed', () {
- Uint8Array a1 = new Uint8Array(1024);
+ Uint8List a1 = new Uint8List(1024);
for (int i = 0; i < a1.length; i++) {
a1[i] = i;
}
- Uint32Array a2 = new Uint32Array.fromBuffer(a1.buffer);
+ Uint32List a2 = new Uint32List.fromBuffer(a1.buffer);
expect(a2.length, 1024 ~/ 4);
expect(a2[0], 0x03020100);
expect(a2[50], 0xCBCAC9C8);
expect(a2[51], 0xCFCECDCC);
expect(a2[64], 0x03020100);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 200);
expect(a2.length, (1024 - 200) ~/ 4);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);
expect(a2[14], 0x03020100);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 456, 20);
expect(20, a2.length);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);
expect(a2[14], 0x03020100);
- // OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
- a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
+ // OPTIONALS a2 = new Uint32List.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
+ a2 = new Uint32List.fromBuffer(a1.buffer, 456, 30);
expect(a2.length, 30);
expect(a2[0], 0xCBCAC9C8);
expect(a2[1], 0xCFCECDCC);

Powered by Google App Engine
This is Rietveld 408576698