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> |