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

Unified Diff: Source/WebKit/chromium/tests/LinkHighlightTest.cpp

Issue 15670013: Merge 149838 "Reland "Clear highlight when the highlighted node ..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1500/
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/chromium/src/LinkHighlight.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/LinkHighlightTest.cpp
===================================================================
--- Source/WebKit/chromium/tests/LinkHighlightTest.cpp (revision 151510)
+++ Source/WebKit/chromium/tests/LinkHighlightTest.cpp (working copy)
@@ -31,9 +31,11 @@
#include "URLTestHelpers.h"
#include "WebCompositorInitializer.h"
#include "WebFrame.h"
+#include "WebFrameClient.h"
#include "WebFrameImpl.h"
#include "WebInputEvent.h"
#include "WebInputEventConversion.h"
+#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "core/dom/Node.h"
#include "core/page/FrameView.h"
@@ -41,8 +43,10 @@
#include <public/WebContentLayer.h>
#include <public/WebFloatPoint.h>
#include <public/WebSize.h>
+#include <public/WebUnitTestSupport.h>
#include <wtf/PassOwnPtr.h>
+
using namespace WebKit;
using namespace WebCore;
@@ -119,6 +123,79 @@
ASSERT_FALSE(webViewImpl->linkHighlight());
webViewImpl->close();
+ Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
}
+class FakeWebFrameClient : public WebFrameClient {
+ // To make the destructor public.
+};
+
+class FakeCompositingWebViewClient : public WebViewClient {
+public:
+ virtual ~FakeCompositingWebViewClient()
+ {
+ }
+
+ virtual void initializeLayerTreeView() OVERRIDE
+ {
+ m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
+ ASSERT(m_layerTreeView);
+ }
+
+ virtual WebLayerTreeView* layerTreeView() OVERRIDE
+ {
+ return m_layerTreeView.get();
+ }
+
+ FakeWebFrameClient m_fakeWebFrameClient;
+
+private:
+ OwnPtr<WebLayerTreeView> m_layerTreeView;
+};
+
+static WebViewClient* compositingWebViewClient()
+{
+ DEFINE_STATIC_LOCAL(FakeCompositingWebViewClient, client, ());
+ return &client;
+}
+
+TEST(LinkHighlightTest, resetDuringNodeRemoval)
+{
+ WebKitTests::WebCompositorInitializer compositorInitializer(0);
+
+ const std::string baseURL("http://www.test.com/");
+ const std::string fileName("test_touch_link_highlight.html");
+
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("test_touch_link_highlight.html"));
+ WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, true, 0, compositingWebViewClient()));
+
+ int pageWidth = 640;
+ int pageHeight = 480;
+ webViewImpl->resize(WebSize(pageWidth, pageHeight));
+ webViewImpl->layout();
+
+ WebGestureEvent touchEvent;
+ touchEvent.type = WebInputEvent::GestureTapDown;
+ touchEvent.x = 20;
+ touchEvent.y = 20;
+
+ PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->frameView(), touchEvent);
+ Node* touchNode = webViewImpl->bestTapNode(platformEvent);
+ ASSERT_TRUE(touchNode);
+
+ webViewImpl->enableTapHighlight(platformEvent);
+ ASSERT_TRUE(webViewImpl->linkHighlight());
+
+ GraphicsLayerChromium* highlightLayer = webViewImpl->linkHighlight()->currentGraphicsLayerForTesting();
+ ASSERT_TRUE(highlightLayer);
+ EXPECT_TRUE(highlightLayer->linkHighlight());
+
+ touchNode->remove(IGNORE_EXCEPTION);
+ webViewImpl->layout();
+ EXPECT_FALSE(highlightLayer->linkHighlight());
+
+ webViewImpl->close();
+ Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
+}
+
} // namespace
« no previous file with comments | « Source/WebKit/chromium/src/LinkHighlight.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698