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> |
+ |