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

Unified Diff: tests/html/typed_arrays_dataview_test.dart

Issue 14367012: Move to new dart:typeddata types for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert generated files for html lib 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
Index: tests/html/typed_arrays_dataview_test.dart
diff --git a/tests/html/typed_arrays_dataview_test.dart b/tests/html/typed_arrays_dataview_test.dart
index 798b732e10d620b864ee37e5d316184ba7553459..fb50a488bf88b06391f55fc3244b437572b86e34 100644
--- a/tests/html/typed_arrays_dataview_test.dart
+++ b/tests/html/typed_arrays_dataview_test.dart
@@ -6,6 +6,7 @@ library typed_arrays_dataview_test;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
+import 'dart:typeddata';
main() {
useHtmlConfiguration();
@@ -16,9 +17,9 @@ main() {
}
test('access8', () {
- var a1 = new Uint8Array.fromList([0,0,3,255,0,0,0,0,0,0]);
+ var a1 = new Uint8List.fromList([0,0,3,255,0,0,0,0,0,0]);
- var dv = new DataView(a1.buffer, 2, 6);
+ var dv = new ByteData.view(a1.buffer, 2, 6);
expect(dv.getInt8(0), equals(3));
expect(dv.getInt8(1), equals(-1));
@@ -35,19 +36,19 @@ main() {
});
test('access16', () {
- var a1 = new Uint8Array.fromList([0,0,3,255,0,0,0,0,0,0]);
+ var a1 = new Uint8List.fromList([0,0,3,255,0,0,0,0,0,0]);
- var dv = new DataView(a1.buffer, 2);
+ var dv = new ByteData.view(a1.buffer, 2);
- expect(dv.byteLength, equals(10 - 2));
+ expect(dv.lengthInBytes, equals(10 - 2));
expect(dv.getInt16(0), equals(1023));
- expect(dv.getInt16(0, littleEndian: false), equals(1023));
- expect(dv.getInt16(0, littleEndian: true), equals(-253));
+ expect(dv.getInt16(0, Endianness.BIG_ENDIAN), equals(1023));
+ expect(dv.getInt16(0, Endianness.LITTLE_ENDIAN), equals(-253));
expect(dv.getUint16(0), equals(1023));
- expect(dv.getUint16(0, littleEndian: false), equals(1023));
- expect(dv.getUint16(0, littleEndian: true), equals(0xFF03));
+ expect(dv.getUint16(0, Endianness.BIG_ENDIAN), equals(1023));
+ expect(dv.getUint16(0, Endianness.LITTLE_ENDIAN), equals(0xFF03));
dv.setInt16(2, -1);
expect(dv.getInt16(2), equals(-1));
@@ -55,17 +56,17 @@ main() {
});
test('access32', () {
- var a1 = new Uint8Array.fromList([0,0,3,255,0,0,0,0,0,0]);
+ var a1 = new Uint8List.fromList([0,0,3,255,0,0,0,0,0,0]);
- var dv = new DataView(a1.buffer);
+ var dv = new ByteData.view(a1.buffer);
expect(dv.getInt32(0), equals(1023));
- expect(dv.getInt32(0, littleEndian: false), equals(1023));
- expect(dv.getInt32(0, littleEndian: true), equals(-0xFD0000));
+ expect(dv.getInt32(0, Endianness.BIG_ENDIAN), equals(1023));
+ expect(dv.getInt32(0, Endianness.LITTLE_ENDIAN), equals(-0xFD0000));
expect(dv.getUint32(0), equals(1023));
- expect(dv.getUint32(0, littleEndian: false), equals(1023));
- expect(dv.getUint32(0, littleEndian: true), equals(0xFF030000));
+ expect(dv.getUint32(0, Endianness.BIG_ENDIAN), equals(1023));
+ expect(dv.getUint32(0, Endianness.LITTLE_ENDIAN), equals(0xFF030000));
});
}

Powered by Google App Engine
This is Rietveld 408576698