Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / inspector / console-fetch-logging.html
blob5371f26ed8b76b49bb474afe3724934eec7d0bb0
1 <html>
2 <head>
3 <script src="inspector-test.js"></script>
4 <script src="console-test.js"></script>
5 <script src="network-test.js"></script>
6 <script>
7 function requestHelper(method, url, callback)
9 console.log("sending a " + method + " request to " + url);
10 // Delay invoking callback to let didFinishLoading() a chance to fire and log
11 // console message.
12 function delayCallback()
14 setTimeout(callback, 0);
16 makeFetch(url, {method: method}, delayCallback);
19 function makeRequests(callback)
21 step1();
23 function step1()
25 // Page that exists.
26 requestHelper("GET", "resources/xhr-exists.html", step2);
29 function step2()
31 // Page that doesn't exist.
32 requestHelper("GET", "resources/xhr-does-not-exist.html", step3);
35 function step3()
37 // POST to a page.
38 requestHelper("POST", "resources/post-target.cgi", step4);
41 function step4()
43 // (Failed) cross-origin request
44 requestHelper("GET", "http://localhost:8000/inspector/resources/xhr-exists.html", callback);
48 function test()
50 step1();
52 function step1()
54 function callback()
56 InspectorTest.invokePageFunctionAsync("makeRequests", step2);
58 InspectorTest.NetworkAgent.setMonitoringXHREnabled(true, callback);
61 function step2()
63 function callback()
65 InspectorTest.invokePageFunctionAsync("makeRequests", step3);
67 InspectorTest.NetworkAgent.setMonitoringXHREnabled(false, callback);
70 function step3()
72 function finish()
74 InspectorTest.dumpConsoleMessages();
75 InspectorTest.completeTest();
77 InspectorTest.runAfterPendingDispatches(finish);
80 //# sourceURL=console-fetch-logging.html
81 </script>
82 </head>
84 <body onload="runTest()">
85 <p>
86 Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn't show logs when it is Disabled.
87 </p>
89 </body>
90 </html>