OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); | 65 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); |
66 FrameTestHelpers::WebViewHelper webViewHelper; | 66 FrameTestHelpers::WebViewHelper webViewHelper; |
67 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); | 67 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); |
68 int pageWidth = 640; | 68 int pageWidth = 640; |
69 int pageHeight = 480; | 69 int pageHeight = 480; |
70 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 70 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
71 webViewImpl->layout(); | 71 webViewImpl->layout(); |
72 | 72 |
73 WebGestureEvent touchEvent; | 73 WebGestureEvent touchEvent; |
74 touchEvent.type = WebInputEvent::GestureShowPress; | 74 touchEvent.type = WebInputEvent::GestureShowPress; |
75 touchEvent.sourceDevice = WebGestureDeviceTouchpad; | |
Rick Byers
2015/10/19 18:20:29
Seems very weird to set touchpad here when it's cl
wjmaclean
2015/10/19 18:58:49
Done.
| |
75 | 76 |
76 // The coordinates below are linked to absolute positions in the referenced .html file. | 77 // The coordinates below are linked to absolute positions in the referenced .html file. |
77 touchEvent.x = 20; | 78 touchEvent.x = 20; |
78 touchEvent.y = 20; | 79 touchEvent.y = 20; |
79 | 80 |
80 ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEven t))); | 81 ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEven t))); |
81 | 82 |
82 touchEvent.y = 40; | 83 touchEvent.y = 40; |
83 EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEve nt))); | 84 EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEve nt))); |
84 | 85 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 FrameTestHelpers::WebViewHelper webViewHelper; | 136 FrameTestHelpers::WebViewHelper webViewHelper; |
136 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient()); | 137 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient()); |
137 | 138 |
138 int pageWidth = 640; | 139 int pageWidth = 640; |
139 int pageHeight = 480; | 140 int pageHeight = 480; |
140 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 141 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
141 webViewImpl->layout(); | 142 webViewImpl->layout(); |
142 | 143 |
143 WebGestureEvent touchEvent; | 144 WebGestureEvent touchEvent; |
144 touchEvent.type = WebInputEvent::GestureShowPress; | 145 touchEvent.type = WebInputEvent::GestureShowPress; |
146 touchEvent.sourceDevice = WebGestureDeviceTouchpad; | |
Rick Byers
2015/10/19 18:20:29
ditto
wjmaclean
2015/10/19 18:58:49
Done.
| |
145 touchEvent.x = 20; | 147 touchEvent.x = 20; |
146 touchEvent.y = 20; | 148 touchEvent.y = 20; |
147 | 149 |
148 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent); | 150 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent); |
149 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); | 151 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); |
150 ASSERT_TRUE(touchNode); | 152 ASSERT_TRUE(touchNode); |
151 | 153 |
152 webViewImpl->enableTapHighlightAtPoint(targetedEvent); | 154 webViewImpl->enableTapHighlightAtPoint(targetedEvent); |
153 ASSERT_TRUE(webViewImpl->linkHighlight(0)); | 155 ASSERT_TRUE(webViewImpl->linkHighlight(0)); |
154 | 156 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 IntRect boundingBox(touchEvent.x - touchEvent.data.tap.width / 2, touchEvent .y - touchEvent.data.tap.height / 2, touchEvent.data.tap.width, touchEvent.data. tap.height); | 190 IntRect boundingBox(touchEvent.x - touchEvent.data.tap.width / 2, touchEvent .y - touchEvent.data.tap.height / 2, touchEvent.data.tap.width, touchEvent.data. tap.height); |
189 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes); | 191 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes); |
190 | 192 |
191 webViewImpl->enableTapHighlights(highlightNodes); | 193 webViewImpl->enableTapHighlights(highlightNodes); |
192 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); | 194 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); |
193 | 195 |
194 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 196 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
195 } | 197 } |
196 | 198 |
197 } // namespace blink | 199 } // namespace blink |
OLD | NEW |