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

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: Add new test expectations. 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..619045f4b14d2f20d7ef1d27c25fd289c3c9adbb 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,22 @@
<!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() {
+ var imageElement = document.querySelector('img');
+ var wrapElement = document.querySelector('div');
+ function testSize(zoomLevel) {
+ document.body.style.zoom = zoomLevel;
+ 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);
+ document.body.style.zoom = 1.0;
+});
+</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