Commit 2c9b6d1c authored by yoav@yoav.ws's avatar yoav@yoav.ws

Test that only the right resource is loaded in iframes.

Adding a couple of tests to make sure that the right resource is loaded when srcset is inside an iframe, and that *only* the right resource is loaded.

BUG=425909

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

git-svn-id: svn://svn.chromium.org/blink/trunk@184373 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7293599a
PASS window.internals.isLoadingFromMemoryCache("resources/image-set-4x.png") is false
PASS window.internals.isLoadingFromMemoryCache("resources/blue_rect.jpg") is true
PASS successfullyParsed is true
TEST COMPLETE
PASS window.internals.isLoadingFromMemoryCache("resources/image-set-4x.png") is false
PASS window.internals.isLoadingFromMemoryCache("resources/blue_rect.jpg") is true
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
var img;
var jsTestIsAsync = true;
if (window.internals)
internals.evictAllResources();
window.addEventListener("message", function() {
if (window.internals) {
shouldBeFalse('window.internals.isLoadingFromMemoryCache("resources/image-set-4x.png")');
shouldBeTrue('window.internals.isLoadingFromMemoryCache("resources/blue_rect.jpg")');
}
finishJSTest();
});
</script>
<iframe id="frame" style="width: 80px;" src="resources/srcset_iframe.html"></iframe>
</script>
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
var img;
var jsTestIsAsync = true;
if (window.internals)
internals.evictAllResources();
window.addEventListener("message", function() {
if (window.internals) {
shouldBeFalse('window.internals.isLoadingFromMemoryCache("resources/image-set-4x.png")');
shouldBeTrue('window.internals.isLoadingFromMemoryCache("resources/blue_rect.jpg")');
}
finishJSTest();
});
</script>
<iframe id="frame" style="width: 80px;"></iframe>
<script>
var iframe = document.getElementById('frame');
var iframeDoc = iframe.contentWindow.document;
iframeDoc.body.innerHTML = '<img id="srcset" srcset="resources/blue_rect.jpg 90w, resources/image-set-4x.png 120w">';
var img = iframeDoc.getElementById('srcset');
img.onload = function() {
window.parent.postMessage("loaded", "*");
};
</script>
<img id="srcset" srcset="blue_rect.jpg 90w, image-set-4x.png 120w">
<script>
var img = document.getElementById('srcset');
img.onload = function() {
window.parent.postMessage("loaded", "*");
};
</script>
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