| <html> |
| <body> |
| <script> |
| /* |
| This test page will attach an <embed> of size 0x0 and posts message to it to |
| verify that the BrowserPlugin and MimeHandlerViewContainer are created and |
| the extension properly loaded. This is for a regression in slides/ pages where |
| post messaging to <embed> should pop up print preview (only on Chrome). For |
| for context see https://crbug.com/763812. |
| */ |
| window.addEventListener('load', attachPdfAndPostMessage); |
| window.addEventListener('message', onMessageReceived); |
| |
| function attachPdfAndPostMessage() { |
| var e = document.createElement('embed'); |
| e.style.width = '0px'; |
| e.style.height = '0px'; |
| e.type = 'application/pdf'; |
| e.src = 'test.pdf'; |
| document.body.appendChild(e); |
| e.postMessage({type: 'getSelectedText'}); |
| } |
| |
| function onMessageReceived(msg) { |
| if (msg.data.type && msg.data.type === 'getSelectedTextReply') |
| window.domAutomationController.send('POST_MESSAGE_OK'); |
| } |
| |
| </script> |
| </body> |
| </html> |