| <!-- webkit-test-runner [ enableBackForwardCache=true ] --> |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| description('Tests that a page with a MediaKeySession goes into the back/forward cache.'); |
| jsTestIsAsync = true; |
| |
| window.addEventListener("pageshow", function(event) { |
| debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache"); |
| if (event.persisted) { |
| testPassed("Page was restored from back/forward cache"); |
| finishJSTest(); |
| } |
| }); |
| |
| window.addEventListener("pagehide", function(event) { |
| debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache"); |
| if (!event.persisted) { |
| testFailed("Page failed to enter the back/forward cache"); |
| finishJSTest(); |
| } |
| }); |
| |
| onload = () => { |
| mediaKeys = new WebKitMediaKeys('org.w3c.clearkey'); |
| session = mediaKeys.createSession('application/x-mpegurl', new Uint8Array(1)); |
| shouldBeTrue("!!session"); |
| setTimeout(() => { |
| testLink.click(); |
| }, 0); |
| } |
| </script> |
| <a id="testLink" href="resources/page-cache-helper.html" style="display: none">Link</a> |
| </body> |
| </html> |