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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 3550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 | 3561 |
3562 bool IsActive() const override { return true; } | 3562 bool IsActive() const override { return true; } |
3563 | 3563 |
3564 private: | 3564 private: |
3565 DISALLOW_COPY_AND_ASSIGN(ActiveWidget); | 3565 DISALLOW_COPY_AND_ASSIGN(ActiveWidget); |
3566 }; | 3566 }; |
3567 | 3567 |
3568 TEST_F(ViewTest, AdvanceFocusIfNecessaryForUnfocusableView) { | 3568 TEST_F(ViewTest, AdvanceFocusIfNecessaryForUnfocusableView) { |
3569 // Create a widget with two views and give the first one focus. | 3569 // Create a widget with two views and give the first one focus. |
3570 ActiveWidget widget; | 3570 ActiveWidget widget; |
3571 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); | 3571 Widget::InitParams params = |
| 3572 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
3572 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 3573 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
3573 widget.Init(params); | 3574 widget.Init(params); |
| 3575 widget.Show(); |
3574 | 3576 |
3575 View* view1 = new View(); | 3577 View* view1 = new View(); |
3576 view1->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 3578 view1->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
3577 | 3579 |
3578 widget.GetRootView()->AddChildView(view1); | 3580 widget.GetRootView()->AddChildView(view1); |
3579 View* view2 = new View(); | 3581 View* view2 = new View(); |
3580 view2->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 3582 view2->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
3581 widget.GetRootView()->AddChildView(view2); | 3583 widget.GetRootView()->AddChildView(view2); |
3582 | 3584 |
3583 FocusManager* focus_manager = widget.GetFocusManager(); | 3585 FocusManager* focus_manager = widget.GetFocusManager(); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4571 widget.Init(params); | 4573 widget.Init(params); |
4572 | 4574 |
4573 AddViewWithChildLayer(widget.GetRootView()); | 4575 AddViewWithChildLayer(widget.GetRootView()); |
4574 ViewThatAddsViewInOnNativeThemeChanged* v = | 4576 ViewThatAddsViewInOnNativeThemeChanged* v = |
4575 new ViewThatAddsViewInOnNativeThemeChanged; | 4577 new ViewThatAddsViewInOnNativeThemeChanged; |
4576 widget.GetRootView()->AddChildView(v); | 4578 widget.GetRootView()->AddChildView(v); |
4577 EXPECT_TRUE(v->on_native_theme_changed_called()); | 4579 EXPECT_TRUE(v->on_native_theme_changed_called()); |
4578 } | 4580 } |
4579 | 4581 |
4580 } // namespace views | 4582 } // namespace views |
OLD | NEW |