| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/system/overview/overview_button_tray.h" | 5 #include "ash/system/overview/overview_button_tray.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/rotator/screen_rotation_animator.h" | 10 #include "ash/rotator/screen_rotation_animator.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); | 140 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); |
| 141 EXPECT_FALSE(GetTray()->visible()); | 141 EXPECT_FALSE(GetTray()->visible()); |
| 142 SetUserLoggedIn(true); | 142 SetUserLoggedIn(true); |
| 143 SetSessionStarted(true); | 143 SetSessionStarted(true); |
| 144 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); | 144 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); |
| 145 EXPECT_TRUE(GetTray()->visible()); | 145 EXPECT_TRUE(GetTray()->visible()); |
| 146 Shell::GetInstance()->maximize_mode_controller()-> | 146 Shell::GetInstance()->maximize_mode_controller()-> |
| 147 EnableMaximizeModeWindowManager(false); | 147 EnableMaximizeModeWindowManager(false); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // Tests that the overview button becomes visible when the user enters |
| 151 // maximize mode with a system modal window open, and that it hides once |
| 152 // the user exits maximize mode. |
| 153 TEST_F(OverviewButtonTrayTest, VisibilityChangesForSystemModalWindow) { |
| 154 scoped_ptr<aura::Window> window( |
| 155 CreateTestModalWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 156 ASSERT_TRUE(Shell::GetInstance()->IsSystemModalWindowOpen()); |
| 157 Shell::GetInstance() |
| 158 ->maximize_mode_controller() |
| 159 ->EnableMaximizeModeWindowManager(true); |
| 160 EXPECT_TRUE(GetTray()->visible()); |
| 161 Shell::GetInstance() |
| 162 ->maximize_mode_controller() |
| 163 ->EnableMaximizeModeWindowManager(false); |
| 164 EXPECT_FALSE(GetTray()->visible()); |
| 165 } |
| 166 |
| 150 // Tests that the tray only renders as active while selection is ongoing. Any | 167 // Tests that the tray only renders as active while selection is ongoing. Any |
| 151 // dismissal of overview mode clears the active state. | 168 // dismissal of overview mode clears the active state. |
| 152 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { | 169 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { |
| 153 ASSERT_FALSE( | 170 ASSERT_FALSE( |
| 154 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 171 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 155 ASSERT_FALSE(GetTray()->draw_background_as_active()); | 172 ASSERT_FALSE(GetTray()->draw_background_as_active()); |
| 156 | 173 |
| 157 // Overview Mode only works when there is a window | 174 // Overview Mode only works when there is a window |
| 158 scoped_ptr<aura::Window> window( | 175 scoped_ptr<aura::Window> window( |
| 159 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 176 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 189 new ui::ScopedAnimationDurationScaleMode( | 206 new ui::ScopedAnimationDurationScaleMode( |
| 190 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 207 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 191 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) | 208 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
| 192 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); | 209 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 193 | 210 |
| 194 RunAllPendingInMessageLoop(); | 211 RunAllPendingInMessageLoop(); |
| 195 EXPECT_FALSE(GetTray()->visible()); | 212 EXPECT_FALSE(GetTray()->visible()); |
| 196 } | 213 } |
| 197 | 214 |
| 198 } // namespace ash | 215 } // namespace ash |
| OLD | NEW |