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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/override-referrer.html

Issue 2703253002: devtools: Make it possible to override the navigation referrer (Closed)
Patch Set: Reworked into a inspector protocol test Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="inspector-protocol-test.js"></script>
5 <script>
6
7 function test()
8 {
9 let referrers = [];
10
11 InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSen t;
12 enableNetwork();
13
14 function enableNetwork()
15 {
16 InspectorTest.sendCommandOrDie("Network.enable", {}, didEnableNetwork);
17 }
18
19 function didEnableNetwork()
20 {
21 // Prepare for a "reload" to avoid having the test harness loaded by
22 // image.html initiate the test again.
23 InspectorTest.evaluateInPage(
24 "prepareForReload(), window.location.href", navigate);
25 }
26
27 function navigate(currentUrl)
28 {
29 let url = currentUrl.replace(
30 "override-referrer.html", "resources/image.html");
31 InspectorTest.sendCommandOrDie("Page.navigate", {
32 url: url,
33 referrer: "http://referrer.com/"
34 });
35 }
36
37 function onRequestWillBeSent(event)
38 {
39 let params = event.params;
40 let referrer = params.request.headers.Referer;
41 if (!referrer)
42 return;
43
44 referrers.push(InspectorTest.parseURL(referrer).host);
45 if (referrers.length === 2) {
46 // Only log the list the found referrers at the end of the test.
47 // Otherwise the first one will be lost because the target page is in
48 // the middle of loading.
49 InspectorTest.log("Referrers: " + JSON.stringify(referrers));
50 testRunner.logToStderr(JSON.stringify(referrers));
51 InspectorTest.completeTest();
52 }
53 }
54 }
55 </script>
56 </head>
57 <body onload="runTest()">
58 <p>Tests that the navigation referrer can be overridden.</p>
59 </body>
60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698