Chromium Code Reviews| 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" |
| 11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
| 12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/system/status_area_widget.h" | 14 #include "ash/system/status_area_widget.h" |
| 15 #include "ash/system/user/login_status.h" | 15 #include "ash/system/user/login_status.h" |
| 16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 17 #include "ash/test/status_area_widget_test_helper.h" | 17 #include "ash/test/status_area_widget_test_helper.h" |
| 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 19 #include "ash/wm/overview/window_selector_controller.h" | 19 #include "ash/wm/overview/window_selector_controller.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "ui/aura/client/aura_constants.h" | |
|
jonross
2015/05/01 17:30:15
Necessary?
tdanderson
2015/05/01 18:07:31
This was part of a quick hack and I meant to remov
| |
| 22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 23 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
| 24 #include "ui/events/event_constants.h" | 25 #include "ui/events/event_constants.h" |
| 25 #include "ui/events/gestures/gesture_types.h" | 26 #include "ui/events/gestures/gesture_types.h" |
| 26 #include "ui/views/controls/image_view.h" | 27 #include "ui/views/controls/image_view.h" |
| 27 | 28 |
| 28 namespace ash { | 29 namespace ash { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); | 141 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_NONE); |
| 141 EXPECT_FALSE(GetTray()->visible()); | 142 EXPECT_FALSE(GetTray()->visible()); |
| 142 SetUserLoggedIn(true); | 143 SetUserLoggedIn(true); |
| 143 SetSessionStarted(true); | 144 SetSessionStarted(true); |
| 144 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); | 145 Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); |
| 145 EXPECT_TRUE(GetTray()->visible()); | 146 EXPECT_TRUE(GetTray()->visible()); |
| 146 Shell::GetInstance()->maximize_mode_controller()-> | 147 Shell::GetInstance()->maximize_mode_controller()-> |
| 147 EnableMaximizeModeWindowManager(false); | 148 EnableMaximizeModeWindowManager(false); |
| 148 } | 149 } |
| 149 | 150 |
| 151 // Tests that the overview button becomes visible when the user enters | |
| 152 // maximize mode with a system modal window open. | |
| 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); | |
|
jonross
2015/05/01 17:30:15
Check afterwards to make sure visibility toggling
tdanderson
2015/05/01 18:07:31
Done.
| |
| 164 } | |
| 165 | |
| 150 // Tests that the tray only renders as active while selection is ongoing. Any | 166 // Tests that the tray only renders as active while selection is ongoing. Any |
| 151 // dismissal of overview mode clears the active state. | 167 // dismissal of overview mode clears the active state. |
| 152 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { | 168 TEST_F(OverviewButtonTrayTest, ActiveStateOnlyDuringOverviewMode) { |
| 153 ASSERT_FALSE( | 169 ASSERT_FALSE( |
| 154 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 170 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 155 ASSERT_FALSE(GetTray()->draw_background_as_active()); | 171 ASSERT_FALSE(GetTray()->draw_background_as_active()); |
| 156 | 172 |
| 157 // Overview Mode only works when there is a window | 173 // Overview Mode only works when there is a window |
| 158 scoped_ptr<aura::Window> window( | 174 scoped_ptr<aura::Window> window( |
| 159 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 175 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 189 new ui::ScopedAnimationDurationScaleMode( | 205 new ui::ScopedAnimationDurationScaleMode( |
| 190 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 206 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 191 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) | 207 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
| 192 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); | 208 .Rotate(gfx::Display::ROTATE_270, gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 193 | 209 |
| 194 RunAllPendingInMessageLoop(); | 210 RunAllPendingInMessageLoop(); |
| 195 EXPECT_FALSE(GetTray()->visible()); | 211 EXPECT_FALSE(GetTray()->visible()); |
| 196 } | 212 } |
| 197 | 213 |
| 198 } // namespace ash | 214 } // namespace ash |
| OLD | NEW |