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() { return &text_input_manager_; } | |
166 | 170 |
167 protected: | 171 protected: |
168 // RenderWidgetHostDelegate: | 172 // RenderWidgetHostDelegate: |
169 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 173 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
170 bool* is_keyboard_shortcut) override { | 174 bool* is_keyboard_shortcut) override { |
171 last_event_.reset(new NativeWebKeyboardEvent(event)); | 175 last_event_.reset(new NativeWebKeyboardEvent(event)); |
172 return true; | 176 return true; |
173 } | 177 } |
174 void Cut() override {} | 178 void Cut() override {} |
175 void Copy() override {} | 179 void Copy() override {} |
176 void Paste() override {} | 180 void Paste() override {} |
177 void SelectAll() override {} | 181 void SelectAll() override {} |
178 void SendScreenRects() override { | 182 void SendScreenRects() override { |
179 if (rwh_) | 183 if (rwh_) |
180 rwh_->SendScreenRects(); | 184 rwh_->SendScreenRects(); |
181 } | 185 } |
182 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } | 186 bool IsFullscreenForCurrentTab() const override { return is_fullscreen_; } |
183 | 187 |
184 private: | 188 private: |
185 std::unique_ptr<NativeWebKeyboardEvent> last_event_; | 189 std::unique_ptr<NativeWebKeyboardEvent> last_event_; |
186 RenderWidgetHostImpl* rwh_; | 190 RenderWidgetHostImpl* rwh_; |
187 bool is_fullscreen_; | 191 bool is_fullscreen_; |
192 TextInputManager text_input_manager_; | |
188 | 193 |
189 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); | 194 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); |
190 }; | 195 }; |
191 | 196 |
192 // Simple observer that keeps track of changes to a window for tests. | 197 // Simple observer that keeps track of changes to a window for tests. |
193 class TestWindowObserver : public aura::WindowObserver { | 198 class TestWindowObserver : public aura::WindowObserver { |
194 public: | 199 public: |
195 explicit TestWindowObserver(aura::Window* window_to_observe) | 200 explicit TestWindowObserver(aura::Window* window_to_observe) |
196 : window_(window_to_observe) { | 201 : window_(window_to_observe) { |
197 window_->AddObserver(this); | 202 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); | 542 const blink::WebInputEvent* event = std::get<0>(params); |
538 SendTouchEventACK(event->type, ack_result, | 543 SendTouchEventACK(event->type, ack_result, |
539 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 544 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
540 } | 545 } |
541 | 546 |
542 const ui::MotionEventAura& pointer_state() { | 547 const ui::MotionEventAura& pointer_state() { |
543 return view_->pointer_state_for_test(); | 548 return view_->pointer_state_for_test(); |
544 } | 549 } |
545 | 550 |
546 protected: | 551 protected: |
552 void SetTextInputTypeForView(RenderWidgetHostViewBase* view, | |
553 ui::TextInputType type) { | |
554 TextInputState state; | |
555 state.type = type; | |
556 view->TextInputStateChanged(state); | |
557 } | |
558 | |
547 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 559 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
548 bool widget_host_uses_shutdown_to_destroy_; | 560 bool widget_host_uses_shutdown_to_destroy_; |
549 | 561 |
550 bool is_guest_view_hack_; | 562 bool is_guest_view_hack_; |
551 | 563 |
552 base::MessageLoopForUI message_loop_; | 564 base::MessageLoopForUI message_loop_; |
553 BrowserThreadImpl browser_thread_for_ui_; | 565 BrowserThreadImpl browser_thread_for_ui_; |
554 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 566 std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
555 std::unique_ptr<BrowserContext> browser_context_; | 567 std::unique_ptr<BrowserContext> browser_context_; |
556 std::vector<std::unique_ptr<MockRenderWidgetHostDelegate>> delegates_; | 568 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()); | 1086 EXPECT_TRUE(observer.destroyed()); |
1075 | 1087 |
1076 widget_host_ = NULL; | 1088 widget_host_ = NULL; |
1077 view_ = NULL; | 1089 view_ = NULL; |
1078 } | 1090 } |
1079 | 1091 |
1080 // Checks that IME-composition-event state is maintained correctly. | 1092 // Checks that IME-composition-event state is maintained correctly. |
1081 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 1093 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
1082 view_->InitAsChild(NULL); | 1094 view_->InitAsChild(NULL); |
1083 view_->Show(); | 1095 view_->Show(); |
1096 SetTextInputTypeForView(view_, ui::TEXT_INPUT_TYPE_TEXT); | |
EhsanK
2016/06/08 16:58:43
Changes such as this are needed in the new archite
| |
1084 | 1097 |
1085 ui::CompositionText composition_text; | 1098 ui::CompositionText composition_text; |
1086 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1099 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1087 | 1100 |
1088 // Focused segment | 1101 // Focused segment |
1089 composition_text.underlines.push_back( | 1102 composition_text.underlines.push_back( |
1090 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1103 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1091 | 1104 |
1092 // Non-focused segment, with different background color. | 1105 // Non-focused segment, with different background color. |
1093 composition_text.underlines.push_back( | 1106 composition_text.underlines.push_back( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 | 1141 |
1129 view_->ImeCancelComposition(); | 1142 view_->ImeCancelComposition(); |
1130 EXPECT_FALSE(view_->has_composition_text_); | 1143 EXPECT_FALSE(view_->has_composition_text_); |
1131 } | 1144 } |
1132 | 1145 |
1133 // Checks that sequence of IME-composition-event and mouse-event when mouse | 1146 // Checks that sequence of IME-composition-event and mouse-event when mouse |
1134 // clicking to cancel the composition. | 1147 // clicking to cancel the composition. |
1135 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { | 1148 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { |
1136 view_->InitAsChild(NULL); | 1149 view_->InitAsChild(NULL); |
1137 view_->Show(); | 1150 view_->Show(); |
1151 SetTextInputTypeForView(view_, ui::TEXT_INPUT_TYPE_TEXT); | |
1138 | 1152 |
1139 ui::CompositionText composition_text; | 1153 ui::CompositionText composition_text; |
1140 composition_text.text = base::ASCIIToUTF16("|a|b"); | 1154 composition_text.text = base::ASCIIToUTF16("|a|b"); |
1141 | 1155 |
1142 // Focused segment | 1156 // Focused segment |
1143 composition_text.underlines.push_back( | 1157 composition_text.underlines.push_back( |
1144 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); | 1158 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
1145 | 1159 |
1146 // Non-focused segment, with different background color. | 1160 // Non-focused segment, with different background color. |
1147 composition_text.underlines.push_back( | 1161 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); | 4497 100, 100, 0, ui::EventTimeForNow(), event_details); |
4484 view()->OnGestureEvent(&gesture_event); | 4498 view()->OnGestureEvent(&gesture_event); |
4485 | 4499 |
4486 EXPECT_TRUE(delegate->context_menu_request_received()); | 4500 EXPECT_TRUE(delegate->context_menu_request_received()); |
4487 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); | 4501 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); |
4488 #endif | 4502 #endif |
4489 | 4503 |
4490 RenderViewHostFactory::set_is_real_render_view_host(false); | 4504 RenderViewHostFactory::set_is_real_render_view_host(false); |
4491 } | 4505 } |
4492 | 4506 |
4507 // ---------------------------------------------------------------------------- | |
4508 // TextInputManager and IME-Related Tests | |
4509 | |
4510 class TextInputManagerTestBase : public RenderWidgetHostViewAuraTest { | |
kenrb
2016/06/13 19:37:47
Is this needed, or is it feasible to roll this int
EhsanK
2016/06/17 22:36:20
Moved into the actual test class which was subclas
| |
4511 public: | |
4512 TextInputManagerTestBase(){}; | |
4513 ~TextInputManagerTestBase() override {} | |
4514 | |
4515 void SetUp() override { | |
4516 RenderWidgetHostViewAuraTest::SetUp(); | |
4517 InitializeAura(); | |
4518 text_input_manager_ = render_widget_host_delegate()->GetTextInputManager(); | |
4519 } | |
4520 | |
4521 protected: | |
4522 MockRenderProcessHost* CreateNewProcessHost() { | |
4523 MockRenderProcessHost* process_host = | |
4524 new MockRenderProcessHost(&test_browser_context_); | |
4525 return process_host; | |
4526 } | |
4527 | |
4528 RenderWidgetHostImpl* CreateRenderWidgetHostForProcess( | |
4529 MockRenderProcessHost* process_host) { | |
4530 RenderWidgetHostImpl* render_widget_host = | |
4531 new RenderWidgetHostImpl(render_widget_host_delegate(), process_host, | |
4532 process_host->GetNextRoutingID(), false); | |
4533 return render_widget_host; | |
4534 } | |
4535 | |
4536 TestRenderWidgetHostView* CreateViewForProcess( | |
4537 MockRenderProcessHost* process_host) { | |
4538 RenderWidgetHostImpl* host = CreateRenderWidgetHostForProcess(process_host); | |
4539 TestRenderWidgetHostView* view = new TestRenderWidgetHostView(host); | |
4540 host->SetView(view); | |
4541 return view; | |
4542 } | |
4543 | |
4544 TextInputManager* text_input_manager() const { return text_input_manager_; } | |
4545 | |
4546 MockRenderProcessHost* tab_process() const { return process_host_; } | |
4547 | |
4548 RenderWidgetHostViewAura* tab_view() const { return view_; } | |
4549 | |
4550 MockRenderWidgetHostDelegate* render_widget_host_delegate() const { | |
4551 return delegates_.back().get(); | |
4552 } | |
4553 | |
4554 bool has_composition_text() const { | |
4555 return tab_view()->has_composition_text_; | |
4556 } | |
4557 | |
4558 private: | |
4559 // This will initialize |window_| in RenderWidgetHostViewAura. It is needed | |
4560 // for RenderWidgetHostViewAura::GetInputMethod() to work. | |
4561 void InitializeAura() { | |
4562 view_->InitAsChild(nullptr); | |
4563 view_->Show(); | |
4564 } | |
4565 | |
4566 TextInputManager* text_input_manager_; | |
4567 TestBrowserContext test_browser_context_; | |
4568 MockRenderProcessHost* tab_process_; | |
4569 RenderWidgetHostViewAura* tab_view_; | |
4570 }; | |
4571 | |
4572 // A group of tests which veirfy the correctness of routing of the IME method | |
4573 // results. This category of tests creates a scenario with two out of process | |
4574 // renderers, each with a view, and a child frame view in process with the tab | |
4575 // (a total of four RWHV with the tab. This makes a total of four RWHV for | |
4576 // testing. Then, in each test one of the IME result methods are called on the | |
4577 // ui::TextInputClient (RenderWidgetHostViewAura) and then the tests verify that | |
4578 // the call leads to sending an IPC to the corresponding renderer process. | |
kenrb
2016/06/13 19:37:47
A couple of typos in this paragraph: 'veirfy', and
EhsanK
2016/06/17 22:36:20
Acknowledged.
| |
4579 class InputMethodResultAuraTest : public TextInputManagerTestBase { | |
4580 public: | |
4581 InputMethodResultAuraTest() {} | |
4582 ~InputMethodResultAuraTest() override {} | |
4583 | |
4584 void SetUp() override { | |
4585 TextInputManagerTestBase::SetUp(); | |
4586 | |
4587 MockRenderProcessHost* second_process_host = CreateNewProcessHost(); | |
4588 MockRenderProcessHost* third_process_host = CreateNewProcessHost(); | |
4589 | |
4590 TestRenderWidgetHostView* second_process_view = | |
4591 CreateViewForProcess(second_process_host); | |
4592 TestRenderWidgetHostView* third_process_view = | |
4593 CreateViewForProcess(third_process_host); | |
4594 TestRenderWidgetHostView* tab_process_child_view = | |
4595 CreateViewForProcess(tab_process()); | |
4596 | |
4597 views_.insert(views_.begin(), {tab_view(), second_process_view, | |
4598 third_process_view, tab_process_child_view}); | |
4599 processes_.insert(processes_.begin(), {tab_process(), second_process_host, | |
4600 third_process_host, tab_process()}); | |
4601 } | |
4602 | |
4603 void TearDown() override { | |
4604 RenderWidgetHost* host = views_[1]->GetRenderWidgetHost(); | |
4605 views_[1]->Destroy(); | |
4606 delete host; | |
4607 | |
4608 host = views_[2]->GetRenderWidgetHost(); | |
4609 views_[2]->Destroy(); | |
4610 delete host; | |
4611 | |
4612 // This one is in-process with tab. The base class will clean the widget. | |
4613 views_[3]->Destroy(); | |
4614 | |
4615 TextInputManagerTestBase::TearDown(); | |
4616 } | |
4617 | |
4618 const IPC::Message* RunAndReturnIPCSent(const base::Closure closure, | |
4619 MockRenderProcessHost* process, | |
4620 int32_t message_id) { | |
4621 process->sink().ClearMessages(); | |
4622 closure.Run(); | |
4623 return process->sink().GetFirstMessageMatching(message_id); | |
4624 } | |
4625 | |
4626 void ActivateView(RenderWidgetHostViewBase* view) { | |
4627 if (text_input_manager()->GetActiveView()) { | |
4628 text_input_manager()->GetActiveView()->TextInputStateChanged( | |
4629 TextInputState()); | |
4630 } | |
4631 | |
4632 if (!view) | |
4633 return; | |
4634 | |
4635 TextInputState state_with_type_text; | |
4636 state_with_type_text.type = ui::TEXT_INPUT_TYPE_TEXT; | |
4637 view->TextInputStateChanged(state_with_type_text); | |
4638 } | |
4639 | |
4640 ui::TextInputClient* text_input_client() const { return tab_view(); } | |
4641 | |
4642 protected: | |
4643 void SetHasCompositionTextToTrue() { | |
4644 ui::CompositionText composition_text; | |
4645 composition_text.text = base::ASCIIToUTF16("text"); | |
4646 tab_view()->SetCompositionText(composition_text); | |
4647 EXPECT_TRUE(has_composition_text()); | |
4648 } | |
4649 std::vector<RenderWidgetHostViewBase*> views_; | |
4650 std::vector<MockRenderProcessHost*> processes_; | |
4651 }; | |
4652 | |
4653 // This test verifies that ui::TextInputClient::SetCompositionText call leads to | |
4654 // IPC message InputMsg_ImeSetComposition sent to the right RendererProcess. | |
4655 TEST_F(InputMethodResultAuraTest, SetCompositionText) { | |
4656 std::vector<size_t> activation_sequence{0, 1, 2, 1, 1, 3, 0, 3, 1}; | |
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 |