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/frame/FrameTestHelpers.h" | 8 #include "core/frame/FrameTestHelpers.h" |
9 #include "core/frame/WebLocalFrameBase.h" | 9 #include "core/frame/WebLocalFrameBase.h" |
10 #include "core/html/HTMLElement.h" | 10 #include "core/html/HTMLElement.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 IntPoint tap_point, | 93 IntPoint tap_point, |
94 const AtomicString& focus_element, | 94 const AtomicString& focus_element, |
95 std::string frame) { | 95 std::string frame) { |
96 ImeRequestTrackingWebViewClient client; | 96 ImeRequestTrackingWebViewClient client; |
97 RegisterMockedURLLoadFromBase(WebString::FromUTF8(base_url_), | 97 RegisterMockedURLLoadFromBase(WebString::FromUTF8(base_url_), |
98 testing::WebTestDataPath(), | 98 testing::WebTestDataPath(), |
99 WebString::FromUTF8(file_name)); | 99 WebString::FromUTF8(file_name)); |
100 WebViewBase* web_view = | 100 WebViewBase* web_view = |
101 web_view_helper_.Initialize(nullptr, nullptr, &client); | 101 web_view_helper_.Initialize(nullptr, nullptr, &client); |
102 web_view->Resize(WebSize(800, 1200)); | 102 web_view->Resize(WebSize(800, 1200)); |
103 LoadFrame(web_view->MainFrame(), base_url_ + file_name); | 103 LoadFrame(web_view->MainFrameImpl(), base_url_ + file_name); |
104 document_ = web_view_helper_.WebView() | 104 document_ = web_view_helper_.WebView() |
105 ->MainFrameImpl() | 105 ->MainFrameImpl() |
106 ->GetDocument() | 106 ->GetDocument() |
107 .Unwrap<Document>(); | 107 .Unwrap<Document>(); |
108 | 108 |
109 if (!focus_element.IsNull()) | 109 if (!focus_element.IsNull()) |
110 Focus(focus_element); | 110 Focus(focus_element); |
111 EXPECT_EQ(0, client.VirtualKeyboardRequestCount()); | 111 EXPECT_EQ(0, client.VirtualKeyboardRequestCount()); |
112 | 112 |
113 if (tap_point.X() >= 0 && tap_point.Y() >= 0) | 113 if (tap_point.X() >= 0 && tap_point.Y() >= 0) |
114 SendGestureTap(web_view, tap_point); | 114 SendGestureTap(web_view, tap_point); |
115 | 115 |
116 if (!frame.empty()) { | 116 if (!frame.empty()) { |
117 RegisterMockedURLLoadFromBase(WebString::FromUTF8(base_url_), | 117 RegisterMockedURLLoadFromBase(WebString::FromUTF8(base_url_), |
118 testing::WebTestDataPath(), | 118 testing::WebTestDataPath(), |
119 WebString::FromUTF8(frame)); | 119 WebString::FromUTF8(frame)); |
120 WebFrame* child_frame = web_view->MainFrame()->FirstChild(); | 120 WebLocalFrame* child_frame = |
| 121 web_view->MainFrame()->FirstChild()->ToWebLocalFrame(); |
121 LoadFrame(child_frame, base_url_ + frame); | 122 LoadFrame(child_frame, base_url_ + frame); |
122 } | 123 } |
123 | 124 |
124 if (!focus_element.IsNull()) | 125 if (!focus_element.IsNull()) |
125 Focus(focus_element); | 126 Focus(focus_element); |
126 EXPECT_EQ(expected_virtual_keyboard_request_count, | 127 EXPECT_EQ(expected_virtual_keyboard_request_count, |
127 client.VirtualKeyboardRequestCount()); | 128 client.VirtualKeyboardRequestCount()); |
128 | 129 |
129 web_view_helper_.Reset(); | 130 web_view_helper_.Reset(); |
130 } | 131 } |
(...skipping 19 matching lines...) Expand all Loading... |
150 RunImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1, | 151 RunImeOnFocusTest("ime-on-focus-after-navigation-within-page.html", 1, |
151 IntPoint(50, 50), "input"); | 152 IntPoint(50, 50), "input"); |
152 } | 153 } |
153 | 154 |
154 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) { | 155 TEST_F(ImeOnFocusTest, AfterFrameLoadOnGesture) { |
155 RunImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1, | 156 RunImeOnFocusTest("ime-on-focus-after-frame-load-on-gesture.html", 1, |
156 IntPoint(50, 50), "input", "frame.html"); | 157 IntPoint(50, 50), "input", "frame.html"); |
157 } | 158 } |
158 | 159 |
159 } // namespace blink | 160 } // namespace blink |
OLD | NEW |