| Index: ash/display/resolution_notification_controller_unittest.cc
|
| diff --git a/ash/display/resolution_notification_controller_unittest.cc b/ash/display/resolution_notification_controller_unittest.cc
|
| index bdb6f12cae3b88099ddd35374747d634302b84b4..264cb259c0e2f99a1ced8ec62208041ff358fd47 100644
|
| --- a/ash/display/resolution_notification_controller_unittest.cc
|
| +++ b/ash/display/resolution_notification_controller_unittest.cc
|
| @@ -66,6 +66,11 @@ class ResolutionNotificationControllerTest : public ash::test::AshTestBase {
|
| ResolutionNotificationController::kNotificationId, index);
|
| }
|
|
|
| + void CloseNotification() {
|
| + message_center::MessageCenter::Get()->RemoveNotification(
|
| + ResolutionNotificationController::kNotificationId, true /* by_user */);
|
| + }
|
| +
|
| bool IsNotificationVisible() {
|
| return message_center::MessageCenter::Get()->HasNotification(
|
| ResolutionNotificationController::kNotificationId);
|
| @@ -194,6 +199,35 @@ TEST_F(ResolutionNotificationControllerTest, AcceptButton) {
|
| EXPECT_EQ("100x100", resolution.ToString());
|
| }
|
|
|
| +TEST_F(ResolutionNotificationControllerTest, Close) {
|
| + if (!SupportsMultipleDisplays())
|
| + return;
|
| +
|
| + UpdateDisplay("100x100,150x150");
|
| + int64 id2 = ash::ScreenAsh::GetSecondaryDisplay().id();
|
| + ash::internal::DisplayManager* display_manager =
|
| + ash::Shell::GetInstance()->display_manager();
|
| + ASSERT_EQ(0, accept_count());
|
| + EXPECT_FALSE(IsNotificationVisible());
|
| +
|
| + // Changes the resolution and apply the result.
|
| + SetDisplayResolutionAndNotify(
|
| + ScreenAsh::GetSecondaryDisplay(), gfx::Size(200, 200));
|
| + EXPECT_TRUE(IsNotificationVisible());
|
| + EXPECT_FALSE(controller()->DoesNotificationTimeout());
|
| + gfx::Size resolution;
|
| + EXPECT_TRUE(
|
| + display_manager->GetSelectedResolutionForDisplayId(id2, &resolution));
|
| + EXPECT_EQ("200x200", resolution.ToString());
|
| +
|
| + // Close the notification (imitates clicking [x] button). Also verifies if
|
| + // this does not cause a crash. See crbug.com/271784
|
| + CloseNotification();
|
| + RunAllPendingInMessageLoop();
|
| + EXPECT_FALSE(IsNotificationVisible());
|
| + EXPECT_EQ(1, accept_count());
|
| +}
|
| +
|
| TEST_F(ResolutionNotificationControllerTest, Timeout) {
|
| if (!SupportsMultipleDisplays())
|
| return;
|
|
|