| 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 d3542f7fba872d7c663a22a72e177e3e0fc84d81..579a2b22c190e5a2893b7d35cd8f7012b87a072e 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
|
| @@ -3354,8 +3354,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 {
|
| @@ -3363,7 +3363,7 @@ class TouchEventHandlerWebViewClient
|
| }
|
|
|
| // Local methods
|
| - TouchEventHandlerWebViewClient() : m_hasTouchEventHandlerCount() {}
|
| + TouchEventHandlerWebWidgetClient() : m_hasTouchEventHandlerCount() {}
|
|
|
| int getAndResetHasTouchEventHandlerCallCount(bool state) {
|
| int value = m_hasTouchEventHandlerCount[state];
|
| @@ -3380,20 +3380,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);
|
| + ASSERT_TRUE(layerTreeView);
|
| 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.
|
|
|