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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 remoting.pairedClientManager.setPairedClients([]); | 170 remoting.pairedClientManager.setPairedClients([]); |
171 } | 171 } |
172 }; | 172 }; |
173 | 173 |
174 remoting.hostController.hasFeature( | 174 remoting.hostController.hasFeature( |
175 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); | 175 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); |
176 remoting.hostController.getLocalHostState(onHostState); | 176 remoting.hostController.getLocalHostState(onHostState); |
177 }; | 177 }; |
178 | 178 |
179 /** | 179 /** |
180 * Entry point ('load' handler) for Remote Desktop (CRD) webapp. | 180 * Entry point for test code. In order to make test and production |
| 181 * code as similar as possible, the same entry point is used for |
| 182 * production code, but since production code should never have |
| 183 * 'source' set to 'test', it continue with initialization |
| 184 * immediately. As a fail-safe, the mechanism by which initialization |
| 185 * completes when under test is controlled by a simple UI, making it |
| 186 * possible to use the app even if the previous assumption fails to |
| 187 * hold in some corner cases. |
181 */ | 188 */ |
| 189 remoting.initDesktopRemotingForTesting = function() { |
| 190 var urlParams = getUrlParameters_(); |
| 191 if (urlParams['source'] === 'test') { |
| 192 document.getElementById('browser-test-continue-init').addEventListener( |
| 193 'click', remoting.initDesktopRemoting, false); |
| 194 document.getElementById('browser-test-deferred-init').hidden = false; |
| 195 } else { |
| 196 remoting.initDesktopRemoting(); |
| 197 } |
| 198 } |
| 199 |
| 200 |
182 remoting.initDesktopRemoting = function() { | 201 remoting.initDesktopRemoting = function() { |
183 remoting.app = new remoting.Application(); | 202 remoting.app = new remoting.Application(); |
184 var desktop_remoting = new remoting.DesktopRemoting(remoting.app); | 203 var desktop_remoting = new remoting.DesktopRemoting(remoting.app); |
185 remoting.app.init(); | 204 remoting.app.init(); |
186 }; | 205 }; |
187 | 206 |
188 window.addEventListener('load', remoting.initDesktopRemoting, false); | 207 window.addEventListener('load', remoting.initDesktopRemotingForTesting, false); |
OLD | NEW |