summaryrefslogtreecommitdiffstats
path: root/gin/test
diff options
context:
space:
mode:
authorhansmuller <hansmuller@chromium.org>2014-10-16 15:21:26 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-16 22:21:38 +0000
commitd1fd54c8da40c9e7c1e7821259c39af947529f77 (patch)
treee30c78f2fbd1c11562e8a5b656c0c3d89ae380d1 /gin/test
parentd8ee1714ece7a563f981813381610fd37c37444e (diff)
downloadchromium_src-d1fd54c8da40c9e7c1e7821259c39af947529f77.zip
chromium_src-d1fd54c8da40c9e7c1e7821259c39af947529f77.tar.gz
chromium_src-d1fd54c8da40c9e7c1e7821259c39af947529f77.tar.bz2
Mojo JS Bindings: add support for associative arrays (Mojo map type)
Currently there's only a limited test for the new type. More complete testing to come in a followup patch. BUG=423017 Review URL: https://codereview.chromium.org/654843005 Cr-Commit-Position: refs/heads/master@{#299992}
Diffstat (limited to 'gin/test')
-rw-r--r--gin/test/expect.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/gin/test/expect.js b/gin/test/expect.js
index b5e0f21..597b5b1 100644
--- a/gin/test/expect.js
+++ b/gin/test/expect.js
@@ -82,7 +82,7 @@ define(function() {
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
- // Recursively compare objects and arrays.
+ // Recursively compare Maps, objects and arrays.
if (className == '[object Array]' || isArrayBufferClass(className)) {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
@@ -94,6 +94,16 @@ define(function() {
break;
}
}
+ } else if (className == '[object Map]') {
+ result = a.size == b.size;
+ if (result) {
+ var entries = a.entries();
+ for (var e = entries.next(); result && !e.done; e = entries.next()) {
+ var key = e.value[0];
+ var value = e.value[1];
+ result = b.has(key) && eq(value, b.get(key), aStack, bStack);
+ }
+ }
} else {
// Deep compare objects.
for (var key in a) {