OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script type="text/javascript" src="../inspector-protocol/inspector-protocol-tes t.js"></script> | |
5 <script src="/resources/get-host-info.js"></script> | |
6 <script> | |
7 if (window.testRunner) { | |
8 testRunner.overridePreference("WebKitAllowRunningInsecureContent", true); | |
9 testRunner.overridePreference("WebKitAllowDisplayingInsecureContent", true); | |
10 } | |
11 | |
12 function noMixedContent() | |
13 { | |
14 var iframe = document.createElement("iframe"); | |
15 iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/n o-mixed-content-iframe.html"; | |
16 document.body.appendChild(iframe); | |
17 } | |
18 | |
19 function blockableMixedContent() | |
20 { | |
21 var iframe = document.createElement("iframe"); | |
22 iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/a ctive-mixed-content-iframe.html"; | |
23 document.body.appendChild(iframe); | |
24 } | |
25 | |
26 function optionallyBlockableMixedContent() | |
27 { | |
28 var iframe = document.createElement("iframe"); | |
29 iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/p assive-mixed-content-iframe.html"; | |
30 document.body.appendChild(iframe); | |
31 } | |
32 | |
33 function test() | |
34 { | |
35 var expectedMixedContentType = "none"; | |
36 InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSen t; | |
37 InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork); | |
38 | |
39 function didEnableNetwork(messageObject) | |
40 { | |
41 if (messageObject.error) { | |
42 InspectorTest.log("FAIL: Couldn't enable network agent" + messageObj ect.error.message); | |
43 InspectorTest.completeTest(); | |
44 return; | |
45 } | |
46 InspectorTest.log("Network agent enabled"); | |
47 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "noMixedCo ntent()" }); | |
48 } | |
49 | |
50 function onRequestWillBeSent(event) { | |
51 var req = event.params.request; | |
52 InspectorTest.log(req.url); | |
53 if (req.url.indexOf("check-mixed-content-status") === -1) | |
pfeldman
2015/08/19 17:10:19
You should dump into the log more aggressively, li
estark
2015/08/19 19:07:03
Done.
| |
54 return; | |
55 | |
56 if (req.mixedContentType !== expectedMixedContentType) { | |
57 InspectorTest.log("FAIL: expected mixed content " + expectedMixedCon tentType + ", got " + req.mixedContentStatus); | |
58 InspectorTest.completeTest(); | |
59 return; | |
60 } | |
61 | |
62 if (expectedMixedContentType == "none") { | |
63 expectedMixedContentType = "blockable"; | |
64 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "block ableMixedContent()" }); | |
65 } else if (expectedMixedContentType == "blockable") { | |
pfeldman
2015/08/19 17:10:19
So this is a small state machine that iterates ove
estark
2015/08/19 19:07:03
Hmm, I wasn't quite able to get this to work, beca
| |
66 expectedMixedContentType = "optionally-blockable"; | |
67 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "optio nallyBlockableMixedContent()" }); | |
68 } else if (expectedMixedContentType == "optionally-blockable") { | |
69 InspectorTest.completeTest(); | |
70 } | |
71 } | |
72 } | |
73 | |
74 </script> | |
75 </head> | |
76 <body onload="runTest()"> | |
77 <p>Tests that willSendRequest contains the correct mixed content status.</p> | |
78 </body> | |
79 </html> | |
OLD | NEW |