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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Check for layerTreeView while setting handlers. Created 3 years, 11 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
Index: third_party/WebKit/Source/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 05efa641d63fe0c766cee63a5bba27c1992cdda0..ba837661de203c2ff1429caa6413f92ee31f4f1c 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -3353,8 +3353,8 @@ TEST_P(WebViewTest, AddFrameInChildInNavigateUnload) {
m_webViewHelper.reset();
}
-class TouchEventHandlerWebViewClient
- : public FrameTestHelpers::TestWebViewClient {
+class TouchEventHandlerWebWidgetClient
+ : public FrameTestHelpers::TestWebWidgetClient {
public:
// WebWidgetClient methods
void hasTouchEventHandlers(bool state) override {
@@ -3362,7 +3362,7 @@ class TouchEventHandlerWebViewClient
}
// Local methods
- TouchEventHandlerWebViewClient() : m_hasTouchEventHandlerCount() {}
+ TouchEventHandlerWebWidgetClient() : m_hasTouchEventHandlerCount() {}
int getAndResetHasTouchEventHandlerCallCount(bool state) {
int value = m_hasTouchEventHandlerCount[state];
@@ -3379,20 +3379,24 @@ class TouchEventHandlerWebViewClient
// RemoveAll}EventHandler(..., TouchEvent). Verifying that those calls are made
// correctly is the job of LayoutTests/fast/events/event-handler-count.html.
TEST_P(WebViewTest, HasTouchEventHandlers) {
- TouchEventHandlerWebViewClient client;
+ TouchEventHandlerWebWidgetClient client;
+ // We need to create a LayerTreeView for the client before loading the page,
+ // otherwise ChromeClient will default to assuming there are touch handlers.
+ WebLayerTreeView* layerTreeView = client.initializeLayerTreeView();
std::string url = m_baseURL + "has_touch_event_handlers.html";
URLTestHelpers::registerMockedURLLoad(toKURL(url),
"has_touch_event_handlers.html");
WebViewImpl* webViewImpl =
- m_webViewHelper.initializeAndLoad(url, true, 0, &client);
+ m_webViewHelper.initializeAndLoad(url, true, 0, 0, &client);
+ DCHECK(layerTreeView);
dcheng 2017/01/16 11:05:41 Nit: Prefer ASSERT in tests
wjmaclean 2017/01/17 18:23:28 Presubmit complains ASSERT is deprecated.
dcheng 2017/01/18 00:13:03 To be precise, ASSERT_TRUE. DCHECK() will get skip
wjmaclean 2017/01/18 14:01:23 Ooops, sorry. I read your comment too literally fo
const EventHandlerRegistry::EventHandlerClass touchEvent =
EventHandlerRegistry::TouchStartOrMoveEventBlocking;
// The page is initialized with at least one no-handlers call.
// In practice we get two such calls because WebViewHelper::initializeAndLoad
- // first initializes and empty frame, and then loads a document into it, so
+ // first initializes an empty frame, and then loads a document into it, so
// there are two FrameLoader::commitProvisionalLoad calls.
- EXPECT_GE(client.getAndResetHasTouchEventHandlerCallCount(false), 1);
+ EXPECT_LT(0, client.getAndResetHasTouchEventHandlerCallCount(false));
EXPECT_EQ(0, client.getAndResetHasTouchEventHandlerCallCount(true));
// Adding the first document handler results in a has-handlers call.

Powered by Google App Engine
This is Rietveld 408576698