Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: LayoutTests/http/tests/inspector/console-fetch-logging.html

Issue 1259393002: DevTools: add support for logging fetch requests when XHR logging is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed the test Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/console-fetch-logging-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/console-fetch-logging.html
diff --git a/LayoutTests/http/tests/inspector/console-fetch-logging.html b/LayoutTests/http/tests/inspector/console-fetch-logging.html
new file mode 100644
index 0000000000000000000000000000000000000000..5371f26ed8b76b49bb474afe3724934eec7d0bb0
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/console-fetch-logging.html
@@ -0,0 +1,90 @@
+<html>
+<head>
+<script src="inspector-test.js"></script>
+<script src="console-test.js"></script>
+<script src="network-test.js"></script>
+<script>
+function requestHelper(method, url, callback)
+{
+ console.log("sending a " + method + " request to " + url);
+ // Delay invoking callback to let didFinishLoading() a chance to fire and log
+ // console message.
+ function delayCallback()
+ {
+ setTimeout(callback, 0);
+ }
+ makeFetch(url, {method: method}, delayCallback);
+}
+
+function makeRequests(callback)
+{
+ step1();
+
+ function step1()
+ {
+ // Page that exists.
+ requestHelper("GET", "resources/xhr-exists.html", step2);
+ }
+
+ function step2()
+ {
+ // Page that doesn't exist.
+ requestHelper("GET", "resources/xhr-does-not-exist.html", step3);
+ }
+
+ function step3()
+ {
+ // POST to a page.
+ requestHelper("POST", "resources/post-target.cgi", step4);
+ }
+
+ function step4()
+ {
+ // (Failed) cross-origin request
+ requestHelper("GET", "http://localhost:8000/inspector/resources/xhr-exists.html", callback);
+ }
+}
+
+function test()
+{
+ step1();
+
+ function step1()
+ {
+ function callback()
+ {
+ InspectorTest.invokePageFunctionAsync("makeRequests", step2);
+ }
+ InspectorTest.NetworkAgent.setMonitoringXHREnabled(true, callback);
+ }
+
+ function step2()
+ {
+ function callback()
+ {
+ InspectorTest.invokePageFunctionAsync("makeRequests", step3);
+ }
+ InspectorTest.NetworkAgent.setMonitoringXHREnabled(false, callback);
+ }
+
+ function step3()
+ {
+ function finish()
+ {
+ InspectorTest.dumpConsoleMessages();
+ InspectorTest.completeTest();
+ }
+ InspectorTest.runAfterPendingDispatches(finish);
+ }
+}
+//# sourceURL=console-fetch-logging.html
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that fetch logging works when XMLHttpRequest Logging is Enabled and doesn't show logs when it is Disabled.
+</p>
+
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/console-fetch-logging-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698