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

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

Issue 888323002: Improve HRD first run experience (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for Checkin 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 unified diff | Download patch
« no previous file with comments | « remoting/webapp/js_proto/chrome_proto.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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 sinon.assert.calledWithMatch(hangoutPort.postMessage, { 123 sinon.assert.calledWithMatch(hangoutPort.postMessage, {
124 method: MessageTypes.ERROR 124 method: MessageTypes.ERROR
125 }); 125 });
126 }); 126 });
127 127
128 QUnit.asyncTest('connect() should return access code', 128 QUnit.asyncTest('connect() should return access code',
129 function() { 129 function() {
130 // Stubs authentication. 130 // Stubs authentication.
131 sinon.stub(base, 'isAppsV2').returns(true); 131 sinon.stub(base, 'isAppsV2').returns(true);
132 sinon.stub(remoting.MessageWindow, 'showConfirmWindow') 132 sinon.stub(remoting.HangoutConsentDialog, 'getInstance').returns({
133 .callsArgWith(4, 1 /* 1 for OK. */); 133 show : function() {
134 return Promise.resolve();
135 }
136 });
134 sinon.stub(chrome.identity, 'getAuthToken') 137 sinon.stub(chrome.identity, 'getAuthToken')
135 .callsArgWith(1, 'token'); 138 .callsArgWith(1, 'token');
136 // Stubs Host behavior. 139 // Stubs Host behavior.
137 sinon.stub(host, 'initialized').returns(true); 140 sinon.stub(host, 'initialized').returns(true);
138 sinon.stub(host, 'connect') 141 sinon.stub(host, 'connect')
139 .callsArgWith(2, remoting.HostSession.State.RECEIVED_ACCESS_CODE); 142 .callsArgWith(2, remoting.HostSession.State.RECEIVED_ACCESS_CODE);
140 sinon.stub(host, 'getAccessCode').returns('accessCode'); 143 sinon.stub(host, 'getAccessCode').returns('accessCode');
141 144
142 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes; 145 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes;
143 hangoutPort.onMessage.mock$fire({ 146 hangoutPort.onMessage.mock$fire({
144 method: MessageTypes.CONNECT, 147 method: MessageTypes.CONNECT,
145 email: 'test@chromium.org' 148 email: 'test@chromium.org',
149 hangoutBounds: {widht: 10, height: 10, left:10, top: 10}
146 }); 150 });
147 151
148 window.requestAnimationFrame(function(){ 152 window.requestAnimationFrame(function(){
149 // Verify that access code is correct in the response. 153 // Verify that access code is correct in the response.
150 sinon.assert.calledWithMatch(hangoutPort.postMessage, { 154 sinon.assert.calledWithMatch(hangoutPort.postMessage, {
151 method: MessageTypes.CONNECT_RESPONSE, 155 method: MessageTypes.CONNECT_RESPONSE,
152 accessCode: 'accessCode' 156 accessCode: 'accessCode'
153 }); 157 });
154 158
155 chrome.identity.getAuthToken.restore(); 159 chrome.identity.getAuthToken.restore();
156 base.isAppsV2.restore(); 160 base.isAppsV2.restore();
157 remoting.MessageWindow.showConfirmWindow.restore();
158 QUnit.start(); 161 QUnit.start();
159 }); 162 });
160 }); 163 });
161 164
162 test('should disconnect the session if Hangout crashes', function() { 165 test('should disconnect the session if Hangout crashes', function() {
163 sinon.spy(host, 'disconnect'); 166 sinon.spy(host, 'disconnect');
164 hangoutPort.onDisconnect.mock$fire(); 167 hangoutPort.onDisconnect.mock$fire();
165 168
166 sinon.assert.called(onDisposedCallback); 169 sinon.assert.called(onDisposedCallback);
167 sinon.assert.called(host.disconnect); 170 sinon.assert.called(host.disconnect);
168 }); 171 });
169 172
170 })(); 173 })();
OLDNEW
« no previous file with comments | « remoting/webapp/js_proto/chrome_proto.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698