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/input_event_utils.h" | 48 #include "content/common/input/input_event_utils.h" |
48 #include "content/common/input/synthetic_web_input_event_builders.h" | 49 #include "content/common/input/synthetic_web_input_event_builders.h" |
49 #include "content/common/input_messages.h" | 50 #include "content/common/input_messages.h" |
51 #include "content/common/text_input_state.h" | |
50 #include "content/common/view_messages.h" | 52 #include "content/common/view_messages.h" |
51 #include "content/public/browser/render_widget_host_view.h" | 53 #include "content/public/browser/render_widget_host_view.h" |
52 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 54 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
53 #include "content/public/browser/web_contents_view_delegate.h" | 55 #include "content/public/browser/web_contents_view_delegate.h" |
54 #include "content/public/common/context_menu_params.h" | 56 #include "content/public/common/context_menu_params.h" |
55 #include "content/public/test/mock_render_process_host.h" | 57 #include "content/public/test/mock_render_process_host.h" |
56 #include "content/public/test/test_browser_context.h" | 58 #include "content/public/test/test_browser_context.h" |
57 #include "content/test/test_render_view_host.h" | 59 #include "content/test/test_render_view_host.h" |
58 #include "content/test/test_web_contents.h" | 60 #include "content/test/test_web_contents.h" |
61 #include "ipc/ipc_message.h" | |
59 #include "ipc/ipc_test_sink.h" | 62 #include "ipc/ipc_test_sink.h" |
60 #include "media/base/video_frame.h" | 63 #include "media/base/video_frame.h" |
61 #include "testing/gmock/include/gmock/gmock.h" | 64 #include "testing/gmock/include/gmock/gmock.h" |
62 #include "testing/gtest/include/gtest/gtest.h" | 65 #include "testing/gtest/include/gtest/gtest.h" |
63 #include "ui/aura/client/aura_constants.h" | 66 #include "ui/aura/client/aura_constants.h" |
64 #include "ui/aura/client/screen_position_client.h" | 67 #include "ui/aura/client/screen_position_client.h" |
65 #include "ui/aura/client/window_tree_client.h" | 68 #include "ui/aura/client/window_tree_client.h" |
66 #include "ui/aura/env.h" | 69 #include "ui/aura/env.h" |
67 #include "ui/aura/layout_manager.h" | 70 #include "ui/aura/layout_manager.h" |
68 #include "ui/aura/test/aura_test_helper.h" | 71 #include "ui/aura/test/aura_test_helper.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); | 159 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); |
157 }; | 160 }; |
158 | 161 |
159 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | 162 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
160 public: | 163 public: |
161 MockRenderWidgetHostDelegate() : rwh_(nullptr), is_fullscreen_(false) {} | 164 MockRenderWidgetHostDelegate() : rwh_(nullptr), is_fullscreen_(false) {} |
162 ~MockRenderWidgetHostDelegate() override {} | 165 ~MockRenderWidgetHostDelegate() override {} |
163 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } | 166 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } |
164 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } | 167 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } |
165 void set_is_fullscreen(bool is_fullscreen) { is_fullscreen_ = is_fullscreen; } | 168 void set_is_fullscreen(bool is_fullscreen) { is_fullscreen_ = is_fullscreen; } |
169 TextInputManager* GetTextInputManager() override { | |
170 return &text_input_manager_; | |
171 } | |
166 | 172 |
167 protected: | 173 protected: |
168 // RenderWidgetHostDelegate: | 174 // RenderWidgetHostDelegate: |
169 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 175 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
170 bool* is_keyboard_shortcut) override { | 176 bool* is_keyboard_shortcut) override { |
171 last_event_.reset(new NativeWebKeyboardEvent(event)); | 177 last_event_.reset(new NativeWebKeyboardEvent(event)); |
172 return true; | 178 return true; |
173 } | 179 } |
174 void Cut() override {} | 180 void Cut() override {} |
175 void Copy() override {} | 181 void Copy() override {} |
176 void Paste() override {} | 182 void Paste() override {} |
177 void SelectAll() override {} | 183 void SelectAll() override {} |
178 void SendScreenRects() override { | 184 void SendScreenRects() override { |
179 if (rwh_) | 185 if (rwh_) |
180 rwh_->SendScreenRects(); | 186 rwh_->SendScreenRects(); |
181 } | 187 } |
182 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } | 188 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } |
183 | 189 |
184 private: | 190 private: |
185 std::unique_ptr<NativeWebKeyboardEvent> last_event_; | 191 std::unique_ptr<NativeWebKeyboardEvent> last_event_; |
186 RenderWidgetHostImpl* rwh_; | 192 RenderWidgetHostImpl* rwh_; |
187 bool is_fullscreen_; | 193 bool is_fullscreen_; |
194 TextInputManager text_input_manager_; | |
188 | 195 |
189 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); | 196 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); |
190 }; | 197 }; |
191 | 198 |
192 // Simple observer that keeps track of changes to a window for tests. | 199 // Simple observer that keeps track of changes to a window for tests. |
193 class TestWindowObserver : public aura::WindowObserver { | 200 class TestWindowObserver : public aura::WindowObserver { |
194 public: | 201 public: |
195 explicit TestWindowObserver(aura::Window* window_to_observe) | 202 explicit TestWindowObserver(aura::Window* window_to_observe) |
196 : window_(window_to_observe) { | 203 : window_(window_to_observe) { |
197 window_->AddObserver(this); | 204 window_->AddObserver(this); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 const blink::WebInputEvent* event = std::get<0>(params); | 544 const blink::WebInputEvent* event = std::get<0>(params); |
538 SendTouchEventACK(event->type, ack_result, | 545 SendTouchEventACK(event->type, ack_result, |
539 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 546 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
540 } | 547 } |
541 | 548 |
542 const ui::MotionEventAura& pointer_state() { | 549 const ui::MotionEventAura& pointer_state() { |
543 return view_->pointer_state_for_test(); | 550 return view_->pointer_state_for_test(); |
544 } | 551 } |
545 | 552 |
546 protected: | 553 protected: |
554 BrowserContext* browser_context() { return browser_context_.get(); } | |
555 | |
556 void SetTextInputTypeForView(RenderWidgetHostViewBase* view, | |
557 ui::TextInputType type) { | |
558 TextInputState state; | |
559 state.type = type; | |
560 view->TextInputStateChanged(state); | |
561 } | |
562 | |
547 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 563 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
548 bool widget_host_uses_shutdown_to_destroy_; | 564 bool widget_host_uses_shutdown_to_destroy_; |
549 | 565 |
550 bool is_guest_view_hack_; | 566 bool is_guest_view_hack_; |
551 | 567 |
552 base::MessageLoopForUI message_loop_; | 568 base::MessageLoopForUI message_loop_; |
553 BrowserThreadImpl browser_thread_for_ui_; | 569 BrowserThreadImpl browser_thread_for_ui_; |
554 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 570 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
555 std::unique_ptr<BrowserContext> browser_context_; | 571 std::unique_ptr<BrowserContext> browser_context_; |
556 std::vector<std::unique_ptr<MockRenderWidgetHostDelegate>> delegates_; | 572 std::vector<std::unique_ptr<MockRenderWidgetHostDelegate>> delegates_; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 EXPECT_TRUE(observer.destroyed()); | 1090 EXPECT_TRUE(observer.destroyed()); |
1075 | 1091 |
1076 widget_host_ = NULL; | 1092 widget_host_ = NULL; |
1077 view_ = NULL; | 1093 view_ = NULL; |
1078 } | 1094 } |
1079 | 1095 |
1080 // Checks that IME-composition-event state is maintained correctly. | 1096 // Checks that IME-composition-event state is maintained correctly. |
1081 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 1097 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
1082 view_->InitAsChild(NULL); | 1098 view_->InitAsChild(NULL); |
1083 view_->Show(); | 1099 view_->Show(); |
1100 SetTextInputTypeForView(view_, ui::TEXT_INPUT_TYPE_TEXT); | |
1084 | 1101 |
1085 ui::CompositionText composition_text; | 1102 ui::CompositionText composition_text; |
1086 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1103 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1087 | 1104 |
1088 // Focused segment | 1105 // Focused segment |
1089 composition_text.underlines.push_back( | 1106 composition_text.underlines.push_back( |
1090 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1107 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1091 | 1108 |
1092 // Non-focused segment, with different background color. | 1109 // Non-focused segment, with different background color. |
1093 composition_text.underlines.push_back( | 1110 composition_text.underlines.push_back( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 | 1145 |
1129 view_->ImeCancelComposition(); | 1146 view_->ImeCancelComposition(); |
1130 EXPECT_FALSE(view_->has_composition_text_); | 1147 EXPECT_FALSE(view_->has_composition_text_); |
1131 } | 1148 } |
1132 | 1149 |
1133 // Checks that sequence of IME-composition-event and mouse-event when mouse | 1150 // Checks that sequence of IME-composition-event and mouse-event when mouse |
1134 // clicking to cancel the composition. | 1151 // clicking to cancel the composition. |
1135 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { | 1152 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { |
1136 view_->InitAsChild(NULL); | 1153 view_->InitAsChild(NULL); |
1137 view_->Show(); | 1154 view_->Show(); |
1155 SetTextInputTypeForView(view_, ui::TEXT_INPUT_TYPE_TEXT); | |
1138 | 1156 |
1139 ui::CompositionText composition_text; | 1157 ui::CompositionText composition_text; |
1140 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1158 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1141 | 1159 |
1142 // Focused segment | 1160 // Focused segment |
1143 composition_text.underlines.push_back( | 1161 composition_text.underlines.push_back( |
1144 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1162 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1145 | 1163 |
1146 // Non-focused segment, with different background color. | 1164 // Non-focused segment, with different background color. |
1147 composition_text.underlines.push_back( | 1165 composition_text.underlines.push_back( |
(...skipping 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4483 100, 100, 0, ui::EventTimeForNow(), event_details); | 4501 100, 100, 0, ui::EventTimeForNow(), event_details); |
4484 view()->OnGestureEvent(&gesture_event); | 4502 view()->OnGestureEvent(&gesture_event); |
4485 | 4503 |
4486 EXPECT_TRUE(delegate->context_menu_request_received()); | 4504 EXPECT_TRUE(delegate->context_menu_request_received()); |
4487 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); | 4505 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); |
4488 #endif | 4506 #endif |
4489 | 4507 |
4490 RenderViewHostFactory::set_is_real_render_view_host(false); | 4508 RenderViewHostFactory::set_is_real_render_view_host(false); |
4491 } | 4509 } |
4492 | 4510 |
4511 // ---------------------------------------------------------------------------- | |
4512 // TextInputManager and IME-Related Tests | |
4513 | |
4514 // A group of tests which verify thatthe IME method results are routed to the | |
kenrb
2016/06/20 16:04:06
nit: "thatthe"
EhsanK
2016/06/22 18:26:32
Done.
| |
4515 // right RenderWidget in the OOPIF structure. | |
4516 // In each test, 3 views are created where one is in process with main frame and | |
4517 // the other two are in distinct processes. This makes a total of 4 RWHV. Then, | |
4518 // each tests is about one of the IME result methods. The method is called on | |
kenrb
2016/06/20 16:04:06
I am not clear what this sentence is trying to say
EhsanK
2016/06/22 18:26:33
Acknowledged.
| |
4519 // ui::TextInputClient (i.e., RWHV for the tab in aura) and then the test | |
4520 // verifies that the IPC is routed to the RenderWidget corresponding to the | |
4521 // active view (i.e., the RenderWidget with focused <input>). | |
4522 class InputMethodResultAuraTest : public RenderWidgetHostViewAuraTest { | |
4523 public: | |
4524 InputMethodResultAuraTest() {} | |
4525 ~InputMethodResultAuraTest() override {} | |
4526 | |
4527 void SetUp() override { | |
4528 RenderWidgetHostViewAuraTest::SetUp(); | |
4529 InitializeAura(); | |
4530 text_input_manager_ = render_widget_host_delegate()->GetTextInputManager(); | |
4531 | |
4532 view_for_first_process_ = CreateViewForProcess(tab_process()); | |
4533 | |
4534 second_process_host_ = CreateNewProcessHost(); | |
4535 view_for_second_process_ = CreateViewForProcess(second_process_host_); | |
4536 | |
4537 third_process_host_ = CreateNewProcessHost(); | |
4538 view_for_third_process_ = CreateViewForProcess(third_process_host_); | |
4539 | |
4540 views_.insert(views_.begin(), | |
4541 {tab_view(), view_for_first_process_, | |
4542 view_for_second_process_, view_for_third_process_}); | |
4543 processes_.insert(processes_.begin(), | |
4544 {tab_process(), tab_process(), second_process_host_, | |
4545 third_process_host_}); | |
4546 } | |
4547 | |
4548 void TearDown() override { | |
4549 RenderWidgetHost* host_for_second_process = | |
4550 view_for_second_process_->GetRenderWidgetHost(); | |
4551 view_for_second_process_->Destroy(); | |
4552 delete host_for_second_process; | |
4553 | |
4554 RenderWidgetHost* host_for_third_process = | |
4555 view_for_third_process_->GetRenderWidgetHost(); | |
4556 view_for_third_process_->Destroy(); | |
4557 delete host_for_third_process; | |
4558 | |
4559 // This one is in-process with tab. The base class will clean the widget. | |
4560 view_for_first_process_->Destroy(); | |
4561 | |
4562 RenderWidgetHostViewAuraTest::TearDown(); | |
4563 } | |
4564 | |
4565 const IPC::Message* RunAndReturnIPCSent(const base::Closure closure, | |
4566 MockRenderProcessHost* process, | |
4567 int32_t message_id) { | |
4568 process->sink().ClearMessages(); | |
4569 closure.Run(); | |
4570 return process->sink().GetFirstMessageMatching(message_id); | |
4571 } | |
4572 | |
4573 void ActivateView(RenderWidgetHostViewBase* view) { | |
4574 if (text_input_manager()->GetActiveWidget()) { | |
4575 text_input_manager()->GetActiveWidget()->GetView()->TextInputStateChanged( | |
4576 TextInputState()); | |
4577 } | |
4578 | |
4579 if (!view) | |
4580 return; | |
4581 | |
4582 TextInputState state_with_type_text; | |
4583 state_with_type_text.type = ui::TEXT_INPUT_TYPE_TEXT; | |
4584 view->TextInputStateChanged(state_with_type_text); | |
4585 } | |
4586 | |
4587 TextInputManager* text_input_manager() { return text_input_manager_; } | |
4588 | |
4589 MockRenderProcessHost* tab_process() const { return process_host_; } | |
4590 | |
4591 RenderWidgetHostViewAura* tab_view() const { return view_; } | |
4592 | |
4593 MockRenderWidgetHostDelegate* render_widget_host_delegate() const { | |
4594 return delegates_.back().get(); | |
4595 } | |
4596 | |
4597 ui::TextInputClient* text_input_client() const { return view_; } | |
4598 | |
4599 bool has_composition_text() const { | |
4600 return tab_view()->has_composition_text_; | |
4601 } | |
4602 | |
4603 MockRenderProcessHost* CreateNewProcessHost() { | |
4604 MockRenderProcessHost* process_host = | |
4605 new MockRenderProcessHost(browser_context()); | |
4606 return process_host; | |
4607 } | |
4608 | |
4609 RenderWidgetHostImpl* CreateRenderWidgetHostForProcess( | |
4610 MockRenderProcessHost* process_host) { | |
4611 RenderWidgetHostImpl* render_widget_host = | |
Charlie Reis
2016/06/21 21:13:56
Might be easier to read if you avoid declaring it
EhsanK
2016/06/22 18:26:32
Acknowledged.
| |
4612 new RenderWidgetHostImpl(render_widget_host_delegate(), process_host, | |
4613 process_host->GetNextRoutingID(), false); | |
4614 return render_widget_host; | |
4615 } | |
4616 | |
4617 TestRenderWidgetHostView* CreateViewForProcess( | |
4618 MockRenderProcessHost* process_host) { | |
4619 RenderWidgetHostImpl* host = CreateRenderWidgetHostForProcess(process_host); | |
4620 TestRenderWidgetHostView* view = new TestRenderWidgetHostView(host); | |
4621 host->SetView(view); | |
4622 return view; | |
4623 } | |
4624 | |
4625 void SetHasCompositionTextToTrue() { | |
4626 ui::CompositionText composition_text; | |
4627 composition_text.text = base::ASCIIToUTF16("text"); | |
4628 tab_view()->SetCompositionText(composition_text); | |
4629 EXPECT_TRUE(has_composition_text()); | |
4630 } | |
4631 | |
4632 std::vector<RenderWidgetHostViewBase*> views_; | |
4633 std::vector<MockRenderProcessHost*> processes_; | |
4634 | |
4635 private: | |
4636 // This will initialize |window_| in RenderWidgetHostViewAura. It is needed | |
4637 // for RenderWidgetHostViewAura::GetInputMethod() to work. | |
4638 void InitializeAura() { | |
4639 view_->InitAsChild(nullptr); | |
4640 view_->Show(); | |
4641 } | |
4642 | |
4643 TextInputManager* text_input_manager_; | |
4644 TestRenderWidgetHostView* view_for_first_process_; | |
4645 MockRenderProcessHost* second_process_host_; | |
4646 TestRenderWidgetHostView* view_for_second_process_; | |
4647 MockRenderProcessHost* third_process_host_; | |
4648 TestRenderWidgetHostView* view_for_third_process_; | |
4649 | |
4650 DISALLOW_COPY_AND_ASSIGN(InputMethodResultAuraTest); | |
4651 }; | |
4652 | |
4653 // This test verifies that ui::TextInputClient::SetCompositionText call leads to | |
4654 // IPC message InputMsg_ImeSetComposition sent to the right RendererProcess. | |
Charlie Reis
2016/06/21 21:13:56
nit: being sent
nit: renderer process (since Rende
EhsanK
2016/06/22 18:26:33
Done.
| |
4655 TEST_F(InputMethodResultAuraTest, SetCompositionText) { | |
4656 std::vector<size_t> activation_sequence{0, 1, 2, 1, 1, 3, 0, 3, 1}; | |
Charlie Reis
2016/06/21 21:13:56
nit: This needs a comment and/or a clearer name.
EhsanK
2016/06/22 18:26:33
Acknowledged.
| |
4657 base::Closure ime_call = | |
4658 base::Bind(&ui::TextInputClient::SetCompositionText, | |
4659 base::Unretained(text_input_client()), ui::CompositionText()); | |
4660 for (auto index : activation_sequence) { | |
4661 ActivateView(views_[index]); | |
4662 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], | |
4663 InputMsg_ImeSetComposition::ID)); | |
4664 } | |
4665 } | |
4666 | |
4667 // This test verifies that ui::TextInputClient::ConfirmCompositionText call | |
4668 // leads to IPC message InputMsg_ImeConfirmComposition sent to the right | |
4669 // RendererProcess. | |
4670 TEST_F(InputMethodResultAuraTest, ConfirmCompositionText) { | |
4671 std::vector<size_t> activation_sequence{0, 1, 2, 1, 1, 3, 0, 3, 1}; | |
4672 base::Closure ime_call = | |
4673 base::Bind(&ui::TextInputClient::ConfirmCompositionText, | |
4674 base::Unretained(text_input_client())); | |
4675 for (auto index : activation_sequence) { | |
4676 ActivateView(views_[index]); | |
4677 SetHasCompositionTextToTrue(); | |
4678 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], | |
4679 InputMsg_ImeConfirmComposition::ID)); | |
4680 } | |
4681 } | |
4682 | |
4683 // This test verifies that ui::TextInputClient::ConfirmCompositionText call | |
4684 // leads to IPC message InputMsg_ImeSetComposition sent to the right | |
4685 // RendererProcess. | |
4686 TEST_F(InputMethodResultAuraTest, ClearCompositionText) { | |
4687 std::vector<size_t> activation_sequence{0, 1, 2, 1, 1, 3, 0, 3, 1}; | |
4688 base::Closure ime_call = | |
4689 base::Bind(&ui::TextInputClient::ClearCompositionText, | |
4690 base::Unretained(text_input_client())); | |
4691 for (auto index : activation_sequence) { | |
4692 ActivateView(views_[index]); | |
4693 SetHasCompositionTextToTrue(); | |
4694 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], | |
4695 InputMsg_ImeSetComposition::ID)); | |
4696 } | |
4697 } | |
4698 | |
4699 // This test verifies that ui::TextInputClient::InsertText call leads to IPC | |
4700 // message InputMsg_ImeSetComposition sent to the right RendererProcess. | |
4701 TEST_F(InputMethodResultAuraTest, InsertText) { | |
4702 std::vector<size_t> activation_sequence{0, 1, 2, 1, 1, 3, 0, 3, 1}; | |
4703 base::Closure ime_call = | |
4704 base::Bind(&ui::TextInputClient::InsertText, | |
4705 base::Unretained(text_input_client()), base::string16()); | |
4706 for (auto index : activation_sequence) { | |
4707 ActivateView(views_[index]); | |
4708 EXPECT_TRUE(!!RunAndReturnIPCSent(ime_call, processes_[index], | |
4709 InputMsg_ImeConfirmComposition::ID)); | |
4710 } | |
4711 } | |
4712 | |
4493 } // namespace content | 4713 } // namespace content |
OLD | NEW |