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

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

Issue 2603593002: Expose per-request referrer policy in devtools (Closed)
Patch Set: updates Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-protocol/request-referrer-policy-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../inspector-protocol/inspector-protocol-test.js"></script>
3 <script src="/resources/get-host-info.js"></script>
4 <script>
5 function sendRequest(policy) {
6 var img = document.createElement("img");
7 img.referrerPolicy = policy;
8 img.src = "/resources/square.png?" + Math.random();
9 document.body.appendChild(img);
10 }
11
12 function test() {
13 var policy_num = 0;
14 var policies = [
15 "unsafe-url", "no-referrer-when-downgrade", "no-referrer", "origin",
16 "origin-when-cross-origin"
17 ];
18
19 InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSent;
20 InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork);
21
22 function onRequestWillBeSent(evt) {
23 var req = evt.params.request;
24 if (req.referrerPolicy == policies[policy_num]) {
25 InspectorTest.log("PASS: Request with expected policy " +
26 policies[policy_num] + " observed");
27 } else {
28 InspectorTest.log("FAIL: Request with policy " + req.referrerPolicy +
29 " observed (expected " + policies[policy_num] + ")");
30 }
31 policy_num++;
32 if (policy_num >= policies.length) {
33 InspectorTest.completeTest();
34 } else {
35 InspectorTest.sendCommand(
36 "Runtime.evaluate",
37 {"expression" : "sendRequest('" + policies[policy_num] + "')"});
38 }
39 }
40
41 function didEnableNetwork(messageObject) {
42 if (messageObject.error) {
43 InspectorTest.log("FAIL: Couldn't enable network agent " +
44 messageObject.error.message);
45 InspectorTest.completeTest();
46 return;
47 }
48 InspectorTest.log("Network agent enabled");
49 InspectorTest.sendCommand(
50 "Runtime.evaluate",
51 {"expression" : "sendRequest('" + policies[policy_num] + "')"});
52 }
53 }
54 </script>
55 <body onload="runTest()">
56 <p>
57 Tests that network requests are annotated with the correct referrer
58 policy.
59 </p>
60 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-protocol/request-referrer-policy-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698