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

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

Issue 473073002: Move hello message from It2MeService to It2MeChannel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR feedback Created 6 years, 4 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 | Annotate | Revision Log
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 appLauncher = null; 9 var appLauncher = null;
10 var hangoutPort = null; 10 var hangoutPort = null;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 hangoutPort2.onMessage.mock$fire({ 90 hangoutPort2.onMessage.mock$fire({
91 method: 'connect', 91 method: 'connect',
92 accessCode: "123412341234" 92 accessCode: "123412341234"
93 }); 93 });
94 94
95 it2meService.onWebappConnect_(webappPort); 95 it2meService.onWebappConnect_(webappPort);
96 96
97 var webappPort2 = createPort('it2me.helper.webapp', 'tabId2'); 97 var webappPort2 = createPort('it2me.helper.webapp', 'tabId2');
98 it2meService.onWebappConnect_(webappPort2); 98 it2meService.onWebappConnect_(webappPort2);
99 99
100 // verify that Hangouts can receive messages from webapp 1
Jamie 2014/08/15 21:57:32 I remember asking for this change in another CL. H
kelvinp 2014/08/15 23:25:01 No, I am just trying address your feedback since I
100 webappPort.onMessage.mock$fire({ 101 webappPort.onMessage.mock$fire({
101 method: 'sessionStateChanged', 102 method: 'sessionStateChanged',
102 state: remoting.ClientSession.State.CONNECTED 103 state: remoting.ClientSession.State.CONNECTED
103 }); 104 });
104 105
105 // verify that hangout can receive message events from webapp 1
106 sinon.assert.calledWith(hangoutPort.postMessage, { 106 sinon.assert.calledWith(hangoutPort.postMessage, {
107 method: 'sessionStateChanged', 107 method: 'sessionStateChanged',
108 state: remoting.ClientSession.State.CONNECTED 108 state: remoting.ClientSession.State.CONNECTED
109 }); 109 });
110 110
111 // verify that Hangouts can receive messages from webapp 2.
111 webappPort2.onMessage.mock$fire({ 112 webappPort2.onMessage.mock$fire({
112 method: 'sessionStateChanged', 113 method: 'sessionStateChanged',
113 state: remoting.ClientSession.State.CLOSED 114 state: remoting.ClientSession.State.CLOSED
114 }); 115 });
115 116
116 // verify that hangout can receive message events from webapp 2.
117 sinon.assert.calledWith(hangoutPort2.postMessage, { 117 sinon.assert.calledWith(hangoutPort2.postMessage, {
118 method: 'sessionStateChanged', 118 method: 'sessionStateChanged',
119 state: remoting.ClientSession.State.CLOSED 119 state: remoting.ClientSession.State.CLOSED
120 }); 120 });
121 }); 121 });
122 122
123 test('should reject unknown connection', function() { 123 test('should reject unknown connection', function() {
124 it2meService.onWebappConnect_(webappPort); 124 it2meService.onWebappConnect_(webappPort);
125 sinon.assert.called(webappPort.disconnect); 125 sinon.assert.called(webappPort.disconnect);
126 126
127 var randomPort = createPort('unsupported.port.name'); 127 var randomPort = createPort('unsupported.port.name');
128 it2meService.onConnectExternal_(randomPort); 128 it2meService.onConnectExternal_(randomPort);
129 sinon.assert.called(randomPort.disconnect); 129 sinon.assert.called(randomPort.disconnect);
130 }); 130 });
131 131
132 test('messageExternal("hello") should return supportedFeatures', function() {
133 var response = null;
134 function callback(msg) {
135 response = msg;
136 }
137
138 it2meService.onMessageExternal_({
139 method: 'hello'
140 }, null, callback);
141
142 QUnit.ok(response.supportedFeatures instanceof Array);
143 });
144
145 })(); 132 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698