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

Unified Diff: LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom.html

Issue 23000005: Update window.devicePixelRatio on browser zoom (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom.html
diff --git a/LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom.html b/LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom.html
new file mode 100644
index 0000000000000000000000000000000000000000..f1eab09cc4d737b0c296312dfc772bc7e5aaaf9d
--- /dev/null
+++ b/LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="../../js/resources/js-test-pre.js"></script>
+ </head>
+ <body>
+ <p>
+ Tests that window.devicePixelRatio is updated on zoom.
+ </p>
+ <script>
+ // eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 instead
+ // of the zoom levels of the actual browser.
+ var ZOOM_MULTIPLIER = 1.2;
+
+ function round(n)
+ {
+ return Math.round(n * 100) / 100;
+ }
+
+ var expectedRatio = window.devicePixelRatio;
+ if (window.eventSender) {
+ for (var i = 0; i < 5; i++) {
+ eventSender.zoomPageOut();
+ expectedRatio /= ZOOM_MULTIPLIER;
+ shouldBe('round(window.devicePixelRatio)', String(round(expectedRatio)));
+ }
+ for (var i = 0; i < 10; i++) {
+ eventSender.zoomPageIn();
+ expectedRatio *= ZOOM_MULTIPLIER;
+ shouldBe('round(window.devicePixelRatio)', String(round(expectedRatio)));
+ }
+ }
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/device-pixel-ratio-on-zoom-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698