Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / plugins / get-url-notify-on-removal.html
blobd2a01bd8bf3bd29ca1c30f93ebab479757b16981
1 <html>
2 <body>
3 This tests that NPP_URLNotify gets called exactly once for canceled streams on plugin removal.
4 <div id="result">FAILURE</div>
5 <embed name="plg" type="application/x-webkit-test-netscape"></embed>
6 <script>
7 var callbackRun = false;
8 function callback()
10 if (callbackRun) {
11 result.textContent = "FAILURE - callback run twice";
12 return;
15 callbackRun = true;
16 result.textContent = "SUCCESS";
17 // Force the plugin to spin a nested event loop.
18 alert("Request completed");
19 // Don't stop the test until a small delay, in case callback is called again.
20 setTimeout(notify, 50);
22 function notify()
24 if (window.testRunner)
25 testRunner.notifyDone();
27 if (window.testRunner) {
28 testRunner.dumpAsText();
29 testRunner.waitUntilDone();
32 plg.getURLNotify("resources/slow-resource.pl", null, "callback");
33 // Remove the plugin after a short delay (to give the resource time to
34 // propagate through the system to the browser).
35 setTimeout(function() {
36 plg.parentNode.removeChild(plg);
37 }, 50);
38 </script>
39 </body>
40 </html>