OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/aura/window.h" | |
6 #include "ui/base/ime/dummy_input_method_delegate.h" | |
7 #include "ui/base/ime/input_method_minimal.h" | |
8 #include "ui/base/ime/text_input_client.h" | |
9 #include "ui/views/ime/input_method.h" | 5 #include "ui/views/ime/input_method.h" |
10 #include "ui/views/test/views_test_base.h" | 6 #include "ui/views/test/widget_test.h" |
11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | |
12 #include "ui/views/widget/native_widget_aura.h" | |
13 #include "ui/views/widget/widget.h" | 7 #include "ui/views/widget/widget.h" |
14 | 8 |
15 namespace views { | 9 namespace views { |
16 | 10 |
17 typedef ViewsTestBase InputMethodBridgeTest; | 11 using InputMethodBridgeTest = test::WidgetTest; |
18 | 12 |
19 TEST_F(InputMethodBridgeTest, DestructTest) { | 13 TEST_F(InputMethodBridgeTest, DestructTest) { |
20 ui::internal::DummyInputMethodDelegate input_method_delegate; | 14 Widget* toplevel = CreateNativeDesktopWidget(); |
21 ui::InputMethodMinimal input_method(&input_method_delegate); | |
tapted
2015/06/24 05:24:22
http://crrev.com/333698 removed a line below this
| |
22 | |
23 Widget* toplevel = new Widget; | |
24 Widget::InitParams toplevel_params = | |
25 CreateParams(Widget::InitParams::TYPE_WINDOW); | |
26 // |child| owns |native_widget|. | |
27 toplevel_params.native_widget = new DesktopNativeWidgetAura(toplevel); | |
28 toplevel->Init(toplevel_params); | |
29 | 15 |
30 Widget* child = new Widget; | 16 Widget* child = new Widget; |
31 Widget::InitParams child_params = | 17 Widget::InitParams child_params = |
32 CreateParams(Widget::InitParams::TYPE_POPUP); | 18 CreateParams(Widget::InitParams::TYPE_POPUP); |
33 child_params.parent = toplevel->GetNativeView(); | 19 child_params.parent = toplevel->GetNativeView(); |
34 // |child| owns |native_widget|. | 20 // |child| owns |native_widget|. |
35 child_params.native_widget = new NativeWidgetAura(child); | 21 child_params.native_widget = new PlatformNativeWidget(child); |
36 child->Init(child_params); | 22 child->Init(child_params); |
37 | 23 |
24 // Both the views::InputMethod and the "host" ui::InputMethod are created | |
25 // lazily. Requesting the views::InputMethod (owned by Widget) will also | |
26 // create the ui::InputMethod (owned by NativeWidget) to build the bridge. | |
27 EXPECT_TRUE(child->GetInputMethod()); | |
38 child->GetInputMethod()->OnFocus(); | 28 child->GetInputMethod()->OnFocus(); |
39 | 29 |
30 EXPECT_TRUE(toplevel->GetInputMethod()); | |
31 toplevel->GetInputMethod()->OnFocus(); | |
32 | |
40 toplevel->CloseNow(); | 33 toplevel->CloseNow(); |
41 } | 34 } |
42 | 35 |
43 } // namespace views | 36 } // namespace views |
OLD | NEW |