Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / device-pixel-ratio-on-zoom.html
blob04196ce453b7c13d63c65f264b499d1e3408bb0e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p>
8 Tests that window.devicePixelRatio is updated on zoom.
9 </p>
10 <script>
11 // eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 instead
12 // of the zoom levels of the actual browser.
13 var ZOOM_MULTIPLIER = 1.2;
15 function round(n)
17 return Math.round(n * 100) / 100;
20 var expectedRatio = window.devicePixelRatio;
21 if (window.eventSender) {
22 for (var i = 0; i < 5; i++) {
23 eventSender.zoomPageOut();
24 expectedRatio /= ZOOM_MULTIPLIER;
25 shouldBe('round(window.devicePixelRatio)', String(round(expectedRatio)));
27 for (var i = 0; i < 10; i++) {
28 eventSender.zoomPageIn();
29 expectedRatio *= ZOOM_MULTIPLIER;
30 shouldBe('round(window.devicePixelRatio)', String(round(expectedRatio)));
33 </script>
34 </body>
35 </html>