| <!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> |
| <html> |
| <head> |
| <meta name="viewport" content="width=device-width"> |
| <script src="/js-test-resources/ui-helper.js"></script> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setShouldLogDownloadCallbacks(true); |
| testRunner.waitUntilDownloadFinished(); |
| testRunner.setShouldDownloadUndisplayableMIMETypes(true); |
| } |
| </script> |
| </head> |
| <body> |
| <p>The download should succeed.</p> |
| <a id="testLink">Download plugin</a> |
| <script> |
| const testURL = "/plugins/resources/mock-plugin-cacheable.pl"; |
| |
| function click(elmt) |
| { |
| if (!window.eventSender) { |
| alert('Click the link to run the test.'); |
| return; |
| } |
| UIHelper.activateAt(elmt.offsetLeft + 5, elmt.offsetTop + 5); |
| } |
| |
| function cacheTestResource(then) |
| { |
| let frame = document.createElement("iframe"); |
| frame.src = testURL; |
| frame.onload = then; |
| document.body.appendChild(frame); |
| } |
| |
| function runTest() |
| { |
| cacheTestResource(function() { |
| if (window.testRunner) |
| testRunner.setPluginsEnabled(false); |
| if (window.internals) |
| internals.clearMemoryCache(); |
| |
| let link = document.getElementById("testLink"); |
| testLink.href = testURL; |
| click(link); |
| }); |
| } |
| runTest(); |
| </script> |
| </body> |
| </html> |