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

Unified Diff: mojo/public/js/connector.js

Issue 1511783002: Mojo JS bindings: fix the unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/mojo_edk_tests.gyp ('k') | mojo/public/js/core_unittests.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/connector.js
diff --git a/mojo/public/js/connector.js b/mojo/public/js/connector.js
index 78ed96366d3b491e38de5c46e18297e3d1c795ef..e672b54e5ff34c1caa72e014a8eb19d70fd0da9d 100644
--- a/mojo/public/js/connector.js
+++ b/mojo/public/js/connector.js
@@ -110,8 +110,8 @@ define("mojo/public/js/connector", [
};
// The TestConnector subclass is only intended to be used in unit tests. It
- // enables delivering a message to the pipe's handle without an async wait.
-
+ // doesn't automatically listen for input messages. Instead, you need to
+ // call waitForNextMessage to block and wait for the next incoming message.
function TestConnector(handle) {
Connector.call(this, handle);
}
@@ -119,10 +119,12 @@ define("mojo/public/js/connector", [
TestConnector.prototype = Object.create(Connector.prototype);
TestConnector.prototype.waitToReadMore_ = function() {
- };
+ }
- TestConnector.prototype.deliverMessage = function() {
- this.readMore_(core.RESULT_OK);
+ TestConnector.prototype.waitForNextMessage = function() {
+ var wait = core.wait(this.handle_, core.HANDLE_SIGNAL_READABLE,
+ core.DEADLINE_INDEFINITE);
+ this.readMore_(wait.result);
}
var exports = {};
« no previous file with comments | « mojo/mojo_edk_tests.gyp ('k') | mojo/public/js/core_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698