Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / touch-browser-zoom-scales-radius.html
blobde44c94966a43f946aaa2ad9c318cf1b69012f46
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6 var radiusX;
7 var radiusY;
9 function touchHandler(e) {
10 var touch = e.touches[0];
11 radiusX = touch.radiusX;
12 radiusY = touch.radiusY;
15 function endTest()
17 isSuccessfullyParsed();
18 testRunner.notifyDone();
21 function sendTouchStart(x, y, radiusX, radiusY)
23 eventSender.clearTouchPoints();
24 eventSender.addTouchPoint(x, y, radiusX, radiusY);
25 eventSender.touchStart();
28 function runTest() {
29 if (window.testRunner)
30 testRunner.waitUntilDone();
32 if (window.eventSender) {
33 description("This tests makes sure the touch event's radius "
34 + "property is scaled to account for browser zoom.");
36 document.body.addEventListener("touchstart", touchHandler);
38 debug("===Initial Zoom===");
39 sendTouchStart(100, 100, 4, 10);
40 shouldBe("radiusX", "4");
41 shouldBe("radiusY", "10");
43 window.internals.setZoomFactor(2.0);
45 debug("===Zoom 2X===");
46 sendTouchStart(100, 100, 4, 10);
47 shouldBe("radiusX", "2");
48 shouldBe("radiusY", "5");
50 window.internals.setZoomFactor(0.5);
52 debug("===Zoom 0.5X===");
53 sendTouchStart(100, 100, 4, 10);
54 shouldBe("radiusX", "8");
55 shouldBe("radiusY", "20");
58 endTest();
59 } else {
60 debug("This test requires DumpRenderTree. Tap on the blue rect to log.")
63 </script>
64 </head>
66 <body onload="runTest()">
67 <div id="console"></div>
68 </body>
69 </html>