Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/js/bindings", | 7 "mojo/public/js/bindings", |
| 8 "mojo/public/js/core", | 8 "mojo/public/js/core", |
| 9 "mojo/public/interfaces/bindings/tests/math_calculator.mojom", | 9 "mojo/public/interfaces/bindings/tests/math_calculator.mojom", |
| 10 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", | |
| 10 "mojo/public/js/threading", | 11 "mojo/public/js/threading", |
| 11 "gc", | 12 "gc", |
| 12 ], function(expect, | 13 ], function(expect, |
| 13 bindings, | 14 bindings, |
| 14 core, | 15 core, |
| 15 math, | 16 math, |
| 17 sampleInterfaces, | |
| 16 threading, | 18 threading, |
| 17 gc) { | 19 gc) { |
| 18 testIsBound() | 20 testIsBound() |
| 19 .then(testEndToEnd) | 21 .then(testEndToEnd) |
| 20 .then(testReusable) | 22 .then(testReusable) |
| 21 .then(testConnectionError) | 23 .then(testConnectionError) |
| 22 .then(testPassInterface) | 24 .then(testPassInterface) |
| 23 .then(testBindRawHandle) | 25 .then(testBindRawHandle) |
| 26 .then(testQueryVersion) | |
| 24 .then(function() { | 27 .then(function() { |
| 25 this.result = "PASS"; | 28 this.result = "PASS"; |
| 26 gc.collectGarbage(); // should not crash | 29 gc.collectGarbage(); // should not crash |
| 27 threading.quit(); | 30 threading.quit(); |
| 28 }.bind(this)).catch(function(e) { | 31 }.bind(this)).catch(function(e) { |
| 29 this.result = "FAIL: " + (e.stack || e); | 32 this.result = "FAIL: " + (e.stack || e); |
| 30 threading.quit(); | 33 threading.quit(); |
| 31 }.bind(this)); | 34 }.bind(this)); |
| 32 | 35 |
| 33 function CalculatorImpl() { | 36 function CalculatorImpl() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 new CalculatorImpl(), | 153 new CalculatorImpl(), |
| 151 pipe.handle1); | 154 pipe.handle1); |
| 152 | 155 |
| 153 var promise = calc.add(2).then(function(response) { | 156 var promise = calc.add(2).then(function(response) { |
| 154 expect(response.value).toBe(2); | 157 expect(response.value).toBe(2); |
| 155 return Promise.resolve(); | 158 return Promise.resolve(); |
| 156 }); | 159 }); |
| 157 | 160 |
| 158 return promise; | 161 return promise; |
| 159 } | 162 } |
| 163 | |
| 164 function testQueryVersion() { | |
| 165 var integerAccessorImpl = new sampleInterfaces.IntegerAccessorPtr(); | |
|
yzshen1
2017/02/06 06:57:26
This is not an "implementation". An implementation
yzshen1
2017/02/06 07:04:18
Sorry, I meant to say "You should use the Binding
| |
| 166 var request = bindings.makeRequest(integerAccessorImpl); | |
|
yzshen1
2017/02/06 06:57:26
The problem is that you need to provide support fo
| |
| 167 expect(integerAccessorImpl.ptr.version).toBe(0); | |
| 168 | |
| 169 return integerAccessorImpl.ptr.queryVersion().then(function(version) { | |
| 170 expect(version).toBe(3); | |
| 171 expect(integerAccessorImpl.ptr.version).toBe(3); | |
| 172 }); | |
| 173 } | |
| 160 }); | 174 }); |
| 175 | |
| OLD | NEW |