| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); | 175 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); |
| 176 EXPECT_FALSE(GetTray()->visible()); | 176 EXPECT_FALSE(GetTray()->visible()); |
| 177 SetUserLoggedIn(true); | 177 SetUserLoggedIn(true); |
| 178 SetSessionStarted(true); | 178 SetSessionStarted(true); |
| 179 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); | 179 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); |
| 180 EXPECT_TRUE(GetTray()->visible()); | 180 EXPECT_TRUE(GetTray()->visible()); |
| 181 Shell::GetInstance()->maximize_mode_controller()-> | 181 Shell::GetInstance()->maximize_mode_controller()-> |
| 182 EnableMaximizeModeWindowManager(false); | 182 EnableMaximizeModeWindowManager(false); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Tests that the overview button becomes visible when the user enters |
| 186 // maximize mode with a system modal window open, and that it hides once |
| 187 // the user exits maximize mode. |
| 188 TEST_F(OverviewButtonTrayTest, VisibilityChangesForSystemModalWindow) { |
| 189 scoped_ptr<aura::Window> window( |
| 190 CreateTestModalWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 191 ASSERT_TRUE(Shell::GetInstance()->IsSystemModalWindowOpen()); |
| 192 Shell::GetInstance() |
| 193 ->maximize_mode_controller() |
| 194 ->EnableMaximizeModeWindowManager(true); |
| 195 EXPECT_TRUE(GetTray()->visible()); |
| 196 Shell::GetInstance() |
| 197 ->maximize_mode_controller() |
| 198 ->EnableMaximizeModeWindowManager(false); |
| 199 EXPECT_FALSE(GetTray()->visible()); |
| 200 } |
| 201 |
| 185 // Tests that the tray only renders as active while selection is ongoing. Any | 202 // Tests that the tray only renders as active while selection is ongoing. Any |
| 186 // dismissal of overview mode clears the active state. | 203 // dismissal of overview mode clears the active state. |
| 187 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { | 204 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { |
| 188 ASSERT_FALSE( | 205 ASSERT_FALSE( |
| 189 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 206 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 190 ASSERT_FALSE(GetTray()->draw_background_as_active()); | 207 ASSERT_FALSE(GetTray()->draw_background_as_active()); |
| 191 | 208 |
| 192 // Overview Mode only works when there is a window | 209 // Overview Mode only works when there is a window |
| 193 scoped_ptr<aura::Window> window( | 210 scoped_ptr<aura::Window> window( |
| 194 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 211 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 224 new ui::ScopedAnimationDurationScaleMode( | 241 new ui::ScopedAnimationDurationScaleMode( |
| 225 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 242 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 226 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) | 243 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
| 227 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); | 244 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 228 | 245 |
| 229 RunAllPendingInMessageLoop(); | 246 RunAllPendingInMessageLoop(); |
| 230 EXPECT_FALSE(GetTray()->visible()); | 247 EXPECT_FALSE(GetTray()->visible()); |
| 231 } | 248 } |
| 232 | 249 |
| 233 } // namespace ash | 250 } // namespace ash |
| OLD | NEW |