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 InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSen
t; |
| 36 InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork); |
| 37 |
| 38 function didEnableNetwork(messageObject) |
| 39 { |
| 40 if (messageObject.error) { |
| 41 InspectorTest.log("FAIL: Couldn't enable network agent" + messageObj
ect.error.message); |
| 42 InspectorTest.completeTest(); |
| 43 return; |
| 44 } |
| 45 InspectorTest.log("Network agent enabled"); |
| 46 // FIXME(estark): use Runtime.evaluate callbacks instead of |
| 47 // firing these off all at once and tracking state in |
| 48 // onRequestWillBeSent(). |
| 49 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "noMixedCo
ntent()" }); |
| 50 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "blockable
MixedContent()" }); |
| 51 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "optionall
yBlockableMixedContent()" }); |
| 52 } |
| 53 |
| 54 var num_requests = 0; |
| 55 var num_expected_requests = 6; |
| 56 function onRequestWillBeSent(event) { |
| 57 var req = event.params.request; |
| 58 InspectorTest.log("Mixed content type of " + req.url + ": " + req.mixedC
ontentType); |
| 59 num_requests++; |
| 60 if (num_requests == num_expected_requests) |
| 61 InspectorTest.completeTest(); |
| 62 } |
| 63 } |
| 64 |
| 65 </script> |
| 66 </head> |
| 67 <body onload="runTest()"> |
| 68 <p>Tests that willSendRequest contains the correct mixed content status.</p> |
| 69 </body> |
| 70 </html> |
OLD | NEW |