Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / touch-links-two-finger-tap.html
blob178e15148f34bb7459a8efa8d51da7431ec6ba4e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Touch Adjustment : Testing that a context menu will appear on a two-finger tap - bug 99947</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/touchadjustment.js"></script>
7 <style>
8 #sandbox {
9 position: absolute;
10 left: 0px;
11 top: 0px;
13 </style>
14 </head>
16 <body>
18 <div id="sandbox">
19 <p><a href="" id="link1">I</a> propose to consider <a href="" id="link2">the question</a>, "Can machines think?"<br>This should begin with definitions of the meaning of the terms "machine" and <a href="" id="link3">"think."</a></p>
20 </div>
22 <p id='description'></p>
23 <div id='console'></div>
25 <script>
26 var element;
27 var adjustedNode;
28 // Set up shortcut access to elements
29 var e = {};
30 ['sandbox', 'link1', 'link2', 'link3'].forEach(function(a) {
31 e[a] = document.getElementById(a);
32 });
34 document.oncontextmenu = function() { debug("PASS"); }
36 function testTwoFingerTap(touchpoint)
38 if (eventSender.gestureTwoFingerTap)
39 eventSender.gestureTwoFingerTap(touchpoint.x, touchpoint.y, touchpoint.width, touchpoint.height);
40 else
41 debug("gestureTwoFingerTap not implemented by this platform.");
44 function testDirectTouch(element)
46 // Touch directly in the center of the element.
47 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 20, 30);
48 if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element)
49 testFailed('Direct touch ended up on some other element');
50 testTwoFingerTap(touchpoint);
53 function testIndirectTouch(element)
55 // Touch just right of the element.
56 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'right', 10, 30, 20);
57 if (isDescendantOf(element, document.elementFromPoint(touchpoint.x, touchpoint.y)))
58 testFailed('Indirect touch ended up still on top of the element');
59 testTwoFingerTap(touchpoint);
62 function isDescendantOf(parent, child)
64 var n = child;
65 while (n) {
66 if (n == parent)
67 return true;
68 n = n.parentNode;
70 return false;
73 function testDirectTouches()
75 debug('Testing direct hits.');
76 testDirectTouch(e.link1);
77 testDirectTouch(e.link2);
78 testDirectTouch(e.link3);
81 function testIndirectTouches()
83 debug('Testing indirect hits.');
84 testIndirectTouch(e.link1);
85 testIndirectTouch(e.link2);
86 testIndirectTouch(e.link3);
89 function runTests()
91 if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
92 description('Tests if a two finger tap gesture on links will trigger a context menu when touch adjustment is used.');
93 testDirectTouches();
94 testIndirectTouches();
95 e.sandbox.style.display = 'none';
98 runTests();
99 </script>
100 </body>
101 </html>