Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / prerender / prerender_plugin_nacl_enabled.html
blob0e9e50a344b86a93ed2cde2e8ef96f5361fe966f
1 <html>
2 <!--
3 Make sure prerendered page load NaCl plugins when it's enabled.
4 -->
5 <head>
6 <title>Prerender NaCl Enabled</title>
7 </head>
8 <body>
10 <script>
11 var readyToSendResult = false;
12 var pluginLoadStarted = false;
14 /**
15 * Sends true if |readyToSendResult| and |pluginLoadStarted| are both true.
16 * Otherwise, does nothing.
18 function sendResult() {
19 if (!readyToSendResult || !pluginLoadStarted)
20 return;
21 window.domAutomationController.send(true);
22 readyToSendResult = false;
25 function eventListener(event) {
26 var targetElement = event.target;
27 if (event.target.id != 'naclPlugin')
28 return;
29 pluginLoadStarted = true;
30 sendResult();
33 document.body.addEventListener('loadstart', eventListener, true);
35 function DidPrerenderPass() {
36 return !pluginLoadStarted;
39 function DidDisplayPass() {
40 return true;
43 /**
44 * It's possible for DidDisplayPass to be called before the loadstart event
45 * happens, since the loadstart event is posted asynchronously when a plugin
46 * loads. As a result, we need to wait until we've seen both the loadstart
47 * event and been called from the browser process before we can safely send
48 * the real result.
50 function DidDisplayReallyPass() {
51 readyToSendResult = true;
52 sendResult();
54 </script>
56 <embed id="naclPlugin" type="application/x-nacl" src="dummy.nmf"></embed>
57 </body>
58 </html>