Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: mojo/edk/js/tests/interface_ptr_tests.js

Issue 2578333002: Mojo JS bindings: BindingSet support. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/js/tests/binding_tests.js ('k') | mojo/edk/js/tests/js_to_cpp_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/interfaces/bindings/tests/math_calculator.mojom", 9 "mojo/public/interfaces/bindings/tests/math_calculator.mojom",
9 "mojo/public/js/threading", 10 "mojo/public/js/threading",
10 "gc", 11 "gc",
11 ], function(expect, 12 ], function(expect,
12 bindings, 13 bindings,
14 core,
13 math, 15 math,
14 threading, 16 threading,
15 gc) { 17 gc) {
16 testIsBound() 18 testIsBound()
17 .then(testEndToEnd) 19 .then(testEndToEnd)
18 .then(testReusable) 20 .then(testReusable)
19 .then(testConnectionError) 21 .then(testConnectionError)
20 .then(testPassInterface) 22 .then(testPassInterface)
23 .then(testBindRawHandle)
21 .then(function() { 24 .then(function() {
22 this.result = "PASS"; 25 this.result = "PASS";
23 gc.collectGarbage(); // should not crash 26 gc.collectGarbage(); // should not crash
24 threading.quit(); 27 threading.quit();
25 }.bind(this)).catch(function(e) { 28 }.bind(this)).catch(function(e) {
26 this.result = "FAIL: " + (e.stack || e); 29 this.result = "FAIL: " + (e.stack || e);
27 threading.quit(); 30 threading.quit();
28 }.bind(this)); 31 }.bind(this));
29 32
30 function CalculatorImpl() { 33 function CalculatorImpl() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 newCalc.ptr.bind(calc.ptr.passInterface()); 134 newCalc.ptr.bind(calc.ptr.passInterface());
132 expect(calc.ptr.isBound()).toBeFalsy(); 135 expect(calc.ptr.isBound()).toBeFalsy();
133 return newCalc.add(2); 136 return newCalc.add(2);
134 }).then(function(response) { 137 }).then(function(response) {
135 expect(response.value).toBe(4); 138 expect(response.value).toBe(4);
136 return Promise.resolve(); 139 return Promise.resolve();
137 }); 140 });
138 141
139 return promise; 142 return promise;
140 } 143 }
144
145 function testBindRawHandle() {
146 var pipe = core.createMessagePipe();
147 var calc = new math.CalculatorPtr(pipe.handle0);
148 var newCalc = null;
149 var calcBinding = new bindings.Binding(math.Calculator,
150 new CalculatorImpl(),
151 pipe.handle1);
152
153 var promise = calc.add(2).then(function(response) {
154 expect(response.value).toBe(2);
155 return Promise.resolve();
156 });
157
158 return promise;
159 }
141 }); 160 });
OLDNEW
« no previous file with comments | « mojo/edk/js/tests/binding_tests.js ('k') | mojo/edk/js/tests/js_to_cpp_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698