Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <script> | 3 <script> |
| 4 function triggerPrompt() { | 4 function triggerPrompt() { |
| 5 document.getElementById('flash-link').click(); | 5 document.getElementById('flash-link').click(); |
| 6 window.domAutomationController.send(true); | 6 window.domAutomationController.send(true); |
| 7 } | 7 } |
| 8 | 8 |
| 9 function triggerPromptViaNewWindow() { | 9 function triggerPromptViaNewWindow() { |
| 10 document.getElementById('flash-new-window-link').click(); | 10 document.getElementById('flash-new-window-link').click(); |
| 11 window.domAutomationController.send(true); | 11 window.domAutomationController.send(true); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function flashIsEnabled() { | 14 function triggerPromptViaPluginPlaceholder() { |
|
tommycli
2016/10/03 17:28:50
I think this function is not used.
raymes
2016/10/04 05:07:21
Done.
| |
| 15 var plugin = document.getElementById('flash-object'); | 15 document.getElementById('flash-object-no-fallback').click(); |
| 16 window.domAutomationController.send(true); | |
| 17 } | |
| 18 | |
| 19 function flashIsEnabledForPlugin(plugin) { | |
| 16 plugin.addEventListener('message', function handleEvent(event) { | 20 plugin.addEventListener('message', function handleEvent(event) { |
| 17 if (event.data.source === 'getPowerSaverStatusResponse') { | 21 if (event.data.source === 'getPowerSaverStatusResponse') { |
| 18 plugin.removeEventListener('message', handleEvent); | 22 plugin.removeEventListener('message', handleEvent); |
| 19 window.domAutomationController.send(true); | 23 window.domAutomationController.send(true); |
| 20 } | 24 } |
| 21 }); | 25 }); |
| 22 if (plugin.postMessage) { | 26 if (plugin.postMessage) { |
| 23 plugin.postMessage('getPowerSaverStatus'); | 27 plugin.postMessage('getPowerSaverStatus'); |
| 24 } else { | 28 } else { |
| 25 window.domAutomationController.send(false); | 29 window.domAutomationController.send(false); |
|
tommycli
2016/10/03 17:28:50
I wonder if this is the source of the flakiness.
raymes
2016/10/04 05:07:21
postMessage should appear synchronously on the pep
| |
| 26 } | 30 } |
| 27 } | 31 } |
| 32 | |
| 33 function flashIsEnabled() { | |
| 34 flashIsEnabledForPlugin(document.getElementById('flash-object')); | |
| 35 } | |
| 36 | |
| 37 function flashIsEnabledForPluginWithoutFallack() { | |
|
tommycli
2016/10/03 17:28:50
This is getting confusing. Perhaps split into mult
raymes
2016/10/04 05:07:21
Splitting it into another test will add its own co
| |
| 38 flashIsEnabledForPlugin( | |
| 39 document.getElementById('flash-object-no-fallback')); | |
| 40 } | |
| 28 </script> | 41 </script> |
| 29 <body> | 42 <body> |
| 30 <object id="flash-object" name="plugin" data="test.swf" | 43 <object id="flash-object-no-fallback" data="test.swf" |
| 44 type="application/x-shockwave-flash" width="400" height="100"> | |
| 45 </object> | |
| 46 <object id="flash-object" data="test.swf" | |
| 31 type="application/x-shockwave-flash" width="400" height="100"> | 47 type="application/x-shockwave-flash" width="400" height="100"> |
| 32 Flash not supported. | 48 Flash not supported. |
| 33 <br> | 49 <br> |
| 34 <a href="https://get.adobe.com/flashplayer/" id="flash-link"> | 50 <a href="https://get.adobe.com/flashplayer/" id="flash-link"> |
| 35 Download Flash. | 51 Download Flash. |
| 36 </a> | 52 </a> |
| 37 <a id="flash-new-window-link" | 53 <a id="flash-new-window-link" |
| 38 onclick="window.open('https://get.adobe.com/flashplayer/');"> | 54 onclick="window.open('https://get.adobe.com/flashplayer/');"> |
| 39 Download Flash window.open | 55 Download Flash window.open |
| 40 </a> | 56 </a> |
| 41 </object> | 57 </object> |
| 42 </body> | 58 </body> |
| 43 </html> | 59 </html> |
| OLD | NEW |