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 29 matching lines...) Expand all Loading... |
40 #include "public/web/WebCache.h" | 40 #include "public/web/WebCache.h" |
41 #include "public/web/WebFrame.h" | 41 #include "public/web/WebFrame.h" |
42 #include "public/web/WebFrameClient.h" | 42 #include "public/web/WebFrameClient.h" |
43 #include "public/web/WebInputEvent.h" | 43 #include "public/web/WebInputEvent.h" |
44 #include "public/web/WebViewClient.h" | 44 #include "public/web/WebViewClient.h" |
45 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
46 #include "web/WebInputEventConversion.h" | 46 #include "web/WebInputEventConversion.h" |
47 #include "web/WebLocalFrameImpl.h" | 47 #include "web/WebLocalFrameImpl.h" |
48 #include "web/WebViewImpl.h" | 48 #include "web/WebViewImpl.h" |
49 #include "web/tests/FrameTestHelpers.h" | 49 #include "web/tests/FrameTestHelpers.h" |
50 #include "wtf/PassOwnPtr.h" | 50 #include "wtf/PtrUtil.h" |
| 51 #include <memory> |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes
tureEvent& touchEvent) | 55 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes
tureEvent& touchEvent) |
55 { | 56 { |
56 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram
eView(), touchEvent); | 57 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram
eView(), touchEvent); |
57 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe
tGestureEvent(platformEvent, true); | 58 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe
tGestureEvent(platformEvent, true); |
58 } | 59 } |
59 | 60 |
60 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration) | 61 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 webViewImpl->updateAllLifecyclePhases(); | 160 webViewImpl->updateAllLifecyclePhases(); |
160 ASSERT_EQ(0U, highlightLayer->numLinkHighlights()); | 161 ASSERT_EQ(0U, highlightLayer->numLinkHighlights()); |
161 | 162 |
162 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 163 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
163 WebCache::clear(); | 164 WebCache::clear(); |
164 } | 165 } |
165 | 166 |
166 // A lifetime test: delete LayerTreeView while running LinkHighlights. | 167 // A lifetime test: delete LayerTreeView while running LinkHighlights. |
167 TEST(LinkHighlightImplTest, resetLayerTreeView) | 168 TEST(LinkHighlightImplTest, resetLayerTreeView) |
168 { | 169 { |
169 OwnPtr<FakeCompositingWebViewClient> webViewClient = adoptPtr(new FakeCompos
itingWebViewClient()); | 170 std::unique_ptr<FakeCompositingWebViewClient> webViewClient = wrapUnique(new
FakeCompositingWebViewClient()); |
170 | 171 |
171 const std::string baseURL("http://www.test.com/"); | 172 const std::string baseURL("http://www.test.com/"); |
172 const std::string fileName("test_touch_link_highlight.html"); | 173 const std::string fileName("test_touch_link_highlight.html"); |
173 | 174 |
174 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("test_touch_link_highlight.html")); | 175 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("test_touch_link_highlight.html")); |
175 FrameTestHelpers::WebViewHelper webViewHelper; | 176 FrameTestHelpers::WebViewHelper webViewHelper; |
176 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true, 0, webViewClient.get()); | 177 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true, 0, webViewClient.get()); |
177 | 178 |
178 int pageWidth = 640; | 179 int pageWidth = 640; |
179 int pageHeight = 480; | 180 int pageHeight = 480; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo
dTargets, highlightNodes); | 232 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo
dTargets, highlightNodes); |
232 | 233 |
233 webViewImpl->enableTapHighlights(highlightNodes); | 234 webViewImpl->enableTapHighlights(highlightNodes); |
234 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); | 235 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); |
235 | 236 |
236 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 237 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
237 WebCache::clear(); | 238 WebCache::clear(); |
238 } | 239 } |
239 | 240 |
240 } // namespace blink | 241 } // namespace blink |
OLD | NEW |