| 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/chromeos/rotation/tray_rotation_lock.h" | 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 default_view()->OnGestureEvent(&tap); | 237 default_view()->OnGestureEvent(&tap); |
| 238 EXPECT_TRUE(screen_orientation_controller->rotation_locked()); | 238 EXPECT_TRUE(screen_orientation_controller->rotation_locked()); |
| 239 EXPECT_TRUE(tray_view()->visible()); | 239 EXPECT_TRUE(tray_view()->visible()); |
| 240 | 240 |
| 241 maximize_mode_controller->EnableMaximizeModeWindowManager(false); | 241 maximize_mode_controller->EnableMaximizeModeWindowManager(false); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Tests that when the tray is created without the internal display being known, | 244 // Tests that when the tray is created without the internal display being known, |
| 245 // that it will still display correctly once the internal display is known. | 245 // that it will still display correctly once the internal display is known. |
| 246 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) { | 246 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) { |
| 247 int64_t internal_display_id = gfx::Display::InternalDisplayId(); | 247 int64_t internal_display_id = display::Display::InternalDisplayId(); |
| 248 TearDownViews(); | 248 TearDownViews(); |
| 249 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); | 249 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); |
| 250 | 250 |
| 251 std::unique_ptr<TrayRotationLock> tray(new TrayRotationLock( | 251 std::unique_ptr<TrayRotationLock> tray(new TrayRotationLock( |
| 252 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray())); | 252 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray())); |
| 253 | 253 |
| 254 gfx::Display::SetInternalDisplayId(internal_display_id); | 254 display::Display::SetInternalDisplayId(internal_display_id); |
| 255 std::unique_ptr<views::View> tray_view(CreateTrayView(tray.get())); | 255 std::unique_ptr<views::View> tray_view(CreateTrayView(tray.get())); |
| 256 std::unique_ptr<views::View> default_view(tray->CreateDefaultView( | 256 std::unique_ptr<views::View> default_view(tray->CreateDefaultView( |
| 257 StatusAreaWidgetTestHelper::GetUserLoginStatus())); | 257 StatusAreaWidgetTestHelper::GetUserLoginStatus())); |
| 258 EXPECT_TRUE(default_view); | 258 EXPECT_TRUE(default_view); |
| 259 Shell::GetInstance() | 259 Shell::GetInstance() |
| 260 ->maximize_mode_controller() | 260 ->maximize_mode_controller() |
| 261 ->EnableMaximizeModeWindowManager(true); | 261 ->EnableMaximizeModeWindowManager(true); |
| 262 EXPECT_TRUE(default_view->visible()); | 262 EXPECT_TRUE(default_view->visible()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Tests that when the tray view is deleted, while TrayRotationLock has not been | 265 // Tests that when the tray view is deleted, while TrayRotationLock has not been |
| 266 // deleted, that updates to the rotation lock state do not crash. | 266 // deleted, that updates to the rotation lock state do not crash. |
| 267 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { | 267 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { |
| 268 Shell::GetInstance() | 268 Shell::GetInstance() |
| 269 ->maximize_mode_controller() | 269 ->maximize_mode_controller() |
| 270 ->EnableMaximizeModeWindowManager(true); | 270 ->EnableMaximizeModeWindowManager(true); |
| 271 DestroyTrayView(); | 271 DestroyTrayView(); |
| 272 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( | 272 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( |
| 273 true); | 273 true); |
| 274 Shell::GetInstance() | 274 Shell::GetInstance() |
| 275 ->maximize_mode_controller() | 275 ->maximize_mode_controller() |
| 276 ->EnableMaximizeModeWindowManager(false); | 276 ->EnableMaximizeModeWindowManager(false); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace ash | 279 } // namespace ash |
| OLD | NEW |