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/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/display/mouse_cursor_event_filter.h" | 9 #include "ash/display/mouse_cursor_event_filter.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/display_manager_test_api.h" | 15 #include "ash/test/display_manager_test_api.h" |
16 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
17 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
18 #include "ui/aura/client/cursor_client.h" | 18 #include "ui/aura/client/cursor_client.h" |
19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
20 #include "ui/aura/test/test_window_delegate.h" | 20 #include "ui/aura/test/test_window_delegate.h" |
21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 EXPECT_FALSE(controller()->IsRevealed()); | 1028 EXPECT_FALSE(controller()->IsRevealed()); |
1029 bubble_widget8->Close(); | 1029 bubble_widget8->Close(); |
1030 } | 1030 } |
1031 | 1031 |
1032 #endif // defined(OS_WIN) | 1032 #endif // defined(OS_WIN) |
1033 | 1033 |
1034 // Test that the shelf is set to auto hide as long as the window is in | 1034 // Test that the shelf is set to auto hide as long as the window is in |
1035 // immersive fullscreen and that the shelf's state before entering immersive | 1035 // immersive fullscreen and that the shelf's state before entering immersive |
1036 // fullscreen is restored upon exiting immersive fullscreen. | 1036 // fullscreen is restored upon exiting immersive fullscreen. |
1037 TEST_F(ImmersiveFullscreenControllerTest, Shelf) { | 1037 TEST_F(ImmersiveFullscreenControllerTest, Shelf) { |
1038 ash::ShelfLayoutManager* shelf = | 1038 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
1039 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | |
1040 | 1039 |
1041 // Shelf is visible by default. | 1040 // Shelf is visible by default. |
1042 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1041 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
1043 ASSERT_FALSE(controller()->IsEnabled()); | 1042 ASSERT_FALSE(controller()->IsEnabled()); |
1044 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 1043 ASSERT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1045 | 1044 |
1046 // Entering immersive fullscreen sets the shelf to auto hide. | 1045 // Entering immersive fullscreen sets the shelf to auto hide. |
1047 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1046 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
1048 SetEnabled(true); | 1047 SetEnabled(true); |
1049 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1048 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1050 | 1049 |
1051 // Disabling immersive fullscreen puts it back. | 1050 // Disabling immersive fullscreen puts it back. |
1052 SetEnabled(false); | 1051 SetEnabled(false); |
1053 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1052 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
1054 ASSERT_FALSE(controller()->IsEnabled()); | 1053 ASSERT_FALSE(controller()->IsEnabled()); |
1055 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 1054 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1056 | 1055 |
1057 // The user could toggle the shelf auto-hide behavior. | 1056 // The user could toggle the shelf auto-hide behavior. |
1058 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1057 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1059 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1058 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1060 | 1059 |
1061 // Entering immersive fullscreen keeps auto-hide. | 1060 // Entering immersive fullscreen keeps auto-hide. |
1062 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1061 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
1063 SetEnabled(true); | 1062 SetEnabled(true); |
1064 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1063 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1065 | 1064 |
1066 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1065 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
1067 SetEnabled(false); | 1066 SetEnabled(false); |
1068 window()->SetProperty(aura::client::kShowStateKey, | 1067 window()->SetProperty(aura::client::kShowStateKey, |
1069 ui::SHOW_STATE_NORMAL); | 1068 ui::SHOW_STATE_NORMAL); |
1070 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1069 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1071 } | 1070 } |
1072 | 1071 |
1073 } // namespase ash | 1072 } // namespase ash |
OLD | NEW |