Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html

Issue 2260773002: Convert image size and zoom level test to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert getSize to testSize. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html
diff --git a/third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html b/third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html
index 12728c1093e4934d0690c1dddf7fa98ec9ca97cf..8032c8e383368f5339be2424003f094818275837 100644
--- a/third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html
+++ b/third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size.html
@@ -1,49 +1,23 @@
<!DOCTYPE html>
-<html>
- <head>
- <style>
- #test_wrap {
- width: 250px;
- height: 166px;
- overflow: hidden;
- }
-
- #test_img {
- width: 100%;
- height: 100%;
- }
- </style>
- <script src="../../resources/js-test.js"></script>
- </head>
- <body>
- <div id="test_wrap">
- <img id="test_img" src="resources/green-256x256.jpg">
- </div>
- <p>
- Image should return a size of 250x166 regardless of zoom level.
- </p>
- <script>
- var imageElement = document.getElementById('test_img');
- var wrapElement = document.getElementById('test_wrap');
-
- function getSize(zoomLevel)
- {
- document.body.zoom = zoomLevel;
- return {
- imageWidth: imageElement.offsetWidth,
- imageHeight: imageElement.offsetHeight,
- wrapWidth: wrapElement.offsetWidth,
- wrapHeight: wrapElement.offsetHeight
- };
- }
-
- for (var i = 90; i <= 200; i += 5) {
- shouldBe('getSize(' + (i / 100) + ').imageWidth', '250');
- shouldBe('getSize(' + (i / 100) + ').imageHeight', '166');
- shouldBe('getSize(' + (i / 100) + ').wrapWidth', '250');
- shouldBe('getSize(' + (i / 100) + ').wrapHeight', '166');
- }
- document.body.zoom = 1.0;
- </script>
- </body>
-</html>
+<title>Image should return a size of 250x166 regardless of zoom level.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div style="height:166px; width:250px; overflow:hidden;">
+<img src="resources/green-256x256.jpg" style="width: 100%; height:100%">
+<script>
+test(function() {
+ document.body.zoom = 1.0;
fs 2016/08/19 08:24:04 I think the intention of this was to reset the zoo
sivag 2016/08/19 09:21:21 Done.
+ var imageElement = document.querySelector('img');
+ var wrapElement = document.querySelector('div');
+ function testSize(zoomLevel) {
+ document.body.zoom = zoomLevel;
fs 2016/08/19 08:24:03 I'm not aware of any 'zoom' property on HTMLBodyEl
sivag 2016/08/19 09:21:21 Ok, i tried using document.body.style.zoom, instea
fs 2016/08/19 09:38:18 Ok, well it kind of figures I guess =). How many o
+ assert_equals(imageElement.offsetWidth, 250);
+ assert_equals(imageElement.offsetHeight, 166);
+ assert_equals(wrapElement.offsetWidth, 250);
+ assert_equals(wrapElement.offsetHeight, 166);
+ }
+ for (var i = 90; i <= 200; i += 5) {
+ testSize(i/100);
+ }
fs 2016/08/19 08:24:04 You can drop the {}
sivag 2016/08/19 09:21:21 Done.
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/zoomed-offset-size-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698