5fc883fb20bfe6272849e7819e6c249191f090a3
[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
20     function onScheduled(msg)
21     {
22         ProtocolTest.log("Scheduled navigation with delay " + msg.params.delay);
23     }
24
25     function onStarted(msg)
26     {
27         ProtocolTest.log("Started loading");
28         ProtocolTest.wasStarted = true;
29         if (ProtocolTest.wasCleared)
30             ProtocolTest.completeTest();
31     }
32
33     function onCleared(msg)
34     {
35         ProtocolTest.log("Cleared scheduled navigation");
36         ProtocolTest.wasCleared = true;
37         if (ProtocolTest.wasStarted)
38             ProtocolTest.completeTest();
39     }
40
41     InspectorProtocol.sendCommand("Runtime.evaluate", { "expression": "load()" });
42 }
43
44 </script>
45 </head>
46 <body onload="runTest()">
47 <iframe>
48 </body>
49 </html>