Chromium Code Reviews| 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 appLauncher = null; | 9 var appLauncher = null; |
| 10 var hangoutPort = null; | 10 var hangoutPort = null; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 function promiseResolveSynchronous(value) { | 56 function promiseResolveSynchronous(value) { |
| 57 return { | 57 return { |
| 58 then: function(callback) { | 58 then: function(callback) { |
| 59 callback('tabId'); | 59 callback('tabId'); |
| 60 } | 60 } |
| 61 }; | 61 }; |
| 62 } | 62 } |
| 63 | 63 |
| 64 test('onHangoutMessage_("hello") should return supportedFeatures', function() { | |
| 65 hangoutPort.onMessage.mock$fire( | |
| 66 { method: remoting.It2MeHelperChannel.HangoutMessageTypes.HELLO }); | |
| 67 | |
| 68 sinon.assert.calledWith(hangoutPort.postMessage, { | |
| 69 method: remoting.It2MeHelperChannel.HangoutMessageTypes.HELLO_RESPONSE, | |
| 70 supportedFeatures: base.values(remoting.It2MeHelperChannel.Features) | |
|
Jamie
2014/08/15 23:30:12
This is testing something stricter than it needs t
| |
| 71 }); | |
| 72 }); | |
| 73 | |
| 64 test('onHangoutMessage_(|connect|) should launch the webapp', | 74 test('onHangoutMessage_(|connect|) should launch the webapp', |
| 65 function() { | 75 function() { |
| 66 sinon.assert.called(appLauncher.launch); | 76 sinon.assert.called(appLauncher.launch); |
| 67 QUnit.equal(helperChannel.instanceId(), 'tabId'); | 77 QUnit.equal(helperChannel.instanceId(), 'tabId'); |
| 68 }); | 78 }); |
| 69 | 79 |
| 70 test('onWebappMessage() should forward messages to hangout', function() { | 80 test('onWebappMessage() should forward messages to hangout', function() { |
| 71 // Execute. | 81 // Execute. |
| 72 helperChannel.onWebappConnect(webappPort); | 82 helperChannel.onWebappConnect(webappPort); |
| 73 webappPort.onMessage.mock$fire({ | 83 webappPort.onMessage.mock$fire({ |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 hangoutPort.onDisconnect.mock$fire(); | 180 hangoutPort.onDisconnect.mock$fire(); |
| 171 | 181 |
| 172 sinon.assert.calledOnce(appLauncher.close); | 182 sinon.assert.calledOnce(appLauncher.close); |
| 173 sinon.assert.calledOnce(disconnectCallback); | 183 sinon.assert.calledOnce(disconnectCallback); |
| 174 | 184 |
| 175 sinon.assert.called(hangoutPort.disconnect); | 185 sinon.assert.called(hangoutPort.disconnect); |
| 176 sinon.assert.called(webappPort.disconnect); | 186 sinon.assert.called(webappPort.disconnect); |
| 177 }); | 187 }); |
| 178 | 188 |
| 179 })(); | 189 })(); |
| OLD | NEW |