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 // Stores the app windows OLNY for test purpose. | 7 // Stores the app windows OLNY for test purpose. |
8 // We SHOULD NOT use it as it is except for test, since the files which have | 8 // We SHOULD NOT use it as it is except for test, since the files which have |
9 // the same name will be overridden each other. | 9 // the same name will be overridden each other. |
10 var appWindowsForTest = {}; | 10 var appWindowsForTest = {}; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 frame: 'none', | 77 frame: 'none', |
78 singleton: false, | 78 singleton: false, |
79 minWidth: 480, | 79 minWidth: 480, |
80 minHeight: 270 | 80 minHeight: 270 |
81 }, | 81 }, |
82 fulfill); | 82 fulfill); |
83 }).then(function(createdWindow) { | 83 }).then(function(createdWindow) { |
84 // Stores the window for test purpose. | 84 // Stores the window for test purpose. |
85 appWindowsForTest[videos[0].entry.name] = createdWindow; | 85 appWindowsForTest[videos[0].entry.name] = createdWindow; |
86 | 86 |
87 createdWindow.contentWindow.videos = videos; | |
87 createdWindow.setIcon('images/icon/video-player-64.png'); | 88 createdWindow.setIcon('images/icon/video-player-64.png'); |
88 createdWindow.contentWindow.videos = videos; | 89 |
90 if (chrome.test) { | |
hirono
2014/08/26 05:59:01
nit: {} is not needed.
yoshiki
2014/08/26 06:11:02
Done.
| |
91 createdWindow.contentWindow.loadMockCastExtensionForTest = true; | |
92 } | |
93 | |
89 chrome.runtime.sendMessage({ready: true}, function() {}); | 94 chrome.runtime.sendMessage({ready: true}, function() {}); |
hirono
2014/08/26 05:59:01
nit: Can we remove the callback?
yoshiki
2014/08/26 06:11:02
Done.
| |
90 }).catch(function(error) { | 95 }).catch(function(error) { |
91 console.error('Launch failed', error.stack || error); | 96 console.error('Launch failed', error.stack || error); |
92 return Promise.reject(error); | 97 return Promise.reject(error); |
93 }); | 98 }); |
94 } | 99 } |
95 | 100 |
96 // If is is run in the browser test, wait for the test resources are installed | 101 // If is is run in the browser test, wait for the test resources are installed |
97 // as a component extension, and then load the test resources. | 102 // as a component extension, and then load the test resources. |
98 if (chrome.test) { | 103 if (chrome.test) { |
99 window.testExtensionId = 'ljoplibgfehghmibaoaepfagnmbbfiga'; | 104 window.testExtensionId = 'ljoplibgfehghmibaoaepfagnmbbfiga'; |
100 chrome.runtime.onMessageExternal.addListener(function(message) { | 105 chrome.runtime.onMessageExternal.addListener(function(message) { |
101 if (message.name !== 'testResourceLoaded') | 106 if (message.name !== 'testResourceLoaded') |
102 return; | 107 return; |
103 var script = document.createElement('script'); | 108 var script = document.createElement('script'); |
104 script.src = | 109 script.src = |
105 'chrome-extension://' + window.testExtensionId + | 110 'chrome-extension://' + window.testExtensionId + |
106 '/common/test_loader.js'; | 111 '/common/test_loader.js'; |
107 document.documentElement.appendChild(script); | 112 document.documentElement.appendChild(script); |
108 }); | 113 }); |
109 } | 114 } |
OLD | NEW |