OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "content/browser/gpu/compositor_util.h" | 35 #include "content/browser/gpu/compositor_util.h" |
36 #include "content/browser/renderer_host/input/input_router.h" | 36 #include "content/browser/renderer_host/input/input_router.h" |
37 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" | 37 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" |
38 #include "content/browser/renderer_host/input/web_input_event_util.h" | 38 #include "content/browser/renderer_host/input/web_input_event_util.h" |
39 #include "content/browser/renderer_host/overscroll_controller.h" | 39 #include "content/browser/renderer_host/overscroll_controller.h" |
40 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 40 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
41 #include "content/browser/renderer_host/render_view_host_factory.h" | 41 #include "content/browser/renderer_host/render_view_host_factory.h" |
42 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 42 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
43 #include "content/browser/renderer_host/render_widget_host_impl.h" | 43 #include "content/browser/renderer_host/render_widget_host_impl.h" |
44 #include "content/browser/renderer_host/resize_lock.h" | 44 #include "content/browser/renderer_host/resize_lock.h" |
| 45 #include "content/browser/renderer_host/text_input_manager.h" |
45 #include "content/browser/web_contents/web_contents_view_aura.h" | 46 #include "content/browser/web_contents/web_contents_view_aura.h" |
46 #include "content/common/host_shared_bitmap_manager.h" | 47 #include "content/common/host_shared_bitmap_manager.h" |
47 #include "content/common/input/synthetic_web_input_event_builders.h" | 48 #include "content/common/input/synthetic_web_input_event_builders.h" |
48 #include "content/common/input_messages.h" | 49 #include "content/common/input_messages.h" |
| 50 #include "content/common/text_input_state.h" |
49 #include "content/common/view_messages.h" | 51 #include "content/common/view_messages.h" |
50 #include "content/public/browser/render_widget_host_view.h" | 52 #include "content/public/browser/render_widget_host_view.h" |
51 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 53 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
52 #include "content/public/browser/web_contents_view_delegate.h" | 54 #include "content/public/browser/web_contents_view_delegate.h" |
53 #include "content/public/common/context_menu_params.h" | 55 #include "content/public/common/context_menu_params.h" |
54 #include "content/public/test/mock_render_process_host.h" | 56 #include "content/public/test/mock_render_process_host.h" |
55 #include "content/public/test/test_browser_context.h" | 57 #include "content/public/test/test_browser_context.h" |
56 #include "content/test/test_render_view_host.h" | 58 #include "content/test/test_render_view_host.h" |
57 #include "content/test/test_web_contents.h" | 59 #include "content/test/test_web_contents.h" |
| 60 #include "ipc/ipc_message.h" |
58 #include "ipc/ipc_test_sink.h" | 61 #include "ipc/ipc_test_sink.h" |
59 #include "media/base/video_frame.h" | 62 #include "media/base/video_frame.h" |
60 #include "testing/gmock/include/gmock/gmock.h" | 63 #include "testing/gmock/include/gmock/gmock.h" |
61 #include "testing/gtest/include/gtest/gtest.h" | 64 #include "testing/gtest/include/gtest/gtest.h" |
62 #include "ui/aura/client/aura_constants.h" | 65 #include "ui/aura/client/aura_constants.h" |
63 #include "ui/aura/client/screen_position_client.h" | 66 #include "ui/aura/client/screen_position_client.h" |
64 #include "ui/aura/client/window_tree_client.h" | 67 #include "ui/aura/client/window_tree_client.h" |
65 #include "ui/aura/env.h" | 68 #include "ui/aura/env.h" |
66 #include "ui/aura/layout_manager.h" | 69 #include "ui/aura/layout_manager.h" |
67 #include "ui/aura/test/aura_test_helper.h" | 70 #include "ui/aura/test/aura_test_helper.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); | 158 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); |
156 }; | 159 }; |
157 | 160 |
158 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | 161 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
159 public: | 162 public: |
160 MockRenderWidgetHostDelegate() : rwh_(nullptr), is_fullscreen_(false) {} | 163 MockRenderWidgetHostDelegate() : rwh_(nullptr), is_fullscreen_(false) {} |
161 ~MockRenderWidgetHostDelegate() override {} | 164 ~MockRenderWidgetHostDelegate() override {} |
162 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } | 165 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } |
163 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } | 166 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } |
164 void set_is_fullscreen(bool is_fullscreen) { is_fullscreen_ = is_fullscreen; } | 167 void set_is_fullscreen(bool is_fullscreen) { is_fullscreen_ = is_fullscreen; } |
| 168 TextInputManager* GetTextInputManager() override { |
| 169 return &text_input_manager_; |
| 170 } |
165 | 171 |
166 protected: | 172 protected: |
167 // RenderWidgetHostDelegate: | 173 // RenderWidgetHostDelegate: |
168 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 174 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
169 bool* is_keyboard_shortcut) override { | 175 bool* is_keyboard_shortcut) override { |
170 last_event_.reset(new NativeWebKeyboardEvent(event)); | 176 last_event_.reset(new NativeWebKeyboardEvent(event)); |
171 return true; | 177 return true; |
172 } | 178 } |
173 void Cut() override {} | 179 void Cut() override {} |
174 void Copy() override {} | 180 void Copy() override {} |
175 void Paste() override {} | 181 void Paste() override {} |
176 void SelectAll() override {} | 182 void SelectAll() override {} |
177 void SendScreenRects() override { | 183 void SendScreenRects() override { |
178 if (rwh_) | 184 if (rwh_) |
179 rwh_->SendScreenRects(); | 185 rwh_->SendScreenRects(); |
180 } | 186 } |
181 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } | 187 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } |
182 | 188 |
183 private: | 189 private: |
184 std::unique_ptr<NativeWebKeyboardEvent> last_event_; | 190 std::unique_ptr<NativeWebKeyboardEvent> last_event_; |
185 RenderWidgetHostImpl* rwh_; | 191 RenderWidgetHostImpl* rwh_; |
186 bool is_fullscreen_; | 192 bool is_fullscreen_; |
| 193 TextInputManager text_input_manager_; |
187 | 194 |
188 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); | 195 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); |
189 }; | 196 }; |
190 | 197 |
191 // Simple observer that keeps track of changes to a window for tests. | 198 // Simple observer that keeps track of changes to a window for tests. |
192 class TestWindowObserver : public aura::WindowObserver { | 199 class TestWindowObserver : public aura::WindowObserver { |
193 public: | 200 public: |
194 explicit TestWindowObserver(aura::Window* window_to_observe) | 201 explicit TestWindowObserver(aura::Window* window_to_observe) |
195 : window_(window_to_observe) { | 202 : window_(window_to_observe) { |
196 window_->AddObserver(this); | 203 window_->AddObserver(this); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 const blink::WebInputEvent* event = std::get<0>(params); | 543 const blink::WebInputEvent* event = std::get<0>(params); |
537 SendTouchEventACK(event->type, ack_result, | 544 SendTouchEventACK(event->type, ack_result, |
538 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 545 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
539 } | 546 } |
540 | 547 |
541 const ui::MotionEventAura& pointer_state() { | 548 const ui::MotionEventAura& pointer_state() { |
542 return view_->pointer_state_for_test(); | 549 return view_->pointer_state_for_test(); |
543 } | 550 } |
544 | 551 |
545 protected: | 552 protected: |
| 553 BrowserContext* browser_context() { return browser_context_.get(); } |
| 554 |
| 555 // Sets the |view| active in TextInputManager with the given |type|. |type| |
| 556 // cannot be ui::TEXT_INPUT_TYPE_NONE. |
| 557 void ActivateViewForTextInputManager(RenderWidgetHostViewBase* view, |
| 558 ui::TextInputType type) { |
| 559 DCHECK_NE(ui::TEXT_INPUT_TYPE_NONE, type); |
| 560 TextInputManager* manager = |
| 561 static_cast<RenderWidgetHostImpl*>(view->GetRenderWidgetHost()) |
| 562 ->delegate() |
| 563 ->GetTextInputManager(); |
| 564 if (manager->GetActiveWidget()) { |
| 565 manager->active_view_for_testing()->TextInputStateChanged( |
| 566 TextInputState()); |
| 567 } |
| 568 |
| 569 if (!view) |
| 570 return; |
| 571 |
| 572 TextInputState state_with_type_text; |
| 573 state_with_type_text.type = type; |
| 574 view->TextInputStateChanged(state_with_type_text); |
| 575 } |
| 576 |
546 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 577 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
547 bool widget_host_uses_shutdown_to_destroy_; | 578 bool widget_host_uses_shutdown_to_destroy_; |
548 | 579 |
549 bool is_guest_view_hack_; | 580 bool is_guest_view_hack_; |
550 | 581 |
551 base::MessageLoopForUI message_loop_; | 582 base::MessageLoopForUI message_loop_; |
552 BrowserThreadImpl browser_thread_for_ui_; | 583 BrowserThreadImpl browser_thread_for_ui_; |
553 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 584 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
554 std::unique_ptr<BrowserContext> browser_context_; | 585 std::unique_ptr<BrowserContext> browser_context_; |
555 std::vector<std::unique_ptr<MockRenderWidgetHostDelegate>> delegates_; | 586 std::vector<std::unique_ptr<MockRenderWidgetHostDelegate>> delegates_; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 EXPECT_TRUE(observer.destroyed()); | 1089 EXPECT_TRUE(observer.destroyed()); |
1059 | 1090 |
1060 widget_host_ = NULL; | 1091 widget_host_ = NULL; |
1061 view_ = NULL; | 1092 view_ = NULL; |
1062 } | 1093 } |
1063 | 1094 |
1064 // Checks that IME-composition-event state is maintained correctly. | 1095 // Checks that IME-composition-event state is maintained correctly. |
1065 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 1096 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
1066 view_->InitAsChild(NULL); | 1097 view_->InitAsChild(NULL); |
1067 view_->Show(); | 1098 view_->Show(); |
| 1099 ActivateViewForTextInputManager(view_, ui::TEXT_INPUT_TYPE_TEXT); |
1068 | 1100 |
1069 ui::CompositionText composition_text; | 1101 ui::CompositionText composition_text; |
1070 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1102 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1071 | 1103 |
1072 // Focused segment | 1104 // Focused segment |
1073 composition_text.underlines.push_back( | 1105 composition_text.underlines.push_back( |
1074 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1106 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1075 | 1107 |
1076 // Non-focused segment, with different background color. | 1108 // Non-focused segment, with different background color. |
1077 composition_text.underlines.push_back( | 1109 composition_text.underlines.push_back( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 | 1144 |
1113 view_->ImeCancelComposition(); | 1145 view_->ImeCancelComposition(); |
1114 EXPECT_FALSE(view_->has_composition_text_); | 1146 EXPECT_FALSE(view_->has_composition_text_); |
1115 } | 1147 } |
1116 | 1148 |
1117 // Checks that sequence of IME-composition-event and mouse-event when mouse | 1149 // Checks that sequence of IME-composition-event and mouse-event when mouse |
1118 // clicking to cancel the composition. | 1150 // clicking to cancel the composition. |
1119 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { | 1151 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { |
1120 view_->InitAsChild(NULL); | 1152 view_->InitAsChild(NULL); |
1121 view_->Show(); | 1153 view_->Show(); |
| 1154 ActivateViewForTextInputManager(view_, ui::TEXT_INPUT_TYPE_TEXT); |
1122 | 1155 |
1123 ui::CompositionText composition_text; | 1156 ui::CompositionText composition_text; |
1124 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1157 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1125 | 1158 |
1126 // Focused segment | 1159 // Focused segment |
1127 composition_text.underlines.push_back( | 1160 composition_text.underlines.push_back( |
1128 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1161 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1129 | 1162 |
1130 // Non-focused segment, with different background color. | 1163 // Non-focused segment, with different background color. |
1131 composition_text.underlines.push_back( | 1164 composition_text.underlines.push_back( |
(...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3987 100, 100, 0, ui::EventTimeForNow(), event_details); | 4020 100, 100, 0, ui::EventTimeForNow(), event_details); |
3988 view()->OnGestureEvent(&gesture_event); | 4021 view()->OnGestureEvent(&gesture_event); |
3989 | 4022 |
3990 EXPECT_TRUE(delegate->context_menu_request_received()); | 4023 EXPECT_TRUE(delegate->context_menu_request_received()); |
3991 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); | 4024 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); |
3992 #endif | 4025 #endif |
3993 | 4026 |
3994 RenderViewHostFactory::set_is_real_render_view_host(false); | 4027 RenderViewHostFactory::set_is_real_render_view_host(false); |
3995 } | 4028 } |
3996 | 4029 |
| 4030 // ---------------------------------------------------------------------------- |
| 4031 // TextInputManager and IME-Related Tests |
| 4032 |
| 4033 // A group of tests which verify that the IME method results are routed to the |
| 4034 // right RenderWidget in the OOPIF structure. |
| 4035 // In each test, 3 views are created where one is in process with main frame and |
| 4036 // the other two are in distinct processes (this makes a total of 4 RWHVs). Then |
| 4037 // each test will verify the correctness of routing for one of the IME result |
| 4038 // methods. The method is called on ui::TextInputClient (i.e., RWHV for the tab |
| 4039 // in aura) and then the test verifies that the IPC is routed to the |
| 4040 // RenderWidget corresponding to the active view (i.e., the RenderWidget |
| 4041 // with focused <input>). |
| 4042 class InputMethodResultAuraTest : public RenderWidgetHostViewAuraTest { |
| 4043 public: |
| 4044 InputMethodResultAuraTest() {} |
| 4045 ~InputMethodResultAuraTest() override {} |
| 4046 |
| 4047 void SetUp() override { |
| 4048 RenderWidgetHostViewAuraTest::SetUp(); |
| 4049 InitializeAura(); |
| 4050 |
| 4051 view_for_first_process_ = CreateViewForProcess(tab_process()); |
| 4052 |
| 4053 second_process_host_ = CreateNewProcessHost(); |
| 4054 view_for_second_process_ = CreateViewForProcess(second_process_host_); |
| 4055 |
| 4056 third_process_host_ = CreateNewProcessHost(); |
| 4057 view_for_third_process_ = CreateViewForProcess(third_process_host_); |
| 4058 |
| 4059 views_.insert(views_.begin(), |
| 4060 {tab_view(), view_for_first_process_, |
| 4061 view_for_second_process_, view_for_third_process_}); |
| 4062 processes_.insert(processes_.begin(), |
| 4063 {tab_process(), tab_process(), second_process_host_, |
| 4064 third_process_host_}); |
| 4065 active_view_sequence_.insert(active_view_sequence_.begin(), |
| 4066 {0, 1, 2, 1, 1, 3, 0, 3, 1}); |
| 4067 } |
| 4068 |
| 4069 void TearDown() override { |
| 4070 RenderWidgetHost* widget_for_first_process = |
| 4071 view_for_first_process_->GetRenderWidgetHost(); |
| 4072 view_for_first_process_->Destroy(); |
| 4073 delete widget_for_first_process; |
| 4074 |
| 4075 RenderWidgetHost* widget_for_second_process = |
| 4076 view_for_second_process_->GetRenderWidgetHost(); |
| 4077 view_for_second_process_->Destroy(); |
| 4078 delete widget_for_second_process; |
| 4079 |
| 4080 RenderWidgetHost* widget_for_third_process = |
| 4081 view_for_third_process_->GetRenderWidgetHost(); |
| 4082 view_for_third_process_->Destroy(); |
| 4083 delete widget_for_third_process; |
| 4084 |
| 4085 RenderWidgetHostViewAuraTest::TearDown(); |
| 4086 } |
| 4087 |
| 4088 protected: |
| 4089 const IPC::Message* RunAndReturnIPCSent(const base::Closure closure, |
| 4090 MockRenderProcessHost* process, |
| 4091 int32_t message_id) { |
| 4092 process->sink().ClearMessages(); |
| 4093 closure.Run(); |
| 4094 return process->sink().GetFirstMessageMatching(message_id); |
| 4095 } |
| 4096 |
| 4097 MockRenderWidgetHostDelegate* render_widget_host_delegate() const { |
| 4098 return delegates_.back().get(); |
| 4099 } |
| 4100 |
| 4101 ui::TextInputClient* text_input_client() const { return view_; } |
| 4102 |
| 4103 bool has_composition_text() const { |
| 4104 return tab_view()->has_composition_text_; |
| 4105 } |
| 4106 |
| 4107 MockRenderProcessHost* CreateNewProcessHost() { |
| 4108 MockRenderProcessHost* process_host = |
| 4109 new MockRenderProcessHost(browser_context()); |
| 4110 return process_host; |
| 4111 } |
| 4112 |
| 4113 RenderWidgetHostImpl* CreateRenderWidgetHostForProcess( |
| 4114 MockRenderProcessHost* process_host) { |
| 4115 return new RenderWidgetHostImpl(render_widget_host_delegate(), process_host, |
| 4116 process_host->GetNextRoutingID(), false); |
| 4117 } |
| 4118 |
| 4119 TestRenderWidgetHostView* CreateViewForProcess( |
| 4120 MockRenderProcessHost* process_host) { |
| 4121 RenderWidgetHostImpl* host = CreateRenderWidgetHostForProcess(process_host); |
| 4122 TestRenderWidgetHostView* view = new TestRenderWidgetHostView(host); |
| 4123 host->SetView(view); |
| 4124 return view; |
| 4125 } |
| 4126 |
| 4127 void SetHasCompositionTextToTrue() { |
| 4128 ui::CompositionText composition_text; |
| 4129 composition_text.text = base::ASCIIToUTF16("text"); |
| 4130 tab_view()->SetCompositionText(composition_text); |
| 4131 EXPECT_TRUE(has_composition_text()); |
| 4132 } |
| 4133 |
| 4134 MockRenderProcessHost* tab_process() const { return process_host_; } |
| 4135 |
| 4136 RenderWidgetHostViewAura* tab_view() const { return view_; } |
| 4137 |
| 4138 std::vector<RenderWidgetHostViewBase*> views_; |
| 4139 std::vector<MockRenderProcessHost*> processes_; |
| 4140 // A sequence of indices in [0, 3] which determines the index of a RWHV in |
| 4141 // |views_|. This sequence is used in the tests to sequentially make a RWHV |
| 4142 // active for a subsequent IME result method call. |
| 4143 std::vector<size_t> active_view_sequence_; |
| 4144 |
| 4145 private: |
| 4146 // This will initialize |window_| in RenderWidgetHostViewAura. It is needed |
| 4147 // for RenderWidgetHostViewAura::GetInputMethod() to work. |
| 4148 void InitializeAura() { |
| 4149 view_->InitAsChild(nullptr); |
| 4150 view_->Show(); |
| 4151 } |
| 4152 |
| 4153 TestRenderWidgetHostView* view_for_first_process_; |
| 4154 MockRenderProcessHost* second_process_host_; |
| 4155 TestRenderWidgetHostView* view_for_second_process_; |
| 4156 MockRenderProcessHost* third_process_host_; |
| 4157 TestRenderWidgetHostView* view_for_third_process_; |
| 4158 |
| 4159 DISALLOW_COPY_AND_ASSIGN(InputMethodResultAuraTest); |
| 4160 }; |
| 4161 |
| 4162 // This test verifies that ui::TextInputClient::SetCompositionText call leads to |
| 4163 // IPC message InputMsg_ImeSetComposition being sent to the right renderer |
| 4164 // process. |
| 4165 TEST_F(InputMethodResultAuraTest, SetCompositionText) { |
| 4166 base::Closure ime_call = |
| 4167 base::Bind(&ui::TextInputClient::SetCompositionText, |
| 4168 base::Unretained(text_input_client()), ui::CompositionText()); |
| 4169 for (auto index : active_view_sequence_) { |
| 4170 ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); |
| 4171 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], |
| 4172 InputMsg_ImeSetComposition::ID)); |
| 4173 } |
| 4174 } |
| 4175 |
| 4176 // This test verifies that ui::TextInputClient::ConfirmCompositionText call |
| 4177 // leads to IPC message InputMsg_ImeConfirmComposition being sent to the right |
| 4178 // renderer process. |
| 4179 TEST_F(InputMethodResultAuraTest, ConfirmCompositionText) { |
| 4180 base::Closure ime_call = |
| 4181 base::Bind(&ui::TextInputClient::ConfirmCompositionText, |
| 4182 base::Unretained(text_input_client())); |
| 4183 for (auto index : active_view_sequence_) { |
| 4184 ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); |
| 4185 SetHasCompositionTextToTrue(); |
| 4186 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], |
| 4187 InputMsg_ImeConfirmComposition::ID)); |
| 4188 } |
| 4189 } |
| 4190 |
| 4191 // This test verifies that ui::TextInputClient::ConfirmCompositionText call |
| 4192 // leads to IPC message InputMsg_ImeSetComposition being sent to the right |
| 4193 // renderer process. |
| 4194 TEST_F(InputMethodResultAuraTest, ClearCompositionText) { |
| 4195 base::Closure ime_call = |
| 4196 base::Bind(&ui::TextInputClient::ClearCompositionText, |
| 4197 base::Unretained(text_input_client())); |
| 4198 for (auto index : active_view_sequence_) { |
| 4199 ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); |
| 4200 SetHasCompositionTextToTrue(); |
| 4201 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], |
| 4202 InputMsg_ImeSetComposition::ID)); |
| 4203 } |
| 4204 } |
| 4205 |
| 4206 // This test verifies that ui::TextInputClient::InsertText call leads to IPC |
| 4207 // message InputMsg_ImeSetComposition being sent to the right renderer process. |
| 4208 TEST_F(InputMethodResultAuraTest, InsertText) { |
| 4209 base::Closure ime_call = |
| 4210 base::Bind(&ui::TextInputClient::InsertText, |
| 4211 base::Unretained(text_input_client()), base::string16()); |
| 4212 for (auto index : active_view_sequence_) { |
| 4213 ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); |
| 4214 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], |
| 4215 InputMsg_ImeConfirmComposition::ID)); |
| 4216 } |
| 4217 } |
| 4218 |
3997 } // namespace content | 4219 } // namespace content |
OLD | NEW |