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

Side by Side Diff: blimp/engine/browser_tests/input_browsertest.cc

Issue 2393043004: Blimp: IME should submit form with text (Closed)
Patch Set: dtrainor@ comments Created 4 years, 2 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
« no previous file with comments | « blimp/common/proto/ime.proto ('k') | blimp/engine/feature/engine_render_widget_feature.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "blimp/client/app/session/test_client_session.h" 6 #include "blimp/client/app/session/test_client_session.h"
7 #include "blimp/client/core/contents/ime_feature.h" 7 #include "blimp/client/core/contents/ime_feature.h"
8 #include "blimp/client/core/contents/mock_ime_feature_delegate.h" 8 #include "blimp/client/core/contents/mock_ime_feature_delegate.h"
9 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h" 9 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h"
10 #include "blimp/client/core/contents/navigation_feature.h" 10 #include "blimp/client/core/contents/navigation_feature.h"
11 #include "blimp/client/core/contents/tab_control_feature.h" 11 #include "blimp/client/core/contents/tab_control_feature.h"
12 #include "blimp/client/core/render_widget/render_widget_feature.h" 12 #include "blimp/client/core/render_widget/render_widget_feature.h"
13 #include "blimp/client/core/session/assignment_source.h" 13 #include "blimp/client/core/session/assignment_source.h"
14 #include "blimp/client/public/session/assignment.h" 14 #include "blimp/client/public/session/assignment.h"
15 #include "blimp/engine/browser_tests/blimp_browser_test.h" 15 #include "blimp/engine/browser_tests/blimp_browser_test.h"
16 #include "content/public/test/browser_test.h" 16 #include "content/public/test/browser_test.h"
17 #include "content/public/test/browser_test_utils.h"
17 #include "net/base/ip_address.h" 18 #include "net/base/ip_address.h"
18 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/public/web/WebInputEvent.h" 22 #include "third_party/WebKit/public/web/WebInputEvent.h"
22 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 using ::testing::_; 26 using ::testing::_;
26 using ::testing::AtLeast; 27 using ::testing::AtLeast;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 114
114 private: 115 private:
115 DISALLOW_COPY_AND_ASSIGN(InputBrowserTest); 116 DISALLOW_COPY_AND_ASSIGN(InputBrowserTest);
116 }; 117 };
117 118
118 IN_PROC_BROWSER_TEST_F(InputBrowserTest, InputText) { 119 IN_PROC_BROWSER_TEST_F(InputBrowserTest, InputText) {
119 LoadPage(kInputPagePath); 120 LoadPage(kInputPagePath);
120 121
121 blink::WebGestureEvent event; 122 blink::WebGestureEvent event;
122 event.type = blink::WebInputEvent::Type::GestureTap; 123 event.type = blink::WebInputEvent::Type::GestureTap;
123 client::ImeFeature::ShowImeCallback callback; 124 client::ImeFeature::WebInputRequest request;
124 125
125 // Send a tap event from the client and expect the IME dialog to show. 126 // Send a tap event from the client and expect the IME dialog to show.
126 EXPECT_CALL(client_ime_feature_delegate_, OnShowImeRequested(_, "", _)) 127 EXPECT_CALL(client_ime_feature_delegate_, OnShowImeRequested(_))
127 .Times(AtLeast(1)) 128 .Times(AtLeast(1))
128 .WillOnce( 129 .WillOnce(
129 DoAll(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion), 130 DoAll(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion),
130 SaveArg<2>(&callback))); 131 SaveArg<0>(&request)));
131 client_session_->GetRenderWidgetFeature()->SendWebGestureEvent(kDummyTabId, 1, 132 client_session_->GetRenderWidgetFeature()->SendWebGestureEvent(kDummyTabId, 1,
132 event); 133 event);
133 RunAndVerify(); 134 RunAndVerify();
134 135
135 // Enter text from the client and expect the input.html JavaScript to update 136 // Enter text from the client and expect the input.html JavaScript to update
136 // the page title. 137 // the page title.
137 EXPECT_CALL(client_nav_feature_delegate_, OnTitleChanged(kDummyTabId, "test")) 138 EXPECT_CALL(client_nav_feature_delegate_, OnTitleChanged(kDummyTabId, "test"))
138 .WillOnce(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion)); 139 .WillOnce(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion));
139 callback.Run("test"); 140
141 client::ImeFeature::WebInputResponse response;
142 response.text = "test";
143 response.submit = false;
144 request.show_ime_callback.Run(response);
140 RunAndVerify(); 145 RunAndVerify();
141 } 146 }
142 147
148 IN_PROC_BROWSER_TEST_F(InputBrowserTest, InputTextAndSubmit) {
149 LoadPage(kInputPagePath);
150
151 blink::WebGestureEvent event;
152 event.type = blink::WebInputEvent::Type::GestureTap;
153 client::ImeFeature::WebInputRequest request;
154
155 // Send a tap event from the client and expect the IME dialog to show.
156 EXPECT_CALL(client_ime_feature_delegate_, OnShowImeRequested(_))
157 .Times(AtLeast(1))
158 .WillOnce(
159 DoAll(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion),
160 SaveArg<0>(&request)));
161 client_session_->GetRenderWidgetFeature()->SendWebGestureEvent(kDummyTabId, 1,
162 event);
163 RunAndVerify();
164
165 // Enter text from client and submit the form.
166 client::ImeFeature::WebInputResponse response;
167 response.text = "test";
168 response.submit = true;
169 request.show_ime_callback.Run(response);
170
171 content::DOMMessageQueue queue;
172 std::string status;
173 EXPECT_TRUE(queue.WaitForMessage(&status));
174 EXPECT_EQ(status, "\"Submitted\"");
175 }
176
143 } // namespace 177 } // namespace
144 } // namespace blimp 178 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/common/proto/ime.proto ('k') | blimp/engine/feature/engine_render_widget_feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698