| 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/display/mouse_cursor_event_filter.h" | 8 #include "ash/display/mouse_cursor_event_filter.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 1017 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 ShelfLayoutManager* shelf_layout_manager = |
| 1039 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 1039 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); |
| 1040 | 1040 |
| 1041 // Shelf is visible by default. | 1041 // Shelf is visible by default. |
| 1042 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1042 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 1043 ASSERT_FALSE(controller()->IsEnabled()); | 1043 ASSERT_FALSE(controller()->IsEnabled()); |
| 1044 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 1044 ASSERT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); |
| 1045 | 1045 |
| 1046 // Entering immersive fullscreen sets the shelf to auto hide. | 1046 // Entering immersive fullscreen sets the shelf to auto hide. |
| 1047 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1047 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1048 SetEnabled(true); | 1048 SetEnabled(true); |
| 1049 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1049 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); |
| 1050 | 1050 |
| 1051 // Disabling immersive fullscreen puts it back. | 1051 // Disabling immersive fullscreen puts it back. |
| 1052 SetEnabled(false); | 1052 SetEnabled(false); |
| 1053 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1053 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 1054 ASSERT_FALSE(controller()->IsEnabled()); | 1054 ASSERT_FALSE(controller()->IsEnabled()); |
| 1055 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 1055 EXPECT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); |
| 1056 | 1056 |
| 1057 // The user could toggle the shelf auto-hide behavior. | 1057 // The user could toggle the shelf auto-hide behavior. |
| 1058 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1058 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 1059 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1059 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1060 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); |
| 1060 | 1061 |
| 1061 // Entering immersive fullscreen keeps auto-hide. | 1062 // Entering immersive fullscreen keeps auto-hide. |
| 1062 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1063 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1063 SetEnabled(true); | 1064 SetEnabled(true); |
| 1064 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1065 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); |
| 1065 | 1066 |
| 1066 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1067 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1067 SetEnabled(false); | 1068 SetEnabled(false); |
| 1068 window()->SetProperty(aura::client::kShowStateKey, | 1069 window()->SetProperty(aura::client::kShowStateKey, |
| 1069 ui::SHOW_STATE_NORMAL); | 1070 ui::SHOW_STATE_NORMAL); |
| 1070 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 1071 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); |
| 1071 } | 1072 } |
| 1072 | 1073 |
| 1073 } // namespase ash | 1074 } // namespase ash |
| OLD | NEW |