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

Side by Side Diff: third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp

Issue 2709813007: Remove WebViewClient::showVirtualKeyboardOnElementFocus() (Closed)
Patch Set: Addressing dcheng@'s comments Created 3 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/Document.h" 5 #include "core/dom/Document.h"
6 #include "core/dom/Element.h" 6 #include "core/dom/Element.h"
7 #include "core/dom/Node.h" 7 #include "core/dom/Node.h"
8 #include "core/html/HTMLElement.h" 8 #include "core/html/HTMLElement.h"
9 #include "platform/testing/URLTestHelpers.h" 9 #include "platform/testing/URLTestHelpers.h"
10 #include "platform/testing/UnitTestHelpers.h" 10 #include "platform/testing/UnitTestHelpers.h"
11 #include "public/platform/Platform.h" 11 #include "public/platform/Platform.h"
12 #include "public/platform/WebURLLoaderMockFactory.h" 12 #include "public/platform/WebURLLoaderMockFactory.h"
13 #include "public/web/WebDocument.h" 13 #include "public/web/WebDocument.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "web/WebLocalFrameImpl.h" 15 #include "web/WebLocalFrameImpl.h"
16 #include "web/tests/FrameTestHelpers.h" 16 #include "web/tests/FrameTestHelpers.h"
17 17
18 using blink::FrameTestHelpers::loadFrame; 18 using blink::FrameTestHelpers::loadFrame;
19 using blink::testing::runPendingTasks; 19 using blink::testing::runPendingTasks;
20 using blink::URLTestHelpers::registerMockedURLLoadFromBase; 20 using blink::URLTestHelpers::registerMockedURLLoadFromBase;
21 21
22 namespace blink { 22 namespace blink {
23 23
24 class ImeRequestTrackingWebViewClient 24 class ImeRequestTrackingWebViewClient
25 : public FrameTestHelpers::TestWebViewClient { 25 : public FrameTestHelpers::TestWebWidgetClient {
26 public: 26 public:
27 ImeRequestTrackingWebViewClient() : m_virtualKeyboardRequestCount(0) {} 27 ImeRequestTrackingWebViewClient() : m_virtualKeyboardRequestCount(0) {}
28 28
29 // WebWidgetClient methods 29 // WebWidgetClient methods
30 void showVirtualKeyboardOnElementFocus() override { 30 void showVirtualKeyboardOnElementFocus() override {
31 ++m_virtualKeyboardRequestCount; 31 ++m_virtualKeyboardRequestCount;
32 } 32 }
33 33
34 // Local methds 34 // Local methds
35 void reset() { m_virtualKeyboardRequestCount = 0; } 35 void reset() { m_virtualKeyboardRequestCount = 0; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 void ImeOnFocusTest::runImeOnFocusTest(std::string fileName, 89 void ImeOnFocusTest::runImeOnFocusTest(std::string fileName,
90 int expectedVirtualKeyboardRequestCount, 90 int expectedVirtualKeyboardRequestCount,
91 IntPoint tapPoint, 91 IntPoint tapPoint,
92 const AtomicString& focusElement, 92 const AtomicString& focusElement,
93 std::string frame) { 93 std::string frame) {
94 ImeRequestTrackingWebViewClient client; 94 ImeRequestTrackingWebViewClient client;
95 registerMockedURLLoadFromBase(WebString::fromUTF8(m_baseURL), 95 registerMockedURLLoadFromBase(WebString::fromUTF8(m_baseURL),
96 testing::webTestDataPath(), 96 testing::webTestDataPath(),
97 WebString::fromUTF8(fileName)); 97 WebString::fromUTF8(fileName));
98 WebViewImpl* webView = m_webViewHelper.initialize(true, 0, &client); 98 WebViewImpl* webView = m_webViewHelper.initialize(true, 0, nullptr, &client);
99 webView->resize(WebSize(800, 1200)); 99 webView->resize(WebSize(800, 1200));
100 loadFrame(webView->mainFrame(), m_baseURL + fileName); 100 loadFrame(webView->mainFrame(), m_baseURL + fileName);
101 m_document = 101 m_document =
102 m_webViewHelper.webView()->mainFrameImpl()->document().unwrap<Document>(); 102 m_webViewHelper.webView()->mainFrameImpl()->document().unwrap<Document>();
103 103
104 if (!focusElement.isNull()) 104 if (!focusElement.isNull())
105 focus(focusElement); 105 focus(focusElement);
106 EXPECT_EQ(0, client.virtualKeyboardRequestCount()); 106 EXPECT_EQ(0, client.virtualKeyboardRequestCount());
107 107
108 if (tapPoint.x() >= 0 && tapPoint.y() >= 0) 108 if (tapPoint.x() >= 0 && tapPoint.y() >= 0)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 runImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1, 145 runImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1,
146 IntPoint(50, 50), "input"); 146 IntPoint(50, 50), "input");
147 } 147 }
148 148
149 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) { 149 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) {
150 runImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1, 150 runImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1,
151 IntPoint(50, 50), "input", "frame.html"); 151 IntPoint(50, 50), "input", "frame.html");
152 } 152 }
153 153
154 } // namespace blink 154 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698