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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Mock implementation of SessionConnector for testing. | 7 * Mock implementation of SessionConnector for testing. |
8 * @suppress {checkTypes} | 8 * @suppress {checkTypes} |
9 */ | 9 */ |
10 | 10 |
11 'use strict'; | 11 'use strict'; |
12 | 12 |
13 /** @suppress {duplicate} */ | 13 /** @suppress {duplicate} */ |
14 var remoting = remoting || {}; | 14 var remoting = remoting || {}; |
15 | 15 |
16 /** | 16 /** |
17 * @param {HTMLElement} clientContainer Container element for the client view. | 17 * @param {HTMLElement} clientContainer Container element for the client view. |
18 * @param {function(remoting.ClientSession):void} onConnected Callback on | 18 * @param {function(remoting.ClientSession):void} onConnected Callback on |
19 * success. | 19 * success. |
20 * @param {function(remoting.Error):void} onError Callback on error. | 20 * @param {function(!remoting.Error):void} onError Callback on error. |
21 * @param {function(string, string):boolean} onExtensionMessage The handler for | 21 * @param {function(string, string):boolean} onExtensionMessage The handler for |
22 * protocol extension messages. Returns true if a message is recognized; | 22 * protocol extension messages. Returns true if a message is recognized; |
23 * false otherwise. | 23 * false otherwise. |
24 * @param {function(remoting.Error):void} onConnectionFailed Callback for when | 24 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when |
25 * the connection fails. | 25 * the connection fails. |
26 * @param {Array<string>} requiredCapabilities Connector capabilities | 26 * @param {Array<string>} requiredCapabilities Connector capabilities |
27 * required by this application. | 27 * required by this application. |
28 * @param {string} defaultRemapKeys The default set of key mappings for the | 28 * @param {string} defaultRemapKeys The default set of key mappings for the |
29 * client session to use. | 29 * client session to use. |
30 * @constructor | 30 * @constructor |
31 * @implements {remoting.SessionConnector} | 31 * @implements {remoting.SessionConnector} |
32 */ | 32 */ |
33 remoting.MockSessionConnector = function(clientContainer, onConnected, onError, | 33 remoting.MockSessionConnector = function(clientContainer, onConnected, onError, |
34 onExtensionMessage, | 34 onExtensionMessage, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 /** | 156 /** |
157 * @constructor | 157 * @constructor |
158 * @extends {remoting.SessionConnectorFactory} | 158 * @extends {remoting.SessionConnectorFactory} |
159 */ | 159 */ |
160 remoting.MockSessionConnectorFactory = function() {}; | 160 remoting.MockSessionConnectorFactory = function() {}; |
161 | 161 |
162 /** | 162 /** |
163 * @param {HTMLElement} clientContainer Container element for the client view. | 163 * @param {HTMLElement} clientContainer Container element for the client view. |
164 * @param {function(remoting.ClientSession):void} onConnected Callback on | 164 * @param {function(remoting.ClientSession):void} onConnected Callback on |
165 * success. | 165 * success. |
166 * @param {function(remoting.Error):void} onError Callback on error. | 166 * @param {function(!remoting.Error):void} onError Callback on error. |
167 * @param {function(string, string):boolean} onExtensionMessage The handler for | 167 * @param {function(string, string):boolean} onExtensionMessage The handler for |
168 * protocol extension messages. Returns true if a message is recognized; | 168 * protocol extension messages. Returns true if a message is recognized; |
169 * false otherwise. | 169 * false otherwise. |
170 * @param {function(remoting.Error):void} onConnectionFailed Callback for when | 170 * @param {function(!remoting.Error):void} onConnectionFailed Callback for when |
171 * the connection fails. | 171 * the connection fails. |
172 * @param {Array<string>} requiredCapabilities Connector capabilities | 172 * @param {Array<string>} requiredCapabilities Connector capabilities |
173 * required by this application. | 173 * required by this application. |
174 * @param {string} defaultRemapKeys The default set of key mappings to use | 174 * @param {string} defaultRemapKeys The default set of key mappings to use |
175 * in the client session. | 175 * in the client session. |
176 * @return {remoting.MockSessionConnector} | 176 * @return {remoting.MockSessionConnector} |
177 */ | 177 */ |
178 remoting.MockSessionConnectorFactory.prototype.createConnector = | 178 remoting.MockSessionConnectorFactory.prototype.createConnector = |
179 function(clientContainer, onConnected, onError, onExtensionMessage, | 179 function(clientContainer, onConnected, onError, onExtensionMessage, |
180 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { | 180 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { |
181 return new remoting.MockSessionConnector( | 181 return new remoting.MockSessionConnector( |
182 clientContainer, onConnected, onError, onExtensionMessage, | 182 clientContainer, onConnected, onError, onExtensionMessage, |
183 onConnectionFailed, requiredCapabilities, defaultRemapKeys); | 183 onConnectionFailed, requiredCapabilities, defaultRemapKeys); |
184 }; | 184 }; |
OLD | NEW |