<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
function runTest() {
    var t = async_test("duplicate density candidate elimination");
    setTimeout(t.step_func(function() {
        var dynamicImageSrc = document.getElementById("dynimg").currentSrc;
        var isBlue = (dynamicImageSrc.indexOf("blue_rect.jpg") != -1);
        var is4x = (dynamicImageSrc.indexOf("image-set-4x.png") != -1);
        assert_false(isBlue);
        assert_true(is4x);
        t.done();
    }), 0);
};

function imageInCache() {
     document.getElementsByTagName("div")[0].innerHTML="<img id='dynimg' srcset='resources/image-set-4x.png 1x, resources/blue_rect.jpg 1x' onload='runTest()' >";
 }
</script>
<div></div>
<img src="resources/blue_rect.jpg" onload="imageInCache()">

<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
function runTest() {
    var t = async_test("duplicate density candidate elimination");
    var img = document.body.appendChild(new Image());
    img.onload = t.step_func(function() {
        var dynamicImageSrc = document.getElementById("dynimg").currentSrc;
        var isBlue = (dynamicImageSrc.indexOf("blue_rect.jpg") != -1);
        var is4x = (dynamicImageSrc.indexOf("image-set-4x.png") != -1);
        assert_false(isBlue);
        assert_true(is4x);
        t.done();
    });
    img.id = "dynimg";
    img.srcset = "resources/image-set-4x.png 1x, resources/blue_rect.jpg 1x";
};
</script>
<img src="resources/blue_rect.jpg" onload="runTest()">

Fix test for duplicate srcset candidates
Fix test for duplicate srcset candidates

Fix the duplicate density candidates test for srcset
according to the comments on https://codereview.chromium.org/849653006/#msg9

BUG=449866

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

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@188635 bbb929c8-8fbe-4397-9dbb-9b2b20218538
