| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/screen_layout_observer.h" | 5 #include "ash/system/screen_layout_observer.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/strings/grit/ash_strings.h" | 8 #include "ash/strings/grit/ash_strings.h" |
| 9 #include "ash/system/devicetype_utils.h" | 9 #include "ash/system/devicetype_utils.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 display::DisplayPlacement::LEFT, 0); | 423 display::DisplayPlacement::LEFT, 0); |
| 424 display_manager()->SetLayoutForCurrentDisplays(builder.Build()); | 424 display_manager()->SetLayoutForCurrentDisplays(builder.Build()); |
| 425 EXPECT_TRUE(GetDisplayNotificationText().empty()); | 425 EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| 426 | 426 |
| 427 // Close the lid. We go to docked mode, but we show no notifications. | 427 // Close the lid. We go to docked mode, but we show no notifications. |
| 428 UpdateDisplay("400x400"); | 428 UpdateDisplay("400x400"); |
| 429 EXPECT_TRUE(GetDisplayNotificationText().empty()); | 429 EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| 430 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); | 430 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
| 431 } | 431 } |
| 432 | 432 |
| 433 // Tests that rotation notifications are only shown when the rotation source is |
| 434 // a user action. The accelerometer source nevber produces any notifications. |
| 435 TEST_F(ScreenLayoutObserverTest, RotationNotification) { |
| 436 Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( |
| 437 true); |
| 438 UpdateDisplay("400x400"); |
| 439 const int64_t primary_id = |
| 440 display_manager()->GetPrimaryDisplayCandidate().id(); |
| 441 |
| 442 // The accelerometer source. |
| 443 display_manager()->SetDisplayRotation( |
| 444 primary_id, display::Display::ROTATE_90, |
| 445 display::Display::ROTATION_SOURCE_ACCELEROMETER); |
| 446 EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| 447 EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
| 448 |
| 449 // The user source. |
| 450 display_manager()->SetDisplayRotation(primary_id, |
| 451 display::Display::ROTATE_180, |
| 452 display::Display::ROTATION_SOURCE_USER); |
| 453 EXPECT_EQ(l10n_util::GetStringFUTF16( |
| 454 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetFirstDisplayName(), |
| 455 l10n_util::GetStringUTF16( |
| 456 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180)), |
| 457 GetDisplayNotificationAdditionalText()); |
| 458 EXPECT_TRUE(GetDisplayNotificationText().empty()); |
| 459 } |
| 460 |
| 433 } // namespace ash | 461 } // namespace ash |
| OLD | NEW |