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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 29 matching lines...) Expand all
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/PtrUtil.h" 50 #include "wtf/PassOwnPtr.h"
51 #include <memory>
52 51
53 namespace blink { 52 namespace blink {
54 53
55 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes tureEvent& touchEvent) 54 GestureEventWithHitTestResults getTargetedEvent(WebViewImpl* webViewImpl, WebGes tureEvent& touchEvent)
56 { 55 {
57 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent); 56 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent);
58 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe tGestureEvent(platformEvent, true); 57 return webViewImpl->page()->deprecatedLocalMainFrame()->eventHandler().targe tGestureEvent(platformEvent, true);
59 } 58 }
60 59
61 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration) 60 TEST(LinkHighlightImplTest, verifyWebViewImplIntegration)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 webViewImpl->updateAllLifecyclePhases(); 159 webViewImpl->updateAllLifecyclePhases();
161 ASSERT_EQ(0U, highlightLayer->numLinkHighlights()); 160 ASSERT_EQ(0U, highlightLayer->numLinkHighlights());
162 161
163 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 162 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
164 WebCache::clear(); 163 WebCache::clear();
165 } 164 }
166 165
167 // A lifetime test: delete LayerTreeView while running LinkHighlights. 166 // A lifetime test: delete LayerTreeView while running LinkHighlights.
168 TEST(LinkHighlightImplTest, resetLayerTreeView) 167 TEST(LinkHighlightImplTest, resetLayerTreeView)
169 { 168 {
170 std::unique_ptr<FakeCompositingWebViewClient> webViewClient = wrapUnique(new FakeCompositingWebViewClient()); 169 OwnPtr<FakeCompositingWebViewClient> webViewClient = adoptPtr(new FakeCompos itingWebViewClient());
171 170
172 const std::string baseURL("http://www.test.com/"); 171 const std::string baseURL("http://www.test.com/");
173 const std::string fileName("test_touch_link_highlight.html"); 172 const std::string fileName("test_touch_link_highlight.html");
174 173
175 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html")); 174 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("test_touch_link_highlight.html"));
176 FrameTestHelpers::WebViewHelper webViewHelper; 175 FrameTestHelpers::WebViewHelper webViewHelper;
177 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, webViewClient.get()); 176 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true, 0, webViewClient.get());
178 177
179 int pageWidth = 640; 178 int pageWidth = 640;
180 int pageHeight = 480; 179 int pageHeight = 480;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes); 231 findGoodTouchTargets(boundingBox, webViewImpl->mainFrameImpl()->frame(), goo dTargets, highlightNodes);
233 232
234 webViewImpl->enableTapHighlights(highlightNodes); 233 webViewImpl->enableTapHighlights(highlightNodes);
235 EXPECT_EQ(2U, webViewImpl->numLinkHighlights()); 234 EXPECT_EQ(2U, webViewImpl->numLinkHighlights());
236 235
237 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 236 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
238 WebCache::clear(); 237 WebCache::clear();
239 } 238 }
240 239
241 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LinkHighlightImpl.cpp ('k') | third_party/WebKit/Source/web/LocalFileSystemClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698