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

Unified Diff: mojo/public/js/bindings/connection.js

Issue 551293004: Mojo JS validation unit test should check Connection et al (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed GN build Created 6 years, 3 months 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/mojo_public_tests.gypi ('k') | mojo/public/js/bindings/connector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/bindings/connection.js
diff --git a/mojo/public/js/bindings/connection.js b/mojo/public/js/bindings/connection.js
index 03bb76811ec0bd9bcf8a8f891e339cf1ae4ce4b1..31cf2aa28a12a6b90a1d6802fbd798fc1637a820 100644
--- a/mojo/public/js/bindings/connection.js
+++ b/mojo/public/js/bindings/connection.js
@@ -3,11 +3,15 @@
// found in the LICENSE file.
define("mojo/public/js/bindings/connection", [
+ "mojo/public/js/bindings/connector",
"mojo/public/js/bindings/router",
-], function(router) {
+], function(connector, router) {
- function Connection(handle, localFactory, remoteFactory) {
- this.router_ = new router.Router(handle);
+ function Connection(
+ handle, localFactory, remoteFactory, routerFactory, connectorFactory) {
+ if (routerFactory === undefined)
+ routerFactory = router.Router;
+ this.router_ = new routerFactory(handle, connectorFactory);
this.remote = new remoteFactory(this.router_);
this.local = new localFactory(this.remote);
this.router_.setIncomingReceiver(this.local);
@@ -33,7 +37,21 @@ define("mojo/public/js/bindings/connection", [
return this.router_.encounteredError();
};
+ // The TestConnection subclass is only intended to be used in unit tests.
+
+ function TestConnection(handle, localFactory, remoteFactory) {
+ Connection.call(this,
+ handle,
+ localFactory,
+ remoteFactory,
+ router.TestRouter,
+ connector.TestConnector);
+ }
+
+ TestConnection.prototype = Object.create(Connection.prototype);
+
var exports = {};
exports.Connection = Connection;
+ exports.TestConnection = TestConnection;
return exports;
});
« no previous file with comments | « mojo/mojo_public_tests.gypi ('k') | mojo/public/js/bindings/connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698