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

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: 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
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..07c00e3c32a42a5fe8977d96710155fe38db3ba2 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 servicePtr = new sample.ServicePtr();
+ var request = bindings.makeRequest(servicePtr);
+ var serviceBinding = new bindings.Binding(
+ sample.Service, new ServiceImpl(), request);
var pipe = core.createMessagePipe();
- var promise = connection1.remote.frobinate(
+ var promise = servicePtr.frobinate(
foo, sample.Service.BazOptions.EXTRA, pipe.handle0)
.then(function(response) {
expect(response.result).toBe(1234);

Powered by Google App Engine
This is Rietveld 408576698