| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/content/shell_content_state.h" | 8 #include "ash/content/shell_content_state.h" |
| 9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // Make sure notifications are still displayed when | 430 // Make sure notifications are still displayed when |
| 431 // adjusting the screen rotation directly when in maximize mode | 431 // adjusting the screen rotation directly when in maximize mode |
| 432 ASSERT_NE(gfx::Display::ROTATE_270, GetCurrentInternalDisplayRotation()); | 432 ASSERT_NE(gfx::Display::ROTATE_270, GetCurrentInternalDisplayRotation()); |
| 433 SetInternalDisplayRotation(gfx::Display::ROTATE_270); | 433 SetInternalDisplayRotation(gfx::Display::ROTATE_270); |
| 434 SetRotationLocked(false); | 434 SetRotationLocked(false); |
| 435 EXPECT_EQ(gfx::Display::ROTATE_270, GetCurrentInternalDisplayRotation()); | 435 EXPECT_EQ(gfx::Display::ROTATE_270, GetCurrentInternalDisplayRotation()); |
| 436 EXPECT_EQ(1u, message_center->NotificationCount()); | 436 EXPECT_EQ(1u, message_center->NotificationCount()); |
| 437 EXPECT_TRUE(message_center->HasPopupNotifications()); | 437 EXPECT_TRUE(message_center->HasPopupNotifications()); |
| 438 | 438 |
| 439 // Clear all notifications | 439 // Clear all notifications |
| 440 message_center->RemoveAllNotifications(false); | 440 message_center->RemoveAllNotifications( |
| 441 false /* by_user */, message_center::MessageCenter::RemoveType::ALL); |
| 441 EXPECT_EQ(0u, message_center->NotificationCount()); | 442 EXPECT_EQ(0u, message_center->NotificationCount()); |
| 442 EXPECT_FALSE(message_center->HasPopupNotifications()); | 443 EXPECT_FALSE(message_center->HasPopupNotifications()); |
| 443 | 444 |
| 444 // Make sure notifications are blocked when adjusting the screen rotation | 445 // Make sure notifications are blocked when adjusting the screen rotation |
| 445 // via the accelerometer while in maximize mode | 446 // via the accelerometer while in maximize mode |
| 446 // Rotate the screen 90 degrees | 447 // Rotate the screen 90 degrees |
| 447 ASSERT_NE(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); | 448 ASSERT_NE(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); |
| 448 TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); | 449 TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); |
| 449 ASSERT_EQ(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); | 450 ASSERT_EQ(gfx::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); |
| 450 EXPECT_EQ(0u, message_center->NotificationCount()); | 451 EXPECT_EQ(0u, message_center->NotificationCount()); |
| 451 EXPECT_FALSE(message_center->HasPopupNotifications()); | 452 EXPECT_FALSE(message_center->HasPopupNotifications()); |
| 452 | 453 |
| 453 // Make sure notifications are still displayed when | 454 // Make sure notifications are still displayed when |
| 454 // adjusting the screen rotation directly when not in maximize mode | 455 // adjusting the screen rotation directly when not in maximize mode |
| 455 EnableMaximizeMode(false); | 456 EnableMaximizeMode(false); |
| 456 // Reset the screen rotation. | 457 // Reset the screen rotation. |
| 457 SetInternalDisplayRotation(gfx::Display::ROTATE_0); | 458 SetInternalDisplayRotation(gfx::Display::ROTATE_0); |
| 458 // Clear all notifications | 459 // Clear all notifications |
| 459 message_center->RemoveAllNotifications(false); | 460 message_center->RemoveAllNotifications( |
| 461 false /* by_user */, message_center::MessageCenter::RemoveType::ALL); |
| 460 ASSERT_NE(gfx::Display::ROTATE_180, GetCurrentInternalDisplayRotation()); | 462 ASSERT_NE(gfx::Display::ROTATE_180, GetCurrentInternalDisplayRotation()); |
| 461 ASSERT_EQ(0u, message_center->NotificationCount()); | 463 ASSERT_EQ(0u, message_center->NotificationCount()); |
| 462 ASSERT_FALSE(message_center->HasPopupNotifications()); | 464 ASSERT_FALSE(message_center->HasPopupNotifications()); |
| 463 SetInternalDisplayRotation(gfx::Display::ROTATE_180); | 465 SetInternalDisplayRotation(gfx::Display::ROTATE_180); |
| 464 EXPECT_EQ(gfx::Display::ROTATE_180, GetCurrentInternalDisplayRotation()); | 466 EXPECT_EQ(gfx::Display::ROTATE_180, GetCurrentInternalDisplayRotation()); |
| 465 EXPECT_EQ(1u, message_center->NotificationCount()); | 467 EXPECT_EQ(1u, message_center->NotificationCount()); |
| 466 EXPECT_TRUE(message_center->HasPopupNotifications()); | 468 EXPECT_TRUE(message_center->HasPopupNotifications()); |
| 467 } | 469 } |
| 468 | 470 |
| 469 // Tests that if a user has set a display rotation that it is restored upon | 471 // Tests that if a user has set a display rotation that it is restored upon |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 .GetActiveRotation()); | 650 .GetActiveRotation()); |
| 649 | 651 |
| 650 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( | 652 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( |
| 651 kNewRotation, gfx::Display::ROTATION_SOURCE_ACTIVE); | 653 kNewRotation, gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 652 | 654 |
| 653 EXPECT_EQ(kNewRotation, display_manager->GetDisplayInfo(kInternalDisplayId) | 655 EXPECT_EQ(kNewRotation, display_manager->GetDisplayInfo(kInternalDisplayId) |
| 654 .GetActiveRotation()); | 656 .GetActiveRotation()); |
| 655 } | 657 } |
| 656 | 658 |
| 657 } // namespace ash | 659 } // namespace ash |
| OLD | NEW |