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

Unified Diff: remoting/webapp/unittests/mock_signal_strategy.js

Issue 927373005: [Chromoting] Enable jscompile for browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests; More review comments Created 5 years, 10 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 | « remoting/webapp/unittests/chrome_mocks.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/unittests/mock_signal_strategy.js
diff --git a/remoting/webapp/unittests/mock_signal_strategy.js b/remoting/webapp/unittests/mock_signal_strategy.js
index 3437010744724f3d2bfe9ae54c4217d8f4018834..46e27f36ee32f36d3ed73cb7e2435e355e00a116 100644
--- a/remoting/webapp/unittests/mock_signal_strategy.js
+++ b/remoting/webapp/unittests/mock_signal_strategy.js
@@ -7,11 +7,22 @@
/** @suppress {duplicate} */
var remoting = remoting || {};
+
+/**
+ * @param {string} jid
+ * @param {remoting.SignalStrategy.Type} type
+ *
+ * @implements {remoting.SignalStrategy}
+ * @constructor
+ */
remoting.MockSignalStrategy = function(jid, type) {
this.jid_ = (jid != undefined) ? jid : "jid@example.com";
this.type_ = (type != undefined) ? type : remoting.SignalStrategy.Type.XMPP;
this.onStateChangedCallback_ = null;
- this.state_ = null;
+
+ /** @type {remoting.SignalStrategy.State} */
+ this.state_ = remoting.SignalStrategy.State.NOT_CONNECTED;
+
this.onIncomingStanzaCallback_ = function() {};
this.dispose = sinon.spy();
this.connect = sinon.spy();
@@ -19,11 +30,19 @@ remoting.MockSignalStrategy = function(jid, type) {
this.sendConnectionSetupResults = sinon.spy();
};
+/**
+ * @param {function(remoting.SignalStrategy.State):void} onStateChangedCallback
+ * Callback to call on state change.
+ */
remoting.MockSignalStrategy.prototype.setStateChangedCallback = function(
onStateChangedCallback) {
this.onStateChangedCallback_ = onStateChangedCallback;
};
+/**
+ * @param {?function(Element):void} onIncomingStanzaCallback Callback to call on
+ * incoming messages.
+ */
remoting.MockSignalStrategy.prototype.setIncomingStanzaCallback =
function(onIncomingStanzaCallback) {
this.onIncomingStanzaCallback_ =
@@ -31,28 +50,30 @@ remoting.MockSignalStrategy.prototype.setIncomingStanzaCallback =
: function() {};
};
-remoting.MockSignalStrategy.prototype.getState = function(message) {
+/** @return {remoting.SignalStrategy.State} */
+remoting.MockSignalStrategy.prototype.getState = function() {
return this.state_;
};
-remoting.MockSignalStrategy.prototype.getError = function(message) {
- return remoting.Error.UNKNOWN;
+/** @return {remoting.Error} */
+remoting.MockSignalStrategy.prototype.getError = function() {
+ return remoting.Error.NONE;
};
-remoting.MockSignalStrategy.prototype.getJid = function(message) {
+/** @return {string} */
+remoting.MockSignalStrategy.prototype.getJid = function() {
return this.jid_;
};
-remoting.MockSignalStrategy.prototype.getType = function(message) {
+/** @return {remoting.SignalStrategy.Type} */
+remoting.MockSignalStrategy.prototype.getType = function() {
return this.type_;
};
+/**
+ * @param {remoting.SignalStrategy.State} state
+ */
remoting.MockSignalStrategy.prototype.setStateForTesting = function(state) {
this.state_ = state;
this.onStateChangedCallback_(state);
};
-
-remoting.MockSignalStrategy.prototype.dispose = function() {
- this.state_ = remoting.SignalStrategy.State.CLOSED;
- this.onStateChangedCallback_(this.state_);
-};
« no previous file with comments | « remoting/webapp/unittests/chrome_mocks.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698