OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="chrome-webstore-item"> | 4 <link rel="chrome-webstore-item"> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 console.log('Page loaded'); | |
9 | |
10 function runTest(galleryUrl) { | 8 function runTest(galleryUrl) { |
11 console.log('In runTest'); | 9 var receivedProgressUpdate = false; |
12 | 10 |
13 // Link URL has to be generated dynamically in order to include the right | 11 // Link URL has to be generated dynamically in order to include the right |
14 // port number. The ID corresponds to the data in the "extension" directory. | 12 // port number. The ID corresponds to the data in the "extension" directory. |
15 document.getElementsByTagName('link')[0].href = | 13 document.getElementsByTagName('link')[0].href = |
16 galleryUrl + '/detail/ecglahbcnmdpdciemllbhojghbkagdje'; | 14 galleryUrl + '/detail/ecglahbcnmdpdciemllbhojghbkagdje'; |
17 | 15 |
18 try { | 16 try { |
| 17 // Ensure our listener mask works correctly by adding both listeners. |
| 18 // We don't need to test the fucntionality, as each listener is tested |
| 19 // individually separately. |
| 20 chrome.webstore.onDownloadProgress.addListener(function(progress) {}); |
| 21 chrome.webstore.onInstallStageChanged.addListener(function(stage) {}); |
19 chrome.webstore.install( | 22 chrome.webstore.install( |
20 undefined, | 23 undefined, |
21 function() { | 24 function() { |
22 console.log('Ran test, sending response'); | |
23 window.domAutomationController.send(true); | 25 window.domAutomationController.send(true); |
24 console.log('Test complete'); | |
25 }, | 26 }, |
26 function(error) { | 27 function(error) { |
27 console.log('Unexpected error: ' + error); | 28 console.log('Unexpected error: ' + error); |
28 window.domAutomationController.send(false); | 29 window.domAutomationController.send(false); |
29 }); | 30 }); |
30 // Force a garbage collection, so that if the callbacks aren't being | 31 // Force a garbage collection, so that if the callbacks aren't being |
31 // retained properly they'll get collected and the test will fail. | 32 // retained properly they'll get collected and the test will fail. |
32 window.gc(); | 33 window.gc(); |
33 } catch (e) { | 34 } catch (e) { |
34 console.log('Unexpected exception: ' + e); | 35 console.log('Unexpected exception: ' + e); |
| 36 console.log(e.stack); |
35 window.domAutomationController.send(false); | 37 window.domAutomationController.send(false); |
36 throw e; | 38 throw e; |
37 } | 39 } |
38 } | 40 } |
39 </script> | 41 </script> |
40 | 42 |
41 </body> | 43 </body> |
42 </html> | 44 </html> |
OLD | NEW |