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

Unified Diff: mojo/edk/js/tests/sample_service_tests.js

Issue 2549683002: Mojo JS bindings: introduce concepts that are more similar to C++ bindings: (Closed)
Patch Set: put interface control methods in the |ptr| property 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/js/tests/interface_ptr_tests.js ('k') | mojo/public/js/bindings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/js/tests/sample_service_tests.js
diff --git a/mojo/edk/js/tests/sample_service_tests.js b/mojo/edk/js/tests/sample_service_tests.js
index 2b065a8e834c0c95b7416381a0d6a9e7a9a685f7..71aa48cfe764faaa66fda1a5d9ab1580baf6b0f7 100644
--- a/mojo/edk/js/tests/sample_service_tests.js
+++ b/mojo/edk/js/tests/sample_service_tests.js
@@ -7,11 +7,10 @@ define([
"mojo/public/interfaces/bindings/tests/sample_service.mojom",
"mojo/public/interfaces/bindings/tests/sample_import.mojom",
"mojo/public/interfaces/bindings/tests/sample_import2.mojom",
- "mojo/public/js/connection",
+ "mojo/public/js/bindings",
"mojo/public/js/core",
"mojo/public/js/threading",
- ], function(expect, sample, imported, imported2, connection, core,
- threading) {
+ ], function(expect, sample, imported, imported2, bindings, core, threading) {
testDefaultValues()
.then(testSampleService)
.then(function() {
@@ -71,26 +70,23 @@ define([
function ServiceImpl() {
}
- ServiceImpl.prototype = Object.create(sample.Service.stubClass.prototype);
-
ServiceImpl.prototype.frobinate = function(foo, baz, port) {
checkFoo(foo);
expect(baz).toBe(sample.Service.BazOptions.EXTRA);
- expect(core.isHandle(port)).toBeTruthy();
+ bindings.ProxyBindings(port).close();
return Promise.resolve({result: 1234});
};
var foo = makeFoo();
checkFoo(foo);
- var sampleServicePipe = core.createMessagePipe();
- var connection0 = new connection.Connection(sampleServicePipe.handle0,
- ServiceImpl);
- var connection1 = new connection.Connection(
- sampleServicePipe.handle1, undefined, sample.Service.proxyClass);
+ var service = new sample.ServicePtr();
+ var request = bindings.makeRequest(service);
+ var serviceBinding = new bindings.Binding(
+ sample.Service, new ServiceImpl(), request);
var pipe = core.createMessagePipe();
- var promise = connection1.remote.frobinate(
+ var promise = service.frobinate(
foo, sample.Service.BazOptions.EXTRA, pipe.handle0)
.then(function(response) {
expect(response.result).toBe(1234);
« no previous file with comments | « mojo/edk/js/tests/interface_ptr_tests.js ('k') | mojo/public/js/bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698