| Index: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/override-referrer.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/override-referrer.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/override-referrer.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3526740e615eb434d323e669975f1e965ea6306e
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/override-referrer.html
|
| @@ -0,0 +1,60 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="inspector-protocol-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + let referrers = [];
|
| +
|
| + InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSent;
|
| + enableNetwork();
|
| +
|
| + function enableNetwork()
|
| + {
|
| + InspectorTest.sendCommandOrDie("Network.enable", {}, didEnableNetwork);
|
| + }
|
| +
|
| + function didEnableNetwork()
|
| + {
|
| + // Prepare for a "reload" to avoid having the test harness loaded by
|
| + // image.html initiate the test again.
|
| + InspectorTest.evaluateInPage(
|
| + "prepareForReload(), window.location.href", navigate);
|
| + }
|
| +
|
| + function navigate(currentUrl)
|
| + {
|
| + let url = currentUrl.replace(
|
| + "override-referrer.html", "resources/image.html");
|
| + InspectorTest.sendCommandOrDie("Page.navigate", {
|
| + url: url,
|
| + referrer: "http://referrer.com/"
|
| + });
|
| + }
|
| +
|
| + function onRequestWillBeSent(event)
|
| + {
|
| + let params = event.params;
|
| + let referrer = params.request.headers.Referer;
|
| + if (!referrer)
|
| + return;
|
| +
|
| + referrers.push(InspectorTest.parseURL(referrer).host);
|
| + if (referrers.length === 2) {
|
| + // Only log the list the found referrers at the end of the test.
|
| + // Otherwise the first one will be lost because the target page is in
|
| + // the middle of loading.
|
| + InspectorTest.log("Referrers: " + JSON.stringify(referrers));
|
| + testRunner.logToStderr(JSON.stringify(referrers));
|
| + InspectorTest.completeTest();
|
| + }
|
| + }
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onload="runTest()">
|
| +<p>Tests that the navigation referrer can be overridden.</p>
|
| +</body>
|
| +</html>
|
|
|