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 activeMixedContent() |
| 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 passiveMixedContent() |
| 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 expectedMixedContentStatus = "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) |
| 54 return; |
| 55 |
| 56 if (req.mixedContentStatus !== expectedMixedContentStatus) { |
| 57 InspectorTest.log("FAIL: expected mixed content " + expectedMixedCon
tentStatus + ", got " + req.mixedContentStatus); |
| 58 InspectorTest.completeTest(); |
| 59 return; |
| 60 } |
| 61 |
| 62 if (expectedMixedContentStatus == "none") { |
| 63 expectedMixedContentStatus = "active"; |
| 64 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "activ
eMixedContent()" }); |
| 65 } else if (expectedMixedContentStatus == "active") { |
| 66 expectedMixedContentStatus = "passive"; |
| 67 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "passi
veMixedContent()" }); |
| 68 } else if (expectedMixedContentStatus == "passive") { |
| 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 |