Commit be8b51b8 authored by estark@chromium.org's avatar estark@chromium.org

Split up mixed content devtools test into 3 separate tests

When testing all three mixed content types in one test, the test was
flaky because DevTools received requestWillBeSent events in different
orders. Instead of making sure that the requests are always sent in the
same order, this CL splits up the test into 3 separate tests, one for
each mixed content type, with common code in
resources/mixed-content-type-test.js.

BUG=523500

Review URL: https://codereview.chromium.org/1303033004

git-svn-id: svn://svn.chromium.org/blink/trunk@201247 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0fb7c79b
......@@ -1517,7 +1517,6 @@ crbug.com/502927 [ XP ] paint/frames/frameset-with-stacking-context-and-not-stac
crbug.com/502927 [ XP ] paint/frames/frameset-with-stacking-contexts.html [ Failure ]
crbug.com/353746 virtual/android/fullscreen/video-specified-size.html [ ImageOnlyFailure Pass ]
crbug.com/523500 http/tests/inspector-protocol/request-mixed-content-status.html [ Failure Pass ]
crbug.com/524764 [ Win10 ] virtual/trustedeventsdefaultaction/fast/events/selectstart-prevent-selectall.html [ Failure Pass ]
crbug.com/524764 [ Win10 ] virtual/pointerevent/fast/events/selectstart-prevent-selectall.html [ Failure Pass ]
......
CONSOLE WARNING: Mixed Content: The page at 'https://127.0.0.1:8443/inspector-protocol/resources/active-mixed-content-iframe.html' was loaded over HTTPS, but requested an insecure script 'http://127.0.0.1:8000/inspector-protocol/resources/blank.js'. This content should also be served over HTTPS.
CONSOLE WARNING: Mixed Content: The page at 'https://127.0.0.1:8443/inspector-protocol/resources/passive-mixed-content-iframe.html' was loaded over HTTPS, but requested an insecure image 'http://127.0.0.1:8000/resources/square.png'. This content should also be served over HTTPS.
Tests that willSendRequest contains the correct mixed content status.
Tests that willSendRequest contains the correct mixed content status for active mixed content.
Network agent enabled
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/no-mixed-content-iframe.html: none
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/active-mixed-content-iframe.html: none
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/passive-mixed-content-iframe.html: none
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/blank.js: none
Mixed content type of http://127.0.0.1:8000/inspector-protocol/resources/blank.js: blockable
Mixed content type of http://127.0.0.1:8000/resources/square.png: optionally-blockable
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../inspector-protocol/inspector-protocol-test.js"></script>
<script src="/resources/get-host-info.js"></script>
<script src="resources/mixed-content-type-test.js"></script>
<script>
// The test() function is defined in mixed-content-type-test.js and
// calls this function to add mixed content to the page.
function addIframeWithMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/active-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
</script>
</head>
<body onload="runTest()">
<p>Tests that willSendRequest contains the correct mixed content status for active mixed content.</p>
</body>
</html>
Tests that willSendRequest contains the correct mixed content status for not-mixed content.
Network agent enabled
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/no-mixed-content-iframe.html: none
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/blank.js: none
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../inspector-protocol/inspector-protocol-test.js"></script>
<script src="/resources/get-host-info.js"></script>
<script src="resources/mixed-content-type-test.js"></script>
<script>
// The test() function is defined in mixed-content-type-test.js and
// calls this function to add mixed content to the page.
function addIframeWithMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/no-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
</script>
</head>
<body onload="runTest()">
<p>Tests that willSendRequest contains the correct mixed content status for not-mixed content.</p>
</body>
</html>
CONSOLE WARNING: Mixed Content: The page at 'https://127.0.0.1:8443/inspector-protocol/resources/passive-mixed-content-iframe.html' was loaded over HTTPS, but requested an insecure image 'http://127.0.0.1:8000/resources/square.png'. This content should also be served over HTTPS.
Tests that willSendRequest contains the correct mixed content status for passive mixed content.
Network agent enabled
Mixed content type of https://127.0.0.1:8443/inspector-protocol/resources/passive-mixed-content-iframe.html: none
Mixed content type of http://127.0.0.1:8000/resources/square.png: optionally-blockable
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../inspector-protocol/inspector-protocol-test.js"></script>
<script src="/resources/get-host-info.js"></script>
<script src="resources/mixed-content-type-test.js"></script>
<script>
// The test() function is defined in mixed-content-type-test.js and
// calls this function to add mixed content to the page.
function addIframeWithMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/passive-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
</script>
</head>
<body onload="runTest()">
<p>Tests that willSendRequest contains the correct mixed content status for passive mixed content.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../inspector-protocol/inspector-protocol-test.js"></script>
<script src="/resources/get-host-info.js"></script>
<script>
if (window.testRunner) {
testRunner.overridePreference("WebKitAllowRunningInsecureContent", true);
testRunner.overridePreference("WebKitAllowDisplayingInsecureContent", true);
}
function noMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/no-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
function blockableMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/active-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
function optionallyBlockableMixedContent()
{
var iframe = document.createElement("iframe");
iframe.src = get_host_info().HTTPS_ORIGIN + "/inspector-protocol/resources/passive-mixed-content-iframe.html";
document.body.appendChild(iframe);
}
function test()
{
InspectorTest.eventHandler["Network.requestWillBeSent"] = onRequestWillBeSent;
......@@ -43,28 +16,15 @@ function test()
return;
}
InspectorTest.log("Network agent enabled");
// FIXME(estark): use Runtime.evaluate callbacks instead of
// firing these off all at once and tracking state in
// onRequestWillBeSent().
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "noMixedContent()" });
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "blockableMixedContent()" });
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "optionallyBlockableMixedContent()" });
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "addIframeWithMixedContent()" });
}
var num_requests = 0;
var num_expected_requests = 6;
var numRequests = 0;
function onRequestWillBeSent(event) {
var req = event.params.request;
InspectorTest.log("Mixed content type of " + req.url + ": " + req.mixedContentType);
num_requests++;
if (num_requests == num_expected_requests)
numRequests++;
if (numRequests == 2)
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests that willSendRequest contains the correct mixed content status.</p>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment