| OLD | NEW |
| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 m_document->body()->getElementById(element)->focus(); | 96 m_document->body()->getElementById(element)->focus(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ImeOnFocusTest::runImeOnFocusTest(std::string fileName, int expectedImeRequ
estCount, IntPoint tapPoint, const AtomicString& focusElement, std::string frame
) | 99 void ImeOnFocusTest::runImeOnFocusTest(std::string fileName, int expectedImeRequ
estCount, IntPoint tapPoint, const AtomicString& focusElement, std::string frame
) |
| 100 { | 100 { |
| 101 ImeRequestTrackingWebViewClient client; | 101 ImeRequestTrackingWebViewClient client; |
| 102 registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::from
UTF8(fileName)); | 102 registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::from
UTF8(fileName)); |
| 103 WebViewImpl* webView = m_webViewHelper.initialize(true, 0, &client); | 103 WebViewImpl* webView = m_webViewHelper.initialize(true, 0, &client); |
| 104 webView->resize(WebSize(800, 1200)); | 104 webView->resize(WebSize(800, 1200)); |
| 105 loadFrame(webView->mainFrame(), m_baseURL + fileName); | 105 loadFrame(webView->mainFrame(), m_baseURL + fileName); |
| 106 m_document = m_webViewHelper.webViewImpl()->mainFrameImpl()->document().unwr
ap<Document>(); | 106 m_document = m_webViewHelper.webView()->mainFrameImpl()->document().unwrap<D
ocument>(); |
| 107 | 107 |
| 108 if (!focusElement.isNull()) | 108 if (!focusElement.isNull()) |
| 109 focus(focusElement); | 109 focus(focusElement); |
| 110 EXPECT_EQ(0, client.imeRequestCount()); | 110 EXPECT_EQ(0, client.imeRequestCount()); |
| 111 | 111 |
| 112 if (tapPoint.x() >= 0 && tapPoint.y() >= 0) | 112 if (tapPoint.x() >= 0 && tapPoint.y() >= 0) |
| 113 sendGestureTap(webView, tapPoint); | 113 sendGestureTap(webView, tapPoint); |
| 114 | 114 |
| 115 if (!frame.empty()) { | 115 if (!frame.empty()) { |
| 116 registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::
fromUTF8(frame)); | 116 registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::
fromUTF8(frame)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 { | 149 { |
| 150 runImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1, IntPo
int(50, 50), "input"); | 150 runImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1, IntPo
int(50, 50), "input"); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) | 153 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) |
| 154 { | 154 { |
| 155 runImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1, IntPoi
nt(50, 50), "input", "frame.html"); | 155 runImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1, IntPoi
nt(50, 50), "input", "frame.html"); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |