Chromium Code Reviews| Index: ash/system/screen_layout_observer_unittest.cc |
| diff --git a/ash/system/screen_layout_observer_unittest.cc b/ash/system/screen_layout_observer_unittest.cc |
| index 11dc8b08782669c44f62052fc45b2f5d955fab48..419a0a908f41948f33e7602a0d37ed6fc9304aef 100644 |
| --- a/ash/system/screen_layout_observer_unittest.cc |
| +++ b/ash/system/screen_layout_observer_unittest.cc |
| @@ -430,4 +430,40 @@ TEST_F(ScreenLayoutObserverTest, DockedModeWithExternalPrimaryDisplayMessage) { |
| EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
| } |
| +// Tests that rotation notifications are only shown when the rotation source is |
| +// a user action. The accelerometer source nevber produces any notifications. |
| +TEST_F(ScreenLayoutObserverTest, RotationNotification) { |
| + Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( |
| + true); |
| + UpdateDisplay("400x400"); |
| + const int64_t primary_id = |
| + display_manager()->GetPrimaryDisplayCandidate().id(); |
| + display::ManagedDisplayInfo display_info(primary_id, "" /* name */, |
| + true /* has_overscan */); |
| + display::DisplayInfoList display_info_list; |
| + display_info_list.emplace_back(display_info); |
| + |
| + // The accelerometer source. |
| + display_info_list.back().Copy(display_manager()->GetDisplayInfo(primary_id)); |
| + display_info_list.back().SetRotation( |
| + display::Display::ROTATE_90, |
| + display::Display::ROTATION_SOURCE_ACCELEROMETER); |
| + display_manager()->OnNativeDisplaysChanged(display_info_list); |
| + display_manager()->UpdateInternalManagedDisplayModeListForTest(); |
|
oshima
2017/05/03 12:54:56
Can you use DisplayManager::SetDisplayRotation ?
afakhry
2017/05/03 16:02:41
Done.
|
| + EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| + EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
| + |
| + // The user source. |
| + display_info_list.back().SetRotation(display::Display::ROTATE_180, |
| + display::Display::ROTATION_SOURCE_USER); |
| + display_manager()->OnNativeDisplaysChanged(display_info_list); |
| + display_manager()->UpdateInternalManagedDisplayModeListForTest(); |
| + EXPECT_EQ(l10n_util::GetStringFUTF16( |
| + IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), |
| + l10n_util::GetStringUTF16( |
| + IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180)), |
| + GetDisplayNotificationAdditionalText()); |
| + EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| +} |
| + |
| } // namespace ash |