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 /** |
| 6 * @fileoverview |
| 7 * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility} |
| 8 */ |
| 9 |
5 (function() { | 10 (function() { |
6 | 11 |
7 'use strict'; | 12 'use strict'; |
8 | 13 |
9 var appLauncher = null; | 14 var appLauncher = null; |
10 var hangoutPort = null; | 15 var hangoutPort = null; |
11 var webappPort = null; | 16 var webappPort = null; |
12 var it2meService = null; | 17 var it2meService = null; |
13 | 18 |
14 function createPort(name, senderId) { | 19 function createPort(name, senderId) { |
15 var port = new chromeMocks.runtime.Port(); | 20 var port = new chrome.runtime.Port(); |
16 port.name = (senderId) ? name +'@' + senderId : name; | 21 port.name = (senderId) ? name +'@' + senderId : name; |
17 port.postMessage = sinon.spy(port, 'postMessage'); | 22 port.postMessage = sinon.spy(port, 'postMessage'); |
18 port.disconnect = sinon.spy(port, 'disconnect'); | 23 port.disconnect = sinon.spy(port, 'disconnect'); |
19 | 24 |
20 return port; | 25 return port; |
21 } | 26 } |
22 | 27 |
23 function promiseResolveSynchronous(value) { | 28 function promiseResolveSynchronous(value) { |
24 return { | 29 return { |
25 then: function(callback) { | 30 then: function(callback) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 127 |
123 test('should reject unknown connection', function() { | 128 test('should reject unknown connection', function() { |
124 it2meService.onWebappConnect_(webappPort); | 129 it2meService.onWebappConnect_(webappPort); |
125 sinon.assert.called(webappPort.disconnect); | 130 sinon.assert.called(webappPort.disconnect); |
126 | 131 |
127 var randomPort = createPort('unsupported.port.name'); | 132 var randomPort = createPort('unsupported.port.name'); |
128 it2meService.onConnectExternal_(randomPort); | 133 it2meService.onConnectExternal_(randomPort); |
129 sinon.assert.called(randomPort.disconnect); | 134 sinon.assert.called(randomPort.disconnect); |
130 }); | 135 }); |
131 | 136 |
132 })(); | 137 })(); |
OLD | NEW |