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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/ping-redirect.html

Issue 2586063002: DevTools: Show redirects from navigator.sendBeacon() (Closed)
Patch Set: Protocol test added Created 4 years 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
Index: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/ping-redirect.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/ping-redirect.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/ping-redirect.html
new file mode 100644
index 0000000000000000000000000000000000000000..76f7119fd1ee2ff59be9436a61c2f22b371523eb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/ping-redirect.html
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src="inspector-protocol-test.js"></script>
+<script>
+function sendBeacon()
+{
+ navigator.sendBeacon("resources/ping-redirect.php", "foo");
+}
+
+function test()
+{
+ var requestSent = 0;
+ InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSent;
+ enableNetwork();
+
+ function enableNetwork()
+ {
+ InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork);
+ }
+
+ function didEnableNetwork()
tyoshino (SeeGerritForStatus) 2017/01/10 05:21:39 some inspector-protocol tests are checking .error
allada 2017/01/10 07:14:16 Good point I forgot about this. We prefer to now u
tyoshino (SeeGerritForStatus) 2017/01/10 10:36:29 Sounds good!
ahmetemirercin 2017/01/11 08:38:38 Done.
+ {
+ InspectorTest.evaluateInPage("sendBeacon()");
+ }
+
+ function onRequestWillBeSent(event)
+ {
+ requestSent++;
+ var params = event.params;
+ InspectorTest.log("Request Sent: " + InspectorTest.parseURL(params.request.url).path);
+ if (requestSent == 2) {
+ var redirectSource = "";
+ if (params.redirectResponse)
+ redirectSource = InspectorTest.parseURL(params.redirectResponse.url).path;
+ InspectorTest.log("Redirect Source: " + redirectSource);
+ InspectorTest.completeTest();
+ }
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that redirect from navigator.sendBeacon() is recorded.</p>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698