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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); | 128 expect(defaults.a23).toBe(0xFFFFFFFFFFFFFFFF); |
129 expect(defaults.a24).toBe(0x123456789); | 129 expect(defaults.a24).toBe(0x123456789); |
130 expect(defaults.a25).toBe(-0x123456789); | 130 expect(defaults.a25).toBe(-0x123456789); |
131 } | 131 } |
132 | 132 |
133 function ServiceImpl() { | 133 function ServiceImpl() { |
134 } | 134 } |
135 | 135 |
136 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); | 136 ServiceImpl.prototype = Object.create(sample.Service.stubClass.prototype); |
137 | 137 |
138 ServiceImpl.prototype.frobinate = function(foo, baz, port) { | 138 ServiceImpl.prototype.frobinate = function(foo, baz, port) { |
139 checkFoo(foo); | 139 checkFoo(foo); |
140 expect(baz).toBe(sample.ServiceStub.BazOptions.EXTRA); | 140 expect(baz).toBe(sample.Service.BazOptions.EXTRA); |
141 expect(port).toBe(10); | 141 expect(port).toBe(10); |
142 global.result = "PASS"; | 142 global.result = "PASS"; |
143 }; | 143 }; |
144 | 144 |
145 function SimpleMessageReceiver() { | 145 function SimpleMessageReceiver() { |
146 } | 146 } |
147 | 147 |
148 SimpleMessageReceiver.prototype.accept = function(message) { | 148 SimpleMessageReceiver.prototype.accept = function(message) { |
149 if (dumpMessageAsHex) { | 149 if (dumpMessageAsHex) { |
150 var uint8Array = new Uint8Array(message.buffer.arrayBuffer); | 150 var uint8Array = new Uint8Array(message.buffer.arrayBuffer); |
151 console.log(hexdump.dumpArray(uint8Array)); | 151 console.log(hexdump.dumpArray(uint8Array)); |
152 } | 152 } |
153 // Imagine some IPC happened here. | 153 // Imagine some IPC happened here. |
154 var serviceImpl = new ServiceImpl(); | 154 var serviceImpl = new ServiceImpl(); |
155 serviceImpl.accept(message); | 155 serviceImpl.accept(message); |
156 }; | 156 }; |
157 | 157 |
158 var receiver = new SimpleMessageReceiver(); | 158 var receiver = new SimpleMessageReceiver(); |
159 var serviceProxy = new sample.ServiceProxy(receiver); | 159 var serviceProxy = new sample.Service.proxyClass(receiver); |
160 | 160 |
161 checkDefaultValues(); | 161 checkDefaultValues(); |
162 | 162 |
163 var foo = makeFoo(); | 163 var foo = makeFoo(); |
164 checkFoo(foo); | 164 checkFoo(foo); |
165 | 165 |
166 var port = 10; | 166 var port = 10; |
167 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.EXTRA, port); | 167 serviceProxy.frobinate(foo, sample.Service.BazOptions.EXTRA, port); |
168 }); | 168 }); |
OLD | NEW |