| <html> |
| <!-- |
| This test checks the interaction between prerendering and the Plugin Power Saver |
| feature. It expects: |
| - The plugin is not loaded during prerender. |
| - It is loaded (briefly) during the preroll of the plugin. |
| - It is replaced by the power saver placeholder after the preroll is over. |
| |
| This test relies on the Pepper plugin (but not the placeholder) implementing |
| the postMessage() function on the plugin object. |
| --> |
| <head> |
| <title>Prerender Plugin Delay Loading</title> |
| |
| <script> |
| // Make sure plugin was not loaded while prerendering. |
| function DidPrerenderPass() { |
| // |plugin| should be the blocked plugin placeholder, rather than the |
| // test plugin. |
| var plugin = window.document.getElementById('plugin'); |
| return plugin.postMessage === undefined; |
| } |
| |
| // Make sure the plugin briefly exists, then is replaced with a placeholder. |
| function AwaitPluginPrerollAndPlaceholder() { |
| var plugin = window.document.getElementById('plugin'); |
| function handleEvent(event) { |
| // We should eventually get a message indicating that the plugin has been |
| // throttled and replaced with a static placeholder. |
| if (event.data.isThrottled && event.data.isHiddenForPlaceholder) { |
| plugin.removeEventListener('message', handleEvent); |
| window.domAutomationController.send(true); |
| } |
| } |
| |
| plugin.addEventListener('message', handleEvent); |
| |
| // If postMessage is not defined, the plugin is still the initial placeholder. |
| // When the real plugin loads, we will still get the initial power saver |
| // status notifications. |
| if (plugin.postMessage !== undefined) { |
| plugin.postMessage('getPowerSaverStatus'); |
| } |
| } |
| </script> |
| |
| </head> |
| <body> |
| |
| <object id="plugin" type="application/x-shockwave-flash" |
| height='100' width='100'> |
| </object> |
| |
| </body> |
| </html> |