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 * @param {!Object.<string, string>} stringData String data. | 6 * @param {!Object.<string, string>} stringData String data. |
7 * @param {!VolumeManager} volumeManager Volume manager. | 7 * @param {!VolumeManager} volumeManager Volume manager. |
8 * @constructor | 8 * @constructor |
9 * @struct | 9 * @struct |
10 */ | 10 */ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 launch(selectedEntriesPromise).catch(function(error) { | 216 launch(selectedEntriesPromise).catch(function(error) { |
217 console.error(error.stack || error); | 217 console.error(error.stack || error); |
218 }); | 218 }); |
219 }); | 219 }); |
220 } | 220 } |
221 | 221 |
222 // If is is run in the browser test, wait for the test resources are installed | 222 // If is is run in the browser test, wait for the test resources are installed |
223 // as a component extension, and then load the test resources. | 223 // as a component extension, and then load the test resources. |
224 if (chrome.test) { | 224 if (chrome.test) { |
| 225 // Sets a global flag that we are in tests, so other components are aware of |
| 226 // it. |
| 227 window.IN_TEST = true; |
| 228 |
225 /** @type {string} */ | 229 /** @type {string} */ |
226 window.testExtensionId = 'ejhcmmdhhpdhhgmifplfmjobgegbibkn'; | 230 window.testExtensionId = 'ejhcmmdhhpdhhgmifplfmjobgegbibkn'; |
227 chrome.runtime.onMessageExternal.addListener(function(message) { | 231 chrome.runtime.onMessageExternal.addListener(function(message) { |
228 if (message.name !== 'testResourceLoaded') | 232 if (message.name !== 'testResourceLoaded') |
229 return; | 233 return; |
230 var script = document.createElement('script'); | 234 var script = document.createElement('script'); |
231 script.src = | 235 script.src = |
232 'chrome-extension://' + window.testExtensionId + | 236 'chrome-extension://' + window.testExtensionId + |
233 '/common/test_loader.js'; | 237 '/common/test_loader.js'; |
234 document.documentElement.appendChild(script); | 238 document.documentElement.appendChild(script); |
235 }); | 239 }); |
236 } | 240 } |
OLD | NEW |