| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 })(); |
| OLD | NEW |