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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 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 /* 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEven t))); 80 ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEven t)));
81 81
82 touchEvent.y = 40; 82 touchEvent.y = 40;
83 EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEve nt))); 83 EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEve nt)));
84 84
85 touchEvent.y = 20; 85 touchEvent.y = 20;
86 // Shouldn't crash. 86 // Shouldn't crash.
87 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent)); 87 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent));
88 88
89 EXPECT_TRUE(webViewImpl->linkHighlight(0)); 89 EXPECT_TRUE(webViewImpl->getLinkHighlight(0));
90 EXPECT_TRUE(webViewImpl->linkHighlight(0)->contentLayer()); 90 EXPECT_TRUE(webViewImpl->getLinkHighlight(0)->contentLayer());
91 EXPECT_TRUE(webViewImpl->linkHighlight(0)->clipLayer()); 91 EXPECT_TRUE(webViewImpl->getLinkHighlight(0)->clipLayer());
92 92
93 // Find a target inside a scrollable div 93 // Find a target inside a scrollable div
94 touchEvent.y = 100; 94 touchEvent.y = 100;
95 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent)); 95 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent));
96 ASSERT_TRUE(webViewImpl->linkHighlight(0)); 96 ASSERT_TRUE(webViewImpl->getLinkHighlight(0));
97 97
98 // Don't highlight if no "hand cursor" 98 // Don't highlight if no "hand cursor"
99 touchEvent.y = 220; // An A-link with cross-hair cursor. 99 touchEvent.y = 220; // An A-link with cross-hair cursor.
100 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent)); 100 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent));
101 ASSERT_EQ(0U, webViewImpl->numLinkHighlights()); 101 ASSERT_EQ(0U, webViewImpl->numLinkHighlights());
102 102
103 touchEvent.y = 260; // A text input box. 103 touchEvent.y = 260; // A text input box.
104 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent)); 104 webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEv ent));
105 ASSERT_EQ(0U, webViewImpl->numLinkHighlights()); 105 ASSERT_EQ(0U, webViewImpl->numLinkHighlights());
106 106
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 touchEvent.type = WebInputEvent::GestureShowPress; 144 touchEvent.type = WebInputEvent::GestureShowPress;
145 touchEvent.sourceDevice = WebGestureDeviceTouchscreen; 145 touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
146 touchEvent.x = 20; 146 touchEvent.x = 20;
147 touchEvent.y = 20; 147 touchEvent.y = 20;
148 148
149 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent); 149 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent);
150 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); 150 Node* touchNode = webViewImpl->bestTapNode(targetedEvent);
151 ASSERT_TRUE(touchNode); 151 ASSERT_TRUE(touchNode);
152 152
153 webViewImpl->enableTapHighlightAtPoint(targetedEvent); 153 webViewImpl->enableTapHighlightAtPoint(targetedEvent);
154 ASSERT_TRUE(webViewImpl->linkHighlight(0)); 154 ASSERT_TRUE(webViewImpl->getLinkHighlight(0));
155 155
156 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight(0)->currentGraphi csLayerForTesting(); 156 GraphicsLayer* highlightLayer = webViewImpl->getLinkHighlight(0)->currentGra phicsLayerForTesting();
157 ASSERT_TRUE(highlightLayer); 157 ASSERT_TRUE(highlightLayer);
158 EXPECT_TRUE(highlightLayer->linkHighlight(0)); 158 EXPECT_TRUE(highlightLayer->getLinkHighlight(0));
159 159
160 touchNode->remove(IGNORE_EXCEPTION); 160 touchNode->remove(IGNORE_EXCEPTION);
161 webViewImpl->updateAllLifecyclePhases(); 161 webViewImpl->updateAllLifecyclePhases();
162 ASSERT_EQ(0U, highlightLayer->numLinkHighlights()); 162 ASSERT_EQ(0U, highlightLayer->numLinkHighlights());
163 163
164 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 164 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
165 } 165 }
166 166
167 // A lifetime test: delete LayerTreeView while running LinkHighlights. 167 // A lifetime test: delete LayerTreeView while running LinkHighlights.
168 TEST(LinkHighlightImplTest, resetLayerTreeView) 168 TEST(LinkHighlightImplTest, resetLayerTreeView)
(...skipping 16 matching lines...) Expand all
185 touchEvent.type = WebInputEvent::GestureShowPress; 185 touchEvent.type = WebInputEvent::GestureShowPress;
186 touchEvent.sourceDevice = WebGestureDeviceTouchscreen; 186 touchEvent.sourceDevice = WebGestureDeviceTouchscreen;
187 touchEvent.x = 20; 187 touchEvent.x = 20;
188 touchEvent.y = 20; 188 touchEvent.y = 20;
189 189
190 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent); 190 GestureEventWithHitTestResults targetedEvent = getTargetedEvent(webViewImpl, touchEvent);
191 Node* touchNode = webViewImpl->bestTapNode(targetedEvent); 191 Node* touchNode = webViewImpl->bestTapNode(targetedEvent);
192 ASSERT_TRUE(touchNode); 192 ASSERT_TRUE(touchNode);
193 193
194 webViewImpl->enableTapHighlightAtPoint(targetedEvent); 194 webViewImpl->enableTapHighlightAtPoint(targetedEvent);
195 ASSERT_TRUE(webViewImpl->linkHighlight(0)); 195 ASSERT_TRUE(webViewImpl->getLinkHighlight(0));
196 196
197 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight(0)->currentGraphi csLayerForTesting(); 197 GraphicsLayer* highlightLayer = webViewImpl->getLinkHighlight(0)->currentGra phicsLayerForTesting();
198 ASSERT_TRUE(highlightLayer); 198 ASSERT_TRUE(highlightLayer);
199 EXPECT_TRUE(highlightLayer->linkHighlight(0)); 199 EXPECT_TRUE(highlightLayer->getLinkHighlight(0));
200 200
201 // Mimic the logic from RenderWidget::Close: 201 // Mimic the logic from RenderWidget::Close:
202 webViewImpl->willCloseLayerTreeView(); 202 webViewImpl->willCloseLayerTreeView();
203 webViewHelper.reset(); 203 webViewHelper.reset();
204 204
205 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 205 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
206 } 206 }
207 207
208 TEST(LinkHighlightImplTest, multipleHighlights) 208 TEST(LinkHighlightImplTest, multipleHighlights)
209 { 209 {
(...skipping 20 matching lines...) Expand all
230 IntRect boundingBox(touchEvent.x - touchEvent.data.tap.width / 2, touchEvent .y - touchEvent.data.tap.height / 2, touchEvent.data.tap.width, touchEvent.data. tap.height); 230 IntRect boundingBox(touchEvent.x - touchEvent.data.tap.width / 2, touchEvent .y - touchEvent.data.tap.height / 2, touchEvent.data.tap.width, touchEvent.data. tap.height);
231 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes); 231 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes);
232 232
233 webViewImpl->enableTapHighlights(highlightNodes); 233 webViewImpl->enableTapHighlights(highlightNodes);
234 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); 234 EXPECT_EQ(2U, webViewImpl->numLinkHighlights());
235 235
236 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 236 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
237 } 237 }
238 238
239 } // namespace blink 239 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LinkHighlightImpl.cpp ('k') | third_party/WebKit/Source/web/PageOverlayTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698