| OLD | NEW |
| 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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/views/controls/textfield/textfield.h" | 8 #include "ui/views/controls/textfield/textfield.h" |
| 9 #include "ui/views/test/native_widget_factory.h" | 9 #include "ui/views/test/native_widget_factory.h" |
| 10 #include "ui/views/test/views_interactive_ui_test_base.h" | 10 #include "ui/views/test/views_interactive_ui_test_base.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 using NativeWidgetAuraTest = ViewsInteractiveUITestBase; | 44 using NativeWidgetAuraTest = ViewsInteractiveUITestBase; |
| 45 | 45 |
| 46 // When requesting view focus from a non-active top level widget, focus is not | 46 // When requesting view focus from a non-active top level widget, focus is not |
| 47 // instantly given. Instead, the view is firstly stored and then it is attempted | 47 // instantly given. Instead, the view is firstly stored and then it is attempted |
| 48 // to activate the widget. If widget is currently not activatable, focus should | 48 // to activate the widget. If widget is currently not activatable, focus should |
| 49 // not be grabbed. And focus will be given/restored the next time the widget is | 49 // not be grabbed. And focus will be given/restored the next time the widget is |
| 50 // made active. (crbug.com/621791) | 50 // made active. (crbug.com/621791) |
| 51 TEST_F(NativeWidgetAuraTest, NonActiveWindowRequestImeFocus) { | 51 TEST_F(NativeWidgetAuraTest, NonActiveWindowRequestImeFocus) { |
| 52 // TODO: test uses GetContext(), which is not applicable to aura-mus. |
| 53 // http://crbug.com/663809. |
| 54 if (IsAuraMusClient()) |
| 55 return; |
| 56 |
| 52 TestFocusRules* test_focus_rules = new TestFocusRules; | 57 TestFocusRules* test_focus_rules = new TestFocusRules; |
| 53 std::unique_ptr<wm::FocusController> focus_controller = | 58 std::unique_ptr<wm::FocusController> focus_controller = |
| 54 base::MakeUnique<wm::FocusController>(test_focus_rules); | 59 base::MakeUnique<wm::FocusController>(test_focus_rules); |
| 55 aura::client::SetActivationClient(GetContext(), focus_controller.get()); | 60 aura::client::SetActivationClient(GetContext(), focus_controller.get()); |
| 56 | 61 |
| 57 Widget* widget1 = new Widget; | 62 Widget* widget1 = new Widget; |
| 58 Widget::InitParams params1(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 63 Widget::InitParams params1(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 59 params1.context = GetContext(); | 64 params1.context = GetContext(); |
| 60 params1.native_widget = | 65 params1.native_widget = |
| 61 CreatePlatformNativeWidgetImpl(params1, widget1, kDefault, nullptr); | 66 CreatePlatformNativeWidgetImpl(params1, widget1, kDefault, nullptr); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 EXPECT_TRUE(textfield2a->HasFocus()); | 105 EXPECT_TRUE(textfield2a->HasFocus()); |
| 101 EXPECT_FALSE(textfield2b->HasFocus()); | 106 EXPECT_FALSE(textfield2b->HasFocus()); |
| 102 EXPECT_FALSE(textfield1->HasFocus()); | 107 EXPECT_FALSE(textfield1->HasFocus()); |
| 103 | 108 |
| 104 widget1->CloseNow(); | 109 widget1->CloseNow(); |
| 105 widget2->CloseNow(); | 110 widget2->CloseNow(); |
| 106 } | 111 } |
| 107 | 112 |
| 108 } // namespace test | 113 } // namespace test |
| 109 } // namespace views | 114 } // namespace views |
| OLD | NEW |