Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / prerender / prerender_plugin_power_saver.html
blob18cb87e9de0d497dff7656733b68c7ad5ec1cc4e
1 <html>
2 <!--
3 This test checks the interaction between prerendering and the Plugin Power Saver
4 feature. It expects:
5 - The plugin is not loaded during prerender.
6 - It is loaded (briefly) during the preroll of the plugin.
7 - It is replaced by the power saver placeholder after the preroll is over.
9 This test relies on the Pepper plugin (but not the placeholder) implementing
10 the postMessage() function on the plugin object.
11 -->
12 <head>
13 <title>Prerender Plugin Delay Loading</title>
15 <script>
16 // Make sure plugin was not loaded while prerendering.
17 function DidPrerenderPass() {
18 // |plugin| should be the blocked plugin placeholder, rather than the
19 // test plugin.
20 var plugin = window.document.getElementById('plugin');
21 return plugin.postMessage === undefined;
24 // Make sure the plugin briefly exists, then is replaced with a placeholder.
25 function AwaitPluginPrerollAndPlaceholder() {
26 var plugin = window.document.getElementById('plugin');
27 function handleEvent(event) {
28 // We should eventually get a message indicating that the plugin has been
29 // throttled and replaced with a static placeholder.
30 if (event.data.isThrottled && event.data.isHiddenForPlaceholder) {
31 plugin.removeEventListener('message', handleEvent);
32 window.domAutomationController.send(true);
36 plugin.addEventListener('message', handleEvent);
38 // If postMessage is not defined, the plugin is still the initial placeholder.
39 // When the real plugin loads, we will still get the initial power saver
40 // status notifications.
41 if (plugin.postMessage !== undefined) {
42 plugin.postMessage('getPowerSaverStatus');
45 </script>
47 </head>
48 <body>
50 <object id="plugin" type="application/x-ppapi-tests" height='100' width='100'>
51 </object>
53 </body>
54 </html>