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 "ash/wm/immersive_fullscreen_controller.h" | 5 #include "ash/wm/immersive_fullscreen_controller.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 params.context = CurrentContext(); | 124 params.context = CurrentContext(); |
125 widget_->Init(params); | 125 widget_->Init(params); |
126 widget_->Show(); | 126 widget_->Show(); |
127 | 127 |
128 window()->SetProperty(aura::client::kShowStateKey, | 128 window()->SetProperty(aura::client::kShowStateKey, |
129 ui::SHOW_STATE_FULLSCREEN); | 129 ui::SHOW_STATE_FULLSCREEN); |
130 | 130 |
131 top_container_ = new views::View(); | 131 top_container_ = new views::View(); |
132 top_container_->SetBounds( | 132 top_container_->SetBounds( |
133 0, 0, widget_->GetWindowBoundsInScreen().width(), 100); | 133 0, 0, widget_->GetWindowBoundsInScreen().width(), 100); |
134 top_container_->set_focusable(true); | 134 top_container_->SetFocusable(true); |
135 widget_->GetContentsView()->AddChildView(top_container_); | 135 widget_->GetContentsView()->AddChildView(top_container_); |
136 | 136 |
137 delegate_.reset( | 137 delegate_.reset( |
138 new MockImmersiveFullscreenControllerDelegate(top_container_)); | 138 new MockImmersiveFullscreenControllerDelegate(top_container_)); |
139 controller_.reset(new ImmersiveFullscreenController); | 139 controller_.reset(new ImmersiveFullscreenController); |
140 controller_->Init(delegate_.get(), widget_, top_container_); | 140 controller_->Init(delegate_.get(), widget_, top_container_); |
141 controller_->SetupForTest(); | 141 controller_->SetupForTest(); |
142 | 142 |
143 // The mouse is moved so that it is not over |top_container_| by | 143 // The mouse is moved so that it is not over |top_container_| by |
144 // AshTestBase. | 144 // AshTestBase. |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // Windows. (crbug.com/79493) | 677 // Windows. (crbug.com/79493) |
678 #if !defined(OS_WIN) | 678 #if !defined(OS_WIN) |
679 | 679 |
680 // Test how focus and activation affects whether the top-of-window views are | 680 // Test how focus and activation affects whether the top-of-window views are |
681 // revealed. | 681 // revealed. |
682 TEST_F(ImmersiveFullscreenControllerTest, Focus) { | 682 TEST_F(ImmersiveFullscreenControllerTest, Focus) { |
683 // Add views to the view hierarchy which we will focus and unfocus during the | 683 // Add views to the view hierarchy which we will focus and unfocus during the |
684 // test. | 684 // test. |
685 views::View* child_view = new views::View(); | 685 views::View* child_view = new views::View(); |
686 child_view->SetBounds(0, 0, 10, 10); | 686 child_view->SetBounds(0, 0, 10, 10); |
687 child_view->set_focusable(true); | 687 child_view->SetFocusable(true); |
688 top_container()->AddChildView(child_view); | 688 top_container()->AddChildView(child_view); |
689 views::View* unrelated_view = new views::View(); | 689 views::View* unrelated_view = new views::View(); |
690 unrelated_view->SetBounds(0, 100, 10, 10); | 690 unrelated_view->SetBounds(0, 100, 10, 10); |
691 unrelated_view->set_focusable(true); | 691 unrelated_view->SetFocusable(true); |
692 top_container()->parent()->AddChildView(unrelated_view); | 692 top_container()->parent()->AddChildView(unrelated_view); |
693 views::FocusManager* focus_manager = | 693 views::FocusManager* focus_manager = |
694 top_container()->GetWidget()->GetFocusManager(); | 694 top_container()->GetWidget()->GetFocusManager(); |
695 | 695 |
696 SetEnabled(true); | 696 SetEnabled(true); |
697 | 697 |
698 // 1) Test that the top-of-window views stay revealed as long as either a | 698 // 1) Test that the top-of-window views stay revealed as long as either a |
699 // |child_view| has focus or the mouse is hovered above the top-of-window | 699 // |child_view| has focus or the mouse is hovered above the top-of-window |
700 // views. | 700 // views. |
701 AttemptReveal(MODALITY_MOUSE); | 701 AttemptReveal(MODALITY_MOUSE); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 949 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
950 SetEnabled(false); | 950 SetEnabled(false); |
951 window()->SetProperty(aura::client::kShowStateKey, | 951 window()->SetProperty(aura::client::kShowStateKey, |
952 ui::SHOW_STATE_NORMAL); | 952 ui::SHOW_STATE_NORMAL); |
953 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 953 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
954 } | 954 } |
955 | 955 |
956 } // namespase ash | 956 } // namespase ash |
957 | 957 |
958 #endif // defined(OS_CHROMEOS) | 958 #endif // defined(OS_CHROMEOS) |
OLD | NEW |