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

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

Issue 1415143005: Preparation for enabling slimming paint synchronized painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 namespace blink { 52 namespace blink {
53 53
54 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes tureEvent& touchEvent) 54 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes tureEvent& touchEvent)
55 { 55 {
56 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent); 56 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent);
57 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe tGestureEvent(platformEvent, true); 57 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe tGestureEvent(platformEvent, true);
58 } 58 }
59 59
60 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration) 60 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration)
61 { 61 {
62 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
Xianzhu 2015/10/28 18:10:23 This is added because we can't paint scrollbars us
63
62 const std::string baseURL("http://www.test.com/"); 64 const std::string baseURL("http://www.test.com/");
63 const std::string fileName("test_touch_link_highlight.html"); 65 const std::string fileName("test_touch_link_highlight.html");
64 66
65 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); 67 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html"));
66 FrameTestHelpers::WebViewHelper webViewHelper; 68 FrameTestHelpers::WebViewHelper webViewHelper;
67 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 69 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
68 int pageWidth = 640; 70 int pageWidth = 640;
69 int pageHeight = 480; 71 int pageHeight = 480;
70 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 72 webViewImpl->resize(WebSize(pageWidth, pageHeight));
71 webViewImpl->layout(); 73 webViewImpl->layout();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 WebViewClient* compositingWebViewClient() 124 WebViewClient* compositingWebViewClient()
123 { 125 {
124 DEFINE_STATIC_LOCAL(FakeCompositingWebViewClient, client, ()); 126 DEFINE_STATIC_LOCAL(FakeCompositingWebViewClient, client, ());
125 return &client; 127 return &client;
126 } 128 }
127 129
128 } // anonymous namespace 130 } // anonymous namespace
129 131
130 TEST(LinkHighlightImplTest, resetDuringNodeRemoval) 132 TEST(LinkHighlightImplTest, resetDuringNodeRemoval)
131 { 133 {
134 FrameTestHelpers::UseMockScrollbarSettings m_mockScrollbarSettings;
135
132 const std::string baseURL("http://www.test.com/"); 136 const std::string baseURL("http://www.test.com/");
133 const std::string fileName("test_touch_link_highlight.html"); 137 const std::string fileName("test_touch_link_highlight.html");
134 138
135 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); 139 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html"));
136 FrameTestHelpers::WebViewHelper webViewHelper; 140 FrameTestHelpers::WebViewHelper webViewHelper;
137 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient()); 141 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient());
138 142
139 int pageWidth = 640; 143 int pageWidth = 640;
140 int pageHeight = 480; 144 int pageHeight = 480;
141 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 145 webViewImpl->resize(WebSize(pageWidth, pageHeight));
(...skipping 18 matching lines...) Expand all
160 164
161 touchNode->remove(IGNORE_EXCEPTION); 165 touchNode->remove(IGNORE_EXCEPTION);
162 webViewImpl->layout(); 166 webViewImpl->layout();
163 ASSERT_EQ(0U, highlightLayer->numLinkHighlights()); 167 ASSERT_EQ(0U, highlightLayer->numLinkHighlights());
164 168
165 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 169 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
166 } 170 }
167 171
168 TEST(LinkHighlightImplTest, multipleHighlights) 172 TEST(LinkHighlightImplTest, multipleHighlights)
169 { 173 {
174 FrameTestHelpers::UseMockScrollbarSettings m_mockScrollbarSettings;
175
170 const std::string baseURL("http://www.test.com/"); 176 const std::string baseURL("http://www.test.com/");
171 const std::string fileName("test_touch_link_highlight.html"); 177 const std::string fileName("test_touch_link_highlight.html");
172 178
173 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); 179 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html"));
174 FrameTestHelpers::WebViewHelper webViewHelper; 180 FrameTestHelpers::WebViewHelper webViewHelper;
175 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient()); 181 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, compositingWebViewClient());
176 182
177 int pageWidth = 640; 183 int pageWidth = 640;
178 int pageHeight = 480; 184 int pageHeight = 480;
179 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 185 webViewImpl->resize(WebSize(pageWidth, pageHeight));
(...skipping 10 matching lines...) Expand all
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); 196 IntRect boundingBox(touchEvent.x - touchEvent.data.tap.width / 2, touchEvent .y - touchEvent.data.tap.height / 2, touchEvent.data.tap.width, touchEvent.data. tap.height);
191 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes); 197 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes);
192 198
193 webViewImpl->enableTapHighlights(highlightNodes); 199 webViewImpl->enableTapHighlights(highlightNodes);
194 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); 200 EXPECT_EQ(2U, webViewImpl->numLinkHighlights());
195 201
196 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 202 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
197 } 203 }
198 204
199 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698