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

Side by Side Diff: remoting/webapp/crd/js/client_session_factory_unittest.js

Issue 1101613003: [Webapp Refactor] Reliably cancels a connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ImproveUnittest
Patch Set: Created 5 years, 8 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 (function() { 5 (function() {
6 6
7 'use strict'; 7 'use strict';
8 8
9 /** @type {remoting.MockConnection} */ 9 /** @type {remoting.MockConnection} */
10 var mockConnection; 10 var mockConnection;
11 /** @type {remoting.ClientSessionFactory} */ 11 /** @type {remoting.ClientSessionFactory} */
12 var factory; 12 var factory;
13 /** @type {remoting.ClientSession.EventHandler} */ 13 /** @type {remoting.ClientSession.EventHandler} */
14 var listener; 14 var listener;
15 15
16 /** 16 /**
17 * @constructor 17 * @constructor
18 * @implements {remoting.ClientSession.EventHandler} 18 * @implements {remoting.ClientSession.EventHandler}
19 */ 19 */
20 var SessionListener = function() {}; 20 var SessionListener = function() {};
21 SessionListener.prototype.onConnectionFailed = function(error) {}; 21 SessionListener.prototype.onConnectionFailed = function(error) {};
22 SessionListener.prototype.onConnected = function(connectionInfo) {}; 22 SessionListener.prototype.onConnected = function(connectionInfo) {};
23 SessionListener.prototype.onDisconnected = function() {}; 23 SessionListener.prototype.onDisconnected = function(reason) {};
24 SessionListener.prototype.onError = function(error) {}; 24 SessionListener.prototype.onError = function(error) {};
25 25
26 QUnit.module('ClientSessionFactory', { 26 QUnit.module('ClientSessionFactory', {
27 beforeEach: function() { 27 beforeEach: function() {
28 chromeMocks.activate(['identity']); 28 chromeMocks.activate(['identity']);
29 chromeMocks.identity.mock$setToken('fake_token'); 29 chromeMocks.identity.mock$setToken('fake_token');
30 30
31 mockConnection = new remoting.MockConnection(); 31 mockConnection = new remoting.MockConnection();
32 listener = new SessionListener(); 32 listener = new SessionListener();
33 factory = new remoting.ClientSessionFactory( 33 factory = new remoting.ClientSessionFactory(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 assert.ok.bind(assert, false, 'Expect createSession() to fail.') 84 assert.ok.bind(assert, false, 'Expect createSession() to fail.')
85 ).catch(function(/** remoting.Error */ error) { 85 ).catch(function(/** remoting.Error */ error) {
86 assert.ok( 86 assert.ok(
87 signalStrategyDispose.called, 'SignalStrategy is disposed on failure.'); 87 signalStrategyDispose.called, 'SignalStrategy is disposed on failure.');
88 assert.ok(error.hasTag(remoting.Error.Tag.MISSING_PLUGIN), 88 assert.ok(error.hasTag(remoting.Error.Tag.MISSING_PLUGIN),
89 'Initialization failed with MISSING_PLUGIN.'); 89 'Initialization failed with MISSING_PLUGIN.');
90 }); 90 });
91 }); 91 });
92 92
93 })(); 93 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698