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

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

Issue 937593002: Changed identity API to use promises instead of callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed bad merge 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
« no previous file with comments | « remoting/webapp/unittests/apps_v2_migration_unittest.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var hostInstaller = null; 9 var hostInstaller = null;
10 var hangoutPort = null; 10 var hangoutPort = null;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 function() { 121 function() {
122 // Stubs authentication. 122 // Stubs authentication.
123 sinon.stub(base, 'isAppsV2').returns(true); 123 sinon.stub(base, 'isAppsV2').returns(true);
124 sinon.stub(remoting.HangoutConsentDialog, 'getInstance').returns({ 124 sinon.stub(remoting.HangoutConsentDialog, 'getInstance').returns({
125 show : function() { 125 show : function() {
126 return Promise.resolve(); 126 return Promise.resolve();
127 } 127 }
128 }); 128 });
129 sinon.stub(chrome.identity, 'getAuthToken') 129 sinon.stub(chrome.identity, 'getAuthToken')
130 .callsArgWith(1, 'token'); 130 .callsArgWith(1, 'token');
131 sinon.stub(remoting.identity, 'callWithToken') 131 sinon.stub(remoting.identity, 'getToken')
132 .callsArgWith(0, 'token'); 132 .returns(Promise.resolve('token'));
133 sinon.stub(remoting.identity, 'getEmail') 133 sinon.stub(remoting.identity, 'getEmail')
134 .callsArgWith(0, {token: 'token', email: 'test@chromium.org'}); 134 .returns(Promise.resolve('test@chromium.org'));
135 // Stubs Host behavior. 135 // Stubs Host behavior.
136 sinon.stub(host, 'initialized').returns(true); 136 sinon.stub(host, 'initialized').returns(true);
137 sinon.stub(host, 'connect') 137 sinon.stub(host, 'connect')
138 .callsArgWith(2, remoting.HostSession.State.RECEIVED_ACCESS_CODE); 138 .callsArgWith(2, remoting.HostSession.State.RECEIVED_ACCESS_CODE);
139 sinon.stub(host, 'getAccessCode').returns('accessCode'); 139 sinon.stub(host, 'getAccessCode').returns('accessCode');
140 140
141 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes; 141 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes;
142 hangoutPort.onMessage.mock$fire({ 142 hangoutPort.onMessage.mock$fire({
143 method: MessageTypes.CONNECT, 143 method: MessageTypes.CONNECT,
144 hangoutBounds: {widht: 10, height: 10, left:10, top: 10} 144 hangoutBounds: {widht: 10, height: 10, left:10, top: 10}
(...skipping 14 matching lines...) Expand all
159 159
160 test('should disconnect the session if Hangout crashes', function() { 160 test('should disconnect the session if Hangout crashes', function() {
161 sinon.spy(host, 'disconnect'); 161 sinon.spy(host, 'disconnect');
162 hangoutPort.onDisconnect.mock$fire(); 162 hangoutPort.onDisconnect.mock$fire();
163 163
164 sinon.assert.called(onDisposedCallback); 164 sinon.assert.called(onDisposedCallback);
165 sinon.assert.called(host.disconnect); 165 sinon.assert.called(host.disconnect);
166 }); 166 });
167 167
168 })(); 168 })();
OLDNEW
« no previous file with comments | « remoting/webapp/unittests/apps_v2_migration_unittest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698