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

Side by Side Diff: LayoutTests/fast/events/touch/touch-browser-zoom-scales-radius.html

Issue 990193002: Tweaks layoutTests to use eventSender.setTouchPointRadius correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: LayoutTests fixed (expected results) Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script> 5 <script>
6 var radiusX; 6 var radiusX;
7 var radiusY; 7 var radiusY;
8 8
9 function touchHandler(e) { 9 function touchHandler(e) {
10 var touch = e.touches[0]; 10 var touch = e.touches[0];
11 radiusX = touch.webkitRadiusX; 11 radiusX = touch.webkitRadiusX;
12 radiusY = touch.webkitRadiusY; 12 radiusY = touch.webkitRadiusY;
13 } 13 }
14 14
15 function endTest() 15 function endTest()
16 { 16 {
17 isSuccessfullyParsed(); 17 isSuccessfullyParsed();
18 testRunner.notifyDone(); 18 testRunner.notifyDone();
19 } 19 }
20 20
21 function sendTouchStart(x, y, radiusX, radiusY) 21 function sendTouchStart(x, y, radiusX, radiusY)
22 { 22 {
23 eventSender.clearTouchPoints(); 23 eventSender.clearTouchPoints();
24 eventSender.addTouchPoint(x, y, radiusX, radiusY); 24 eventSender.addTouchPoint(x, y);
25 if (eventSender.setTouchPointRadius)
26 eventSender.setTouchPointRadius(0, radiusX, radiusY, false);
25 eventSender.touchStart(); 27 eventSender.touchStart();
26 } 28 }
27 29
28 function runTest() { 30 function runTest() {
29 if (window.testRunner) 31 if (window.testRunner)
30 testRunner.waitUntilDone(); 32 testRunner.waitUntilDone();
31 33
32 if (window.eventSender) { 34 if (window.eventSender) {
33 description("This tests makes sure the touch event's radius " 35 description("This tests makes sure the touch event's radius "
34 + "property is scaled to account for browser zoom."); 36 + "property is scaled to account for browser zoom.");
35 37
36 document.body.addEventListener("touchstart", touchHandler); 38 document.body.addEventListener("touchstart", touchHandler);
37 39
38 debug("===Initial Zoom==="); 40 debug("===Initial Zoom===");
39 sendTouchStart(100, 100, 4, 10); 41 sendTouchStart(100, 100, 4, 10);
40 shouldBe("radiusX", "4"); 42 if (eventSender.setTouchPointRadius) {
41 shouldBe("radiusY", "10"); 43 shouldBe("radiusX", "4");
44 shouldBe("radiusY", "10");
45 }
42 46
43 window.internals.setZoomFactor(2.0); 47 window.internals.setZoomFactor(2.0);
44 48
45 debug("===Zoom 2X==="); 49 debug("===Zoom 2X===");
46 sendTouchStart(100, 100, 4, 10); 50 sendTouchStart(100, 100, 4, 10);
47 shouldBe("radiusX", "2"); 51 if (eventSender.setTouchPointRadius) {
48 shouldBe("radiusY", "5"); 52 shouldBe("radiusX", "2");
53 shouldBe("radiusY", "5");
54 }
49 55
50 window.internals.setZoomFactor(0.5); 56 window.internals.setZoomFactor(0.5);
51 57
52 debug("===Zoom 0.5X==="); 58 debug("===Zoom 0.5X===");
53 sendTouchStart(100, 100, 4, 10); 59 sendTouchStart(100, 100, 4, 10);
54 shouldBe("radiusX", "8"); 60 if (eventSender.setTouchPointRadius) {
55 shouldBe("radiusY", "20"); 61 shouldBe("radiusX", "8");
62 shouldBe("radiusY", "20");
63 }
56 64
57 65
58 endTest(); 66 endTest();
59 } else { 67 } else {
60 debug("This test requires DumpRenderTree. Tap on the blue rect to l og.") 68 debug("This test requires DumpRenderTree. Tap on the blue rect to l og.")
61 } 69 }
62 } 70 }
63 </script> 71 </script>
64 </head> 72 </head>
65 73
66 <body onload="runTest()"> 74 <body onload="runTest()">
67 <div id="console"></div> 75 <div id="console"></div>
68 </body> 76 </body>
69 </html> 77 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698