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

Unified Diff: tests/html/utils.dart

Issue 12670003: Add special treatement for typed arrays... (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « tests/html/postmessage_structured_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/utils.dart
diff --git a/tests/html/utils.dart b/tests/html/utils.dart
index f1689cd7aaf4337032d0b5f70db59e7ea28af85b..3257661e93ae9f514045b9bd150ecfe06901f54c 100644
--- a/tests/html/utils.dart
+++ b/tests/html/utils.dart
@@ -1,5 +1,7 @@
library TestUtils;
+
import 'dart:async';
+import 'dart:html';
import '../../pkg/unittest/lib/unittest.dart';
/**
@@ -38,6 +40,27 @@ verifyGraph(expected, actual) {
eItems.add(expected);
aItems.add(actual);
+ if (expected is ArrayBuffer) {
+ expect(actual is ArrayBuffer, isTrue,
+ reason: '$actual is ArrayBuffer');
+ expect(expected.byteLength, equals(actual.byteLength),
+ reason: message(path, '.byteLength'));
+ // TODO(antonm): one can create a view on top of those
+ // and check if contents identical. Let's do it later.
+ return;
+ }
+
+ if (expected is ArrayBufferView) {
+ expect(actual is ArrayBufferView, isTrue,
+ reason: '$actual is ArrayBufferView');
+ walk('$path/.buffer', expected.buffer, actual.buffer);
+ expect(expected.byteOffset, equals(actual.byteOffset),
+ reason: message(path, '.byteOffset'));
+ expect(expected.byteLength, equals(actual.byteLength),
+ reason: message(path, '.byteLength'));
+ // And also fallback to elements check below.
+ }
+
if (expected is List) {
expect(actual, isList, reason: message(path, '$actual is List'));
expect(actual.length, expected.length,
« no previous file with comments | « tests/html/postmessage_structured_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698