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

Side by Side Diff: third_party/WebKit/Source/web/LinkHighlightImplTest.cpp

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 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 /* 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 WebString::fromUTF8(baseURL.c_str()), 71 WebString::fromUTF8(baseURL.c_str()),
72 WebString::fromUTF8("test_touch_link_highlight.html")); 72 WebString::fromUTF8("test_touch_link_highlight.html"));
73 FrameTestHelpers::WebViewHelper webViewHelper; 73 FrameTestHelpers::WebViewHelper webViewHelper;
74 WebViewImpl* webViewImpl = 74 WebViewImpl* webViewImpl =
75 webViewHelper.initializeAndLoad(baseURL + fileName, true); 75 webViewHelper.initializeAndLoad(baseURL + fileName, true);
76 int pageWidth = 640; 76 int pageWidth = 640;
77 int pageHeight = 480; 77 int pageHeight = 480;
78 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 78 webViewImpl->resize(WebSize(pageWidth, pageHeight));
79 webViewImpl->updateAllLifecyclePhases(); 79 webViewImpl->updateAllLifecyclePhases();
80 80
81 WebGestureEvent touchEvent; 81 WebGestureEvent touchEvent(WebInputEvent::GestureShowPress,
82 touchEvent.type = WebInputEvent::GestureShowPress; 82 WebInputEvent::NoModifiers,
83 WebInputEvent::TimeStampForTesting);
83 touchEvent.sourceDevice = WebGestureDeviceTouchscreen; 84 touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
84 85
85 // The coordinates below are linked to absolute positions in the referenced 86 // The coordinates below are linked to absolute positions in the referenced
86 // .html file. 87 // .html file.
87 touchEvent.x = 20; 88 touchEvent.x = 20;
88 touchEvent.y = 20; 89 touchEvent.y = 20;
89 90
90 ASSERT_TRUE( 91 ASSERT_TRUE(
91 webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent))); 92 webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent)));
92 93
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 WebString::fromUTF8("test_touch_link_highlight.html")); 149 WebString::fromUTF8("test_touch_link_highlight.html"));
149 FrameTestHelpers::WebViewHelper webViewHelper; 150 FrameTestHelpers::WebViewHelper webViewHelper;
150 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad( 151 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
151 baseURL + fileName, true, 0, compositingWebViewClient()); 152 baseURL + fileName, true, 0, compositingWebViewClient());
152 153
153 int pageWidth = 640; 154 int pageWidth = 640;
154 int pageHeight = 480; 155 int pageHeight = 480;
155 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 156 webViewImpl->resize(WebSize(pageWidth, pageHeight));
156 webViewImpl->updateAllLifecyclePhases(); 157 webViewImpl->updateAllLifecyclePhases();
157 158
158 WebGestureEvent touchEvent; 159 WebGestureEvent touchEvent(WebInputEvent::GestureShowPress,
159 touchEvent.type = WebInputEvent::GestureShowPress; 160 WebInputEvent::NoModifiers,
161 WebInputEvent::TimeStampForTesting);
160 touchEvent.sourceDevice = WebGestureDeviceTouchscreen; 162 touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
161 touchEvent.x = 20; 163 touchEvent.x = 20;
162 touchEvent.y = 20; 164 touchEvent.y = 20;
163 165
164 GestureEventWithHitTestResults targetedEvent = 166 GestureEventWithHitTestResults targetedEvent =
165 getTargetedEvent(webViewImpl, touchEvent); 167 getTargetedEvent(webViewImpl, touchEvent);
166 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); 168 Node* touchNode = webViewImpl->bestTapNode(targetedEvent);
167 ASSERT_TRUE(touchNode); 169 ASSERT_TRUE(touchNode);
168 170
169 webViewImpl->enableTapHighlightAtPoint(targetedEvent); 171 webViewImpl->enableTapHighlightAtPoint(targetedEvent);
(...skipping 25 matching lines...) Expand all
195 WebString::fromUTF8("test_touch_link_highlight.html")); 197 WebString::fromUTF8("test_touch_link_highlight.html"));
196 FrameTestHelpers::WebViewHelper webViewHelper; 198 FrameTestHelpers::WebViewHelper webViewHelper;
197 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad( 199 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
198 baseURL + fileName, true, 0, webViewClient.get()); 200 baseURL + fileName, true, 0, webViewClient.get());
199 201
200 int pageWidth = 640; 202 int pageWidth = 640;
201 int pageHeight = 480; 203 int pageHeight = 480;
202 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 204 webViewImpl->resize(WebSize(pageWidth, pageHeight));
203 webViewImpl->updateAllLifecyclePhases(); 205 webViewImpl->updateAllLifecyclePhases();
204 206
205 WebGestureEvent touchEvent; 207 WebGestureEvent touchEvent(WebInputEvent::GestureShowPress,
206 touchEvent.type = WebInputEvent::GestureShowPress; 208 WebInputEvent::NoModifiers,
209 WebInputEvent::TimeStampForTesting);
207 touchEvent.sourceDevice = WebGestureDeviceTouchscreen; 210 touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
208 touchEvent.x = 20; 211 touchEvent.x = 20;
209 touchEvent.y = 20; 212 touchEvent.y = 20;
210 213
211 GestureEventWithHitTestResults targetedEvent = 214 GestureEventWithHitTestResults targetedEvent =
212 getTargetedEvent(webViewImpl, touchEvent); 215 getTargetedEvent(webViewImpl, touchEvent);
213 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); 216 Node* touchNode = webViewImpl->bestTapNode(targetedEvent);
214 ASSERT_TRUE(touchNode); 217 ASSERT_TRUE(touchNode);
215 218
216 webViewImpl->enableTapHighlightAtPoint(targetedEvent); 219 webViewImpl->enableTapHighlightAtPoint(targetedEvent);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 goodTargets, highlightNodes); 263 goodTargets, highlightNodes);
261 264
262 webViewImpl->enableTapHighlights(highlightNodes); 265 webViewImpl->enableTapHighlights(highlightNodes);
263 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); 266 EXPECT_EQ(2U, webViewImpl->numLinkHighlights());
264 267
265 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 268 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
266 WebCache::clear(); 269 WebCache::clear();
267 } 270 }
268 271
269 } // namespace blink 272 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698