Web Inspector: Page: re-add enable/disable after r248454
[WebKit-https.git] / LayoutTests / inspector / page / frameScheduledNavigation-async-delegates.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
4 <script>
5
6 if (window.testRunner && testRunner.setShouldDecideNavigationPolicyAfterDelay)
7     testRunner.setShouldDecideNavigationPolicyAfterDelay(true);
8
9 function load()
10 {
11     document.querySelector("iframe").src = "resources/blank.html";
12 }
13
14 function test()
15 {
16     InspectorProtocol.eventHandler["Page.frameScheduledNavigation"] = onScheduled;
17     InspectorProtocol.eventHandler["Page.frameStartedLoading"] = onStarted;
18     InspectorProtocol.eventHandler["Page.frameClearedScheduledNavigation"] = onCleared;
19     InspectorProtocol.sendCommand("Page.enable", {});
20
21     function onScheduled(msg)
22     {
23         ProtocolTest.log("Scheduled navigation with delay " + msg.params.delay);
24     }
25
26     function onStarted(msg)
27     {
28         ProtocolTest.log("Started loading");
29         ProtocolTest.wasStarted = true;
30         if (ProtocolTest.wasCleared)
31             ProtocolTest.completeTest();
32     }
33
34     function onCleared(msg)
35     {
36         ProtocolTest.log("Cleared scheduled navigation");
37         ProtocolTest.wasCleared = true;
38         if (ProtocolTest.wasStarted)
39             ProtocolTest.completeTest();
40     }
41
42     InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "load()" });
43 }
44
45 </script>
46 </head>
47 <body onload="runTest()">
48 <iframe>
49 </body>
50 </html>