Commit 21b4181d authored by Luna Lu's avatar Luna Lu Committed by Commit Bot

move wpt for intrinsicsize to the right directory

TBR: iclelland@chromium.org
Bug: 874629
Change-Id: Ia5346b73344bf33dd1446591b85acf0d6a608e9b
Reviewed-on: https://chromium-review.googlesource.com/1220091
Commit-Queue: Luna Lu <loonybear@chromium.org>
Reviewed-by: default avatarLuna Lu <loonybear@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590435}
parent 8ee01678
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" width="32" height="32"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" width="300" height="150"/>
</svg>
<svg width=400 height=400>
<image href="/feature-policy/experimental-features/resources/image.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" height="50" width="100"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" width="100" height="100"/>
</svg>
</body>
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<svg width=200 height=200>
<image href="/images/background.png" width="32" height="32"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=400 height=400>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" height="50" width="100"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="100" height="100"/>
</svg>
</body>
......@@ -4,21 +4,21 @@
<meta name="assert" content="test">
<body>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png"/>
<image href="/images/background.png"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" intrinsicsize="300x150"/>
<image href="/images/background.png" intrinsicsize="300x150"/>
</svg>
<svg width=400 height=400>
<image href="/feature-policy/experimental-features/resources/image.png" intrinsicsize="300x150"/>
<image href="/images/background.png" intrinsicsize="300x150"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" intrinsicsize="300x150" width="300"/>
<image href="/images/background.png" intrinsicsize="300x150" width="300"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" intrinsicsize="300x150" height="50"/>
<image href="/images/background.png" intrinsicsize="300x150" height="50"/>
</svg>
<svg width=200 height=200>
<image href="/feature-policy/experimental-features/resources/image.png" intrinsicsize="300x150" width="100" height="100"/>
<image href="/images/background.png" intrinsicsize="300x150" width="100" height="100"/>
</svg>
</body>
......@@ -6,9 +6,8 @@
'use strict';
const srcs = [
"/feature-policy/experimental-features/resources/image.svg",
"/feature-policy/experimental-features/resources/image.jpg",
"/feature-policy/experimental-features/resources/image.png",
"/images/green.svg",
"/images/green.png",
];
for (var src of srcs) {
......@@ -90,7 +89,7 @@ async_test(t => {
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = srcs[2] + ' 32w';
img.srcset = '/images/background.png 32w';
}, 'Test image (32 x 32) with sizes = 100 and srcset descriptor = 32w');
</script>
......
......@@ -6,9 +6,8 @@
'use strict';
const srcs = [
"/feature-policy/experimental-features/resources/image.svg",
"/feature-policy/experimental-features/resources/image.jpg",
"/feature-policy/experimental-features/resources/image.png",
"/images/green.svg",
"/images/green.png",
];
// Set new attribute, and wait til the media element is repainted.
......@@ -19,7 +18,6 @@ function updateAttribute(e, attribute, value) {
});
}
// Test intrinsicSize attribute with image element.
for (var src of srcs) {
promise_test(async() => {
var img = document.createElement('IMG');
......@@ -62,39 +60,7 @@ for (var src of srcs) {
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
}, 'Test image with src=' + src);
}, 'Test intrinsicsize for html image element, src=' + src);
}
// Test intrinsicSize attribute with video element.
promise_test(async() => {
var video = document.createElement('video');
document.body.appendChild(video);
video.src = "/feature-policy/experimental-features/resources/video.ogv";
await new Promise(resolve =>
video.addEventListener('canplaythrough', () => resolve(), {once: true}));
video.intrinsicSize = '400 x 500';
assert_equals(video.getBoundingClientRect().width, 400, 'width');
assert_equals(video.getBoundingClientRect().height, 500, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.width = '800';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 1000, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.style = 'height:800px;';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.removeAttribute('width');
assert_equals(video.getBoundingClientRect().width, 640, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
}, 'Test video');
</script>
</body>
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
promise_test(async() => {
var video = document.createElement('video');
document.body.appendChild(video);
video.src = "/images/pattern.ogv";
await new Promise(resolve =>
video.addEventListener('canplaythrough', () => resolve(), {once: true}));
video.intrinsicSize = '400 x 500';
assert_equals(video.getBoundingClientRect().width, 400, 'width');
assert_equals(video.getBoundingClientRect().height, 500, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.width = '800';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 1000, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.style = 'height:800px;';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.removeAttribute('width');
assert_equals(video.getBoundingClientRect().width, 640, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
}, 'Test intrinsicsize for html video element');
</script>
</body>
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