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

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

Issue 874683002: Fix host installation on i686 Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/crd/js/it2me_helpee_channel.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 16 matching lines...) Expand all
27 initialize: function() {}, 27 initialize: function() {},
28 initialized: function() {}, 28 initialized: function() {},
29 connect: function() {}, 29 connect: function() {},
30 disconnect: function() {}, 30 disconnect: function() {},
31 getAccessCode: function() {}, 31 getAccessCode: function() {},
32 unhookCallbacks: function() {} 32 unhookCallbacks: function() {}
33 }; 33 };
34 34
35 // HostInstaller 35 // HostInstaller
36 hostInstaller = { 36 hostInstaller = {
37 isInstalled: function() {},
38 download: function() {} 37 download: function() {}
39 }; 38 };
40 39
41 // HelpeeChannel 40 // HelpeeChannel
42 helpeeChannel = new remoting.It2MeHelpeeChannel( 41 helpeeChannel = new remoting.It2MeHelpeeChannel(
43 hangoutPort, 42 hangoutPort,
44 host, 43 host,
45 hostInstaller, 44 hostInstaller,
46 onDisposedCallback); 45 onDisposedCallback);
47 helpeeChannel.init(); 46 helpeeChannel.init();
48 47
49 // remoting.settings 48 // remoting.settings
50 remoting.settings = new remoting.Settings(); 49 remoting.settings = new remoting.Settings();
51 } 50 }
52 }); 51 });
53 52
54 test('hello() should return supportedFeatures', function() { 53 test('hello() should return supportedFeatures', function() {
55 hangoutPort.onMessage.mock$fire( 54 hangoutPort.onMessage.mock$fire(
56 { method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.HELLO }); 55 { method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.HELLO });
57 56
58 sinon.assert.calledWith(hangoutPort.postMessage, { 57 sinon.assert.calledWith(hangoutPort.postMessage, {
59 method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.HELLO_RESPONSE, 58 method: remoting.It2MeHelpeeChannel.HangoutMessageTypes.HELLO_RESPONSE,
60 supportedFeatures: base.values(remoting.It2MeHelperChannel.Features) 59 supportedFeatures: base.values(remoting.It2MeHelperChannel.Features)
61 }); 60 });
62 }); 61 });
63 62
64 QUnit.asyncTest( 63 QUnit.asyncTest(
65 'isHostInstalled() should return false if host is not installed', 64 'isHostInstalled() should return false if host is not installed',
66 function() { 65 function() {
67 sinon.stub(hostInstaller, 'isInstalled').returns(Promise.resolve(false)); 66 sinon.stub(remoting.HostInstaller, 'isInstalled')
67 .returns(Promise.resolve(false));
68 68
69 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes; 69 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes;
70 hangoutPort.onMessage.mock$fire({ 70 hangoutPort.onMessage.mock$fire({
71 method: MessageTypes.IS_HOST_INSTALLED 71 method: MessageTypes.IS_HOST_INSTALLED
72 }); 72 });
73 73
74 window.requestAnimationFrame(function() { 74 window.requestAnimationFrame(function() {
75 remoting.HostInstaller.isInstalled.restore();
75 sinon.assert.calledWith(hangoutPort.postMessage, { 76 sinon.assert.calledWith(hangoutPort.postMessage, {
76 method: MessageTypes.IS_HOST_INSTALLED_RESPONSE, 77 method: MessageTypes.IS_HOST_INSTALLED_RESPONSE,
77 result: false 78 result: false
78 }); 79 });
79 QUnit.start(); 80 QUnit.start();
80 }); 81 });
81 }); 82 });
82 83
83 QUnit.asyncTest('isHostInstalled() should return true if host is installed', 84 QUnit.asyncTest('isHostInstalled() should return true if host is installed',
84 function() { 85 function() {
85 sinon.stub(hostInstaller, 'isInstalled').returns(Promise.resolve(true)); 86 sinon.stub(remoting.HostInstaller, 'isInstalled')
87 .returns(Promise.resolve(true));
86 88
87 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes; 89 var MessageTypes = remoting.It2MeHelpeeChannel.HangoutMessageTypes;
88 hangoutPort.onMessage.mock$fire({ 90 hangoutPort.onMessage.mock$fire({
89 method: MessageTypes.IS_HOST_INSTALLED 91 method: MessageTypes.IS_HOST_INSTALLED
90 }); 92 });
91 93
92 window.requestAnimationFrame(function() { 94 window.requestAnimationFrame(function() {
95 remoting.HostInstaller.isInstalled.restore();
93 sinon.assert.calledWith(hangoutPort.postMessage, { 96 sinon.assert.calledWith(hangoutPort.postMessage, {
94 method: MessageTypes.IS_HOST_INSTALLED_RESPONSE, 97 method: MessageTypes.IS_HOST_INSTALLED_RESPONSE,
95 result: true 98 result: true
96 }); 99 });
97 QUnit.start(); 100 QUnit.start();
98 }); 101 });
99 }); 102 });
100 103
101 test('downloadHost() should trigger a host download', 104 test('downloadHost() should trigger a host download',
102 function() { 105 function() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 161
159 test('should disconnect the session if Hangout crashes', function() { 162 test('should disconnect the session if Hangout crashes', function() {
160 sinon.spy(host, 'disconnect'); 163 sinon.spy(host, 'disconnect');
161 hangoutPort.onDisconnect.mock$fire(); 164 hangoutPort.onDisconnect.mock$fire();
162 165
163 sinon.assert.called(onDisposedCallback); 166 sinon.assert.called(onDisposedCallback);
164 sinon.assert.called(host.disconnect); 167 sinon.assert.called(host.disconnect);
165 }); 168 });
166 169
167 })(); 170 })();
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/it2me_helpee_channel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698