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

Side by Side Diff: remoting/webapp/unittests/fallback_signal_strategy_unittest.js

Issue 959963002: [Chromoting] Enable jscompile for webapp unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix key tester Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /**
6 * @fileoverview
7 * TODO(garykac): Create interfaces for LogToServer and SignalStrategy.
8 * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility}
9 */
10
5 (function() { 11 (function() {
6 12
7 'use strict'; 13 'use strict';
8 14
9 15 /** @constructor */
10 var MockLogToServer = function() { 16 var MockLogToServer = function() {
17 /** @type {(sinon.Spy|Function)} */
11 this.logSignalStrategyProgress = sinon.spy(); 18 this.logSignalStrategyProgress = sinon.spy();
12 }; 19 };
13 20
21 /** @type {function(...)} */
14 MockLogToServer.prototype.assertProgress = function() { 22 MockLogToServer.prototype.assertProgress = function() {
15 equal(this.logSignalStrategyProgress.callCount * 2, arguments.length); 23 equal(this.logSignalStrategyProgress.callCount * 2, arguments.length);
16 for (var i = 0; i < this.logSignalStrategyProgress.callCount; ++i) { 24 for (var i = 0; i < this.logSignalStrategyProgress.callCount; ++i) {
17 equal(this.logSignalStrategyProgress.getCall(i).args[0], arguments[2 * i]); 25 equal(this.logSignalStrategyProgress.getCall(i).args[0], arguments[2 * i]);
18 equal(this.logSignalStrategyProgress.getCall(i).args[1], 26 equal(this.logSignalStrategyProgress.getCall(i).args[1],
19 arguments[2 * i + 1]); 27 arguments[2 * i + 1]);
20 } 28 }
21 }; 29 };
22 30
31 /** @type {(sinon.Spy|function(remoting.SignalStrategy.State))} */
23 var onStateChange = null; 32 var onStateChange = null;
33
34 /** @type {(sinon.Spy|function(Element):void)} */
24 var onIncomingStanzaCallback = null; 35 var onIncomingStanzaCallback = null;
36
37 /** @type {remoting.FallbackSignalStrategy} */
25 var strategy = null; 38 var strategy = null;
39
40 /** @type {remoting.SignalStrategy} */
26 var primary = null; 41 var primary = null;
42
43 /** @type {remoting.SignalStrategy} */
27 var secondary = null; 44 var secondary = null;
45
46 /** @type {MockLogToServer} */
28 var logToServer = null; 47 var logToServer = null;
29 48
49 /**
50 * @param {remoting.MockSignalStrategy} baseSignalStrategy
51 * @param {remoting.SignalStrategy.State} state
52 * @param {boolean} expectCallback
53 */
30 function setState(baseSignalStrategy, state, expectCallback) { 54 function setState(baseSignalStrategy, state, expectCallback) {
31 onStateChange.reset(); 55 onStateChange.reset();
32 baseSignalStrategy.setStateForTesting(state); 56 baseSignalStrategy.setStateForTesting(state);
33 57
34 if (expectCallback) { 58 if (expectCallback) {
35 equal(onStateChange.callCount, 1); 59 equal(onStateChange.callCount, 1);
36 ok(onStateChange.calledWith(state)); 60 ok(onStateChange.calledWith(state));
37 equal(strategy.getState(), state); 61 equal(strategy.getState(), state);
38 } else { 62 } else {
39 ok(!onStateChange.called); 63 ok(!onStateChange.called);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 remoting.SignalStrategy.Type.XMPP, 267 remoting.SignalStrategy.Type.XMPP,
244 remoting.FallbackSignalStrategy.Progress.TIMED_OUT, 268 remoting.FallbackSignalStrategy.Progress.TIMED_OUT,
245 remoting.SignalStrategy.Type.WCS, 269 remoting.SignalStrategy.Type.WCS,
246 remoting.FallbackSignalStrategy.Progress.SUCCEEDED, 270 remoting.FallbackSignalStrategy.Progress.SUCCEEDED,
247 remoting.SignalStrategy.Type.XMPP, 271 remoting.SignalStrategy.Type.XMPP,
248 remoting.FallbackSignalStrategy.Progress.SUCCEEDED_LATE); 272 remoting.FallbackSignalStrategy.Progress.SUCCEEDED_LATE);
249 } 273 }
250 ); 274 );
251 275
252 })(); 276 })();
OLDNEW
« no previous file with comments | « remoting/webapp/unittests/event_hook_unittest.js ('k') | remoting/webapp/unittests/ipc_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698