OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 define([ |
| 6 "gin/test/expect", |
| 7 "mojo/public/interfaces/bindings/tests/rect.mojom", |
| 8 "mojo/public/interfaces/bindings/tests/test_structs.mojom" |
| 9 ], function(expect, |
| 10 rect, |
| 11 testStructs) { |
| 12 |
| 13 function testConstructors() { |
| 14 var r = new rect.Rect(); |
| 15 expect(r).toEqual(new rect.Rect({x:0, y:0, width:0, height:0})); |
| 16 expect(r).toEqual(new rect.Rect({foo:100, bar:200})); |
| 17 |
| 18 r.x = 10; |
| 19 r.y = 20; |
| 20 r.width = 30; |
| 21 r.height = 40; |
| 22 var rp = new testStructs.RectPair({first: r, second: r}); |
| 23 expect(rp.first).toEqual(r); |
| 24 expect(rp.second).toEqual(r); |
| 25 |
| 26 expect(new testStructs.RectPair({second: r}).first).toBeNull(); |
| 27 |
| 28 var nr = new testStructs.NamedRegion(); |
| 29 // TODO(hansmuller): nr.name should be null, see crbug.com/417039. |
| 30 expect(nr.name).toBe(""); |
| 31 expect(nr.rects).toBeNull(); |
| 32 expect(nr).toEqual(new testStructs.NamedRegion({})); |
| 33 |
| 34 nr.name = "foo"; |
| 35 nr.rects = [r, r, r]; |
| 36 expect(nr).toEqual(new testStructs.NamedRegion({ |
| 37 name: "foo", |
| 38 rects: [r, r, r], |
| 39 })); |
| 40 |
| 41 var e = new testStructs.EmptyStruct(); |
| 42 expect(e).toEqual(new testStructs.EmptyStruct({foo:123})); |
| 43 } |
| 44 |
| 45 testConstructors(); |
| 46 this.result = "PASS"; |
| 47 }); |
OLD | NEW |