Index: mojo/public/js/struct_unittests.js |
diff --git a/mojo/public/js/struct_unittests.js b/mojo/public/js/struct_unittests.js |
index c72f8eb4e0547d81757290837e6d2ef86002b6d5..5ed93ea2d1ef69528e7e1a83a31b3988c28d175d 100644 |
--- a/mojo/public/js/struct_unittests.js |
+++ b/mojo/public/js/struct_unittests.js |
@@ -158,9 +158,9 @@ define([ |
// map<string, Rect?> |
f6: new Map([["a", null]]), |
// map<string, map<string, string>> |
- // f7: new Map([["a", new Map([["b", "c"]])]]), |
+ f7: new Map([["a", new Map([["b", "c"]])]]), |
// map<string, array<map<string, string>>> |
- // f8: new Map([["a", [new Map([["b", "c"]])]]]), |
+ f8: new Map([["a", [new Map([["b", "c"]])]]]), |
}); |
var decodedStruct = structEncodeDecode(mapFieldsStruct); |
expect(decodedStruct.f0).toEqual(mapFieldsStruct.f0); |
@@ -170,8 +170,49 @@ define([ |
expect(decodedStruct.f4).toEqual(mapFieldsStruct.f4); |
expect(decodedStruct.f5).toEqual(mapFieldsStruct.f5); |
expect(decodedStruct.f6).toEqual(mapFieldsStruct.f6); |
- // expect(decodedStruct.f7).toEqual(mapFieldsStruct.f7); |
- // expect(decodedStruct.f8).toEqual(mapFieldsStruct.f8); |
+ expect(decodedStruct.f7).toEqual(mapFieldsStruct.f7); |
+ expect(decodedStruct.f8).toEqual(mapFieldsStruct.f8); |
+ } |
+ |
+ function testFloatNumberValues() { |
+ var decodedStruct = structEncodeDecode(new testStructs.FloatNumberValues); |
+ expect(decodedStruct.f0).toEqual(testStructs.FloatNumberValues.V0); |
+ expect(decodedStruct.f1).toEqual(testStructs.FloatNumberValues.V1); |
+ expect(decodedStruct.f2).toEqual(testStructs.FloatNumberValues.V2); |
+ expect(decodedStruct.f3).toEqual(testStructs.FloatNumberValues.V3); |
+ expect(decodedStruct.f4).toEqual(testStructs.FloatNumberValues.V4); |
+ expect(decodedStruct.f5).toEqual(testStructs.FloatNumberValues.V5); |
+ expect(decodedStruct.f6).toEqual(testStructs.FloatNumberValues.V6); |
+ expect(decodedStruct.f7).toEqual(testStructs.FloatNumberValues.V7); |
+ expect(decodedStruct.f8).toEqual(testStructs.FloatNumberValues.V8); |
+ expect(decodedStruct.f9).toEqual(testStructs.FloatNumberValues.V9); |
+ } |
+ |
+ function testBitArrayValues() { |
+ var bitArraysStruct = new testStructs.BitArrayValues({ |
+ // array<bool, 1> f0; |
+ f0: [true], |
+ // array<bool, 7> f1; |
+ f1: [true, false, true, false, true, false, true], |
+ // array<bool, 9> f2; |
+ f2: [true, false, true, false, true, false, true, false, true], |
+ // array<bool> f3; |
+ f3: [true, false, true, false, true, false, true, false], |
+ // array<array<bool>> f4; |
+ f4: [[true], [false], [true, false], [true, false, true, false]], |
+ // array<array<bool>?> f5; |
+ f5: [[true], null, null, [true, false, true, false]], |
+ // array<array<bool, 2>?> f6; |
+ f6: [[true, false], [true, false], [true, false]], |
+ }); |
+ var decodedStruct = structEncodeDecode(bitArraysStruct); |
+ expect(decodedStruct.f0).toEqual(bitArraysStruct.f0); |
+ expect(decodedStruct.f1).toEqual(bitArraysStruct.f1); |
+ expect(decodedStruct.f2).toEqual(bitArraysStruct.f2); |
+ expect(decodedStruct.f3).toEqual(bitArraysStruct.f3); |
+ expect(decodedStruct.f4).toEqual(bitArraysStruct.f4); |
+ expect(decodedStruct.f5).toEqual(bitArraysStruct.f5); |
+ expect(decodedStruct.f6).toEqual(bitArraysStruct.f6); |
} |
testConstructors(); |
@@ -180,5 +221,7 @@ define([ |
testScopedConstants(); |
testMapKeyTypes(); |
testMapValueTypes(); |
+ testFloatNumberValues(); |
+ testBitArrayValues(); |
this.result = "PASS"; |
}); |