OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 define([ | 5 define([ |
6 "gin/test/expect", | 6 "gin/test/expect", |
7 "mojo/public/interfaces/bindings/tests/rect.mojom", | 7 "mojo/public/interfaces/bindings/tests/rect.mojom", |
8 "mojo/public/interfaces/bindings/tests/test_structs.mojom", | 8 "mojo/public/interfaces/bindings/tests/test_structs.mojom", |
9 "mojo/public/js/codec", | 9 "mojo/public/js/codec", |
10 "mojo/public/js/validator", | 10 "mojo/public/js/validator", |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 expect(decodedStruct.f3).toEqual(testStructs.FloatNumberValues.V3); | 182 expect(decodedStruct.f3).toEqual(testStructs.FloatNumberValues.V3); |
183 expect(decodedStruct.f4).toEqual(testStructs.FloatNumberValues.V4); | 183 expect(decodedStruct.f4).toEqual(testStructs.FloatNumberValues.V4); |
184 expect(decodedStruct.f5).toEqual(testStructs.FloatNumberValues.V5); | 184 expect(decodedStruct.f5).toEqual(testStructs.FloatNumberValues.V5); |
185 expect(decodedStruct.f6).toEqual(testStructs.FloatNumberValues.V6); | 185 expect(decodedStruct.f6).toEqual(testStructs.FloatNumberValues.V6); |
186 expect(decodedStruct.f7).toEqual(testStructs.FloatNumberValues.V7); | 186 expect(decodedStruct.f7).toEqual(testStructs.FloatNumberValues.V7); |
187 expect(decodedStruct.f8).toEqual(testStructs.FloatNumberValues.V8); | 187 expect(decodedStruct.f8).toEqual(testStructs.FloatNumberValues.V8); |
188 expect(decodedStruct.f9).toEqual(testStructs.FloatNumberValues.V9); | 188 expect(decodedStruct.f9).toEqual(testStructs.FloatNumberValues.V9); |
189 } | 189 } |
190 | 190 |
191 function testIntegerNumberValues() { | 191 function testIntegerNumberValues() { |
192 var minInt32 = -2147483648; // See crbug.com/445618 | 192 var decodedStruct = structEncodeDecode(new testStructs.IntegerNumberValues); |
193 var decodedStruct = structEncodeDecode( | |
194 new testStructs.IntegerNumberValues({f10: minInt32})); | |
195 expect(decodedStruct.f0).toEqual(testStructs.IntegerNumberValues.V0); | 193 expect(decodedStruct.f0).toEqual(testStructs.IntegerNumberValues.V0); |
196 expect(decodedStruct.f1).toEqual(testStructs.IntegerNumberValues.V1); | 194 expect(decodedStruct.f1).toEqual(testStructs.IntegerNumberValues.V1); |
197 expect(decodedStruct.f2).toEqual(testStructs.IntegerNumberValues.V2); | 195 expect(decodedStruct.f2).toEqual(testStructs.IntegerNumberValues.V2); |
198 expect(decodedStruct.f3).toEqual(testStructs.IntegerNumberValues.V3); | 196 expect(decodedStruct.f3).toEqual(testStructs.IntegerNumberValues.V3); |
199 expect(decodedStruct.f4).toEqual(testStructs.IntegerNumberValues.V4); | 197 expect(decodedStruct.f4).toEqual(testStructs.IntegerNumberValues.V4); |
200 expect(decodedStruct.f5).toEqual(testStructs.IntegerNumberValues.V5); | 198 expect(decodedStruct.f5).toEqual(testStructs.IntegerNumberValues.V5); |
201 expect(decodedStruct.f6).toEqual(testStructs.IntegerNumberValues.V6); | 199 expect(decodedStruct.f6).toEqual(testStructs.IntegerNumberValues.V6); |
202 expect(decodedStruct.f7).toEqual(testStructs.IntegerNumberValues.V7); | 200 expect(decodedStruct.f7).toEqual(testStructs.IntegerNumberValues.V7); |
203 expect(decodedStruct.f8).toEqual(testStructs.IntegerNumberValues.V8); | 201 expect(decodedStruct.f8).toEqual(testStructs.IntegerNumberValues.V8); |
204 expect(decodedStruct.f9).toEqual(testStructs.IntegerNumberValues.V9); | 202 expect(decodedStruct.f9).toEqual(testStructs.IntegerNumberValues.V9); |
205 expect(decodedStruct.f10).toEqual(minInt32); | 203 expect(decodedStruct.f10).toEqual(testStructs.IntegerNumberValues.V10); |
206 expect(decodedStruct.f11).toEqual(testStructs.IntegerNumberValues.V11); | 204 expect(decodedStruct.f11).toEqual(testStructs.IntegerNumberValues.V11); |
207 expect(decodedStruct.f12).toEqual(testStructs.IntegerNumberValues.V12); | 205 expect(decodedStruct.f12).toEqual(testStructs.IntegerNumberValues.V12); |
208 expect(decodedStruct.f13).toEqual(testStructs.IntegerNumberValues.V13); | 206 expect(decodedStruct.f13).toEqual(testStructs.IntegerNumberValues.V13); |
209 expect(decodedStruct.f14).toEqual(testStructs.IntegerNumberValues.V14); | 207 expect(decodedStruct.f14).toEqual(testStructs.IntegerNumberValues.V14); |
210 expect(decodedStruct.f15).toEqual(testStructs.IntegerNumberValues.V15); | 208 expect(decodedStruct.f15).toEqual(testStructs.IntegerNumberValues.V15); |
211 expect(decodedStruct.f16).toEqual(testStructs.IntegerNumberValues.V16); | 209 expect(decodedStruct.f16).toEqual(testStructs.IntegerNumberValues.V16); |
212 expect(decodedStruct.f17).toEqual(testStructs.IntegerNumberValues.V17); | 210 expect(decodedStruct.f17).toEqual(testStructs.IntegerNumberValues.V17); |
213 expect(decodedStruct.f18).toEqual(testStructs.IntegerNumberValues.V18); | 211 expect(decodedStruct.f18).toEqual(testStructs.IntegerNumberValues.V18); |
214 expect(decodedStruct.f19).toEqual(testStructs.IntegerNumberValues.V19); | 212 expect(decodedStruct.f19).toEqual(testStructs.IntegerNumberValues.V19); |
215 } | 213 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 testDefaultFieldValues(); | 262 testDefaultFieldValues(); |
265 testScopedConstants(); | 263 testScopedConstants(); |
266 testMapKeyTypes(); | 264 testMapKeyTypes(); |
267 testMapValueTypes(); | 265 testMapValueTypes(); |
268 testFloatNumberValues(); | 266 testFloatNumberValues(); |
269 testIntegerNumberValues(); | 267 testIntegerNumberValues(); |
270 testUnsignedNumberValues(); | 268 testUnsignedNumberValues(); |
271 testBitArrayValues(); | 269 testBitArrayValues(); |
272 this.result = "PASS"; | 270 this.result = "PASS"; |
273 }); | 271 }); |
OLD | NEW |