| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| </script> |
| <div> |
| <div>Test that plugin doesn't restart when taking it to full screen and back.</div> |
| <div id="result">Test didn't run</div> |
| <embed id="plugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed> |
| </div> |
| |
| <script> |
| function test() |
| { |
| var callback; |
| var fullscreenChanged = function(event) |
| { |
| if (callback) |
| callback(event) |
| }; |
| document.addEventListener('webkitfullscreenchange', fullscreenChanged); |
| |
| document.body.offsetTop; |
| var plugin = document.getElementById('plugin'); |
| var testObject = plugin.testObject; |
| testObject.property = 'foo'; // Verify that setting a property works before going fullscreen. |
| |
| var spanEnteredFullScreen = function(event) { |
| setTimeout(function () { |
| callback = function() { |
| |
| document.body.offsetTop; |
| try { |
| // This will throw if going to fullscreen and back has restarted the plugin. |
| testObject.property = 'foo'; |
| document.getElementById('result').innerHTML = 'SUCCESS'; |
| } catch (e) { |
| document.getElementById('result').innerHTML = 'FAIL'; |
| } |
| |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| document.webkitCancelFullScreen(); |
| }, 0); |
| }; |
| |
| callback = spanEnteredFullScreen; |
| |
| document.addEventListener('keydown', function () { |
| plugin.webkitRequestFullScreen(); |
| }); |
| if (window.eventSender) |
| eventSender.keyDown('a'); |
| } |
| |
| function checkForPlugin() |
| { |
| var plugin = document.getElementById('plugin'); |
| if (plugin.testObject) |
| test(); |
| else |
| setTimeout(checkForPlugin, 100); |
| } |
| |
| window.onload = checkForPlugin; |
| |
| </script> |