OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "console", | 6 "console", |
7 "mojo/apps/js/test/hexdump", | 7 "mojo/apps/js/test/hexdump", |
8 "gin/test/expect", | 8 "gin/test/expect", |
9 "mojo/public/interfaces/bindings/tests/sample_service.mojom", | 9 "mojo/public/interfaces/bindings/tests/sample_service.mojom", |
10 "mojo/public/interfaces/bindings/tests/sample_import.mojom", | 10 "mojo/public/interfaces/bindings/tests/sample_import.mojom", |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 expect(foo.a).toBeTruthy(); | 98 expect(foo.a).toBeTruthy(); |
99 expect(foo.data).toBeNull(); | 99 expect(foo.data).toBeNull(); |
100 | 100 |
101 var defaults = new sample.DefaultsTest(); | 101 var defaults = new sample.DefaultsTest(); |
102 expect(defaults.a0).toBe(-12); | 102 expect(defaults.a0).toBe(-12); |
103 expect(defaults.a1).toBe(sample.kTwelve); | 103 expect(defaults.a1).toBe(sample.kTwelve); |
104 expect(defaults.a2).toBe(1234); | 104 expect(defaults.a2).toBe(1234); |
105 expect(defaults.a3).toBe(34567); | 105 expect(defaults.a3).toBe(34567); |
106 expect(defaults.a4).toBe(123456); | 106 expect(defaults.a4).toBe(123456); |
107 expect(defaults.a5).toBe(3456789012); | 107 expect(defaults.a5).toBe(3456789012); |
108 expect(defaults.a6).toBe(111111111111); | 108 expect(defaults.a6).toBe(-111111111111); |
109 // JS doesn't have a 64 bit integer type so this is just checking that the | 109 // JS doesn't have a 64 bit integer type so this is just checking that the |
110 // expected and actual values have the same closest double value. | 110 // expected and actual values have the same closest double value. |
111 expect(defaults.a7).toBe(9999999999999999999); | 111 expect(defaults.a7).toBe(9999999999999999999); |
112 expect(defaults.a8).toBe(0x12345); | 112 expect(defaults.a8).toBe(0x12345); |
113 expect(defaults.a9).toBe(-0x12345); | 113 expect(defaults.a9).toBe(-0x12345); |
114 expect(defaults.a10).toBe(1234); | 114 expect(defaults.a10).toBe(1234); |
115 expect(defaults.a11).toBe(true); | 115 expect(defaults.a11).toBe(true); |
116 expect(defaults.a12).toBe(false); | 116 expect(defaults.a12).toBe(false); |
117 expect(defaults.a13).toBe(123.25); | 117 expect(defaults.a13).toBe(123.25); |
118 expect(defaults.a14).toBe(1234567890.123); | 118 expect(defaults.a14).toBe(1234567890.123); |
119 expect(defaults.a15).toBe(1E10); | 119 expect(defaults.a15).toBe(1E10); |
120 expect(defaults.a16).toBe(-1.2E+20); | 120 expect(defaults.a16).toBe(-1.2E+20); |
121 expect(defaults.a17).toBe(1.23E-20); | 121 expect(defaults.a17).toBe(1.23E-20); |
122 expect(defaults.a20).toBe(sample.Bar.Type.BOTH); | 122 expect(defaults.a20).toBe(sample.Bar.Type.BOTH); |
123 expect(defaults.a21).toBeNull(); | 123 expect(defaults.a21).toBeNull(); |
124 expect(defaults.a22).toBeTruthy(); | 124 expect(defaults.a22).toBeTruthy(); |
125 expect(defaults.a22.shape).toBe(imported.Shape.RECTANGLE); | 125 expect(defaults.a22.shape).toBe(imported.Shape.RECTANGLE); |
126 expect(defaults.a22.color).toBe(imported2.Color.BLACK); | 126 expect(defaults.a22.color).toBe(imported2.Color.BLACK); |
127 expect(defaults.a21).toBeNull(); | 127 expect(defaults.a21).toBeNull(); |
| 128 expect(defaults.a23).toBe(0xFFFFFFFFFFFFFFFF); |
| 129 expect(defaults.a24).toBe(0x123456789); |
| 130 expect(defaults.a25).toBe(-0x123456789); |
128 } | 131 } |
129 | 132 |
130 function ServiceImpl() { | 133 function ServiceImpl() { |
131 } | 134 } |
132 | 135 |
133 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); | 136 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); |
134 | 137 |
135 ServiceImpl.prototype.frobinate = function(foo, baz, port) { | 138 ServiceImpl.prototype.frobinate = function(foo, baz, port) { |
136 checkFoo(foo); | 139 checkFoo(foo); |
137 expect(baz).toBe(sample.ServiceStub.BazOptions.EXTRA); | 140 expect(baz).toBe(sample.ServiceStub.BazOptions.EXTRA); |
(...skipping 18 matching lines...) Expand all Loading... |
156 var serviceProxy = new sample.ServiceProxy(receiver); | 159 var serviceProxy = new sample.ServiceProxy(receiver); |
157 | 160 |
158 checkDefaultValues(); | 161 checkDefaultValues(); |
159 | 162 |
160 var foo = makeFoo(); | 163 var foo = makeFoo(); |
161 checkFoo(foo); | 164 checkFoo(foo); |
162 | 165 |
163 var port = 10; | 166 var port = 10; |
164 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.EXTRA, port); | 167 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.EXTRA, port); |
165 }); | 168 }); |
OLD | NEW |