| 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/display/display_error_observer_chromeos.h" | 5 #include "ash/display/display_error_observer_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/common/system/chromeos/devicetype_utils.h" | 7 #include "ash/common/system/chromeos/devicetype_utils.h" |
| 8 #include "ash/display/display_util.h" | 8 #include "ash/display/display_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return GetDisplayErrorNotificationMessageForTest(); | 35 return GetDisplayErrorNotificationMessageForTest(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 std::unique_ptr<DisplayErrorObserver> observer_; | 39 std::unique_ptr<DisplayErrorObserver> observer_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserverTest); | 41 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserverTest); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 TEST_F(DisplayErrorObserverTest, Normal) { | 44 TEST_F(DisplayErrorObserverTest, Normal) { |
| 45 if (!SupportsMultipleDisplays()) | |
| 46 return; | |
| 47 | |
| 48 UpdateDisplay("200x200,300x300"); | 45 UpdateDisplay("200x200,300x300"); |
| 49 observer()->OnDisplayModeChangeFailed( | 46 observer()->OnDisplayModeChangeFailed( |
| 50 display::DisplayConfigurator::DisplayStateList(), | 47 display::DisplayConfigurator::DisplayStateList(), |
| 51 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 48 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 52 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), | 49 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), |
| 53 GetMessageContents()); | 50 GetMessageContents()); |
| 54 } | 51 } |
| 55 | 52 |
| 56 TEST_F(DisplayErrorObserverTest, CallTwice) { | 53 TEST_F(DisplayErrorObserverTest, CallTwice) { |
| 57 if (!SupportsMultipleDisplays()) | |
| 58 return; | |
| 59 | |
| 60 UpdateDisplay("200x200,300x300"); | 54 UpdateDisplay("200x200,300x300"); |
| 61 observer()->OnDisplayModeChangeFailed( | 55 observer()->OnDisplayModeChangeFailed( |
| 62 display::DisplayConfigurator::DisplayStateList(), | 56 display::DisplayConfigurator::DisplayStateList(), |
| 63 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 57 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 64 base::string16 message = GetMessageContents(); | 58 base::string16 message = GetMessageContents(); |
| 65 EXPECT_FALSE(message.empty()); | 59 EXPECT_FALSE(message.empty()); |
| 66 | 60 |
| 67 observer()->OnDisplayModeChangeFailed( | 61 observer()->OnDisplayModeChangeFailed( |
| 68 display::DisplayConfigurator::DisplayStateList(), | 62 display::DisplayConfigurator::DisplayStateList(), |
| 69 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 63 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 70 base::string16 message2 = GetMessageContents(); | 64 base::string16 message2 = GetMessageContents(); |
| 71 EXPECT_FALSE(message2.empty()); | 65 EXPECT_FALSE(message2.empty()); |
| 72 EXPECT_EQ(message, message2); | 66 EXPECT_EQ(message, message2); |
| 73 } | 67 } |
| 74 | 68 |
| 75 TEST_F(DisplayErrorObserverTest, CallWithDifferentState) { | 69 TEST_F(DisplayErrorObserverTest, CallWithDifferentState) { |
| 76 if (!SupportsMultipleDisplays()) | |
| 77 return; | |
| 78 | |
| 79 UpdateDisplay("200x200,300x300"); | 70 UpdateDisplay("200x200,300x300"); |
| 80 observer()->OnDisplayModeChangeFailed( | 71 observer()->OnDisplayModeChangeFailed( |
| 81 display::DisplayConfigurator::DisplayStateList(), | 72 display::DisplayConfigurator::DisplayStateList(), |
| 82 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 73 display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 83 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), | 74 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), |
| 84 GetMessageContents()); | 75 GetMessageContents()); |
| 85 | 76 |
| 86 observer()->OnDisplayModeChangeFailed( | 77 observer()->OnDisplayModeChangeFailed( |
| 87 display::DisplayConfigurator::DisplayStateList(), | 78 display::DisplayConfigurator::DisplayStateList(), |
| 88 display::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); | 79 display::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); |
| 89 EXPECT_EQ(ash::SubstituteChromeOSDeviceType( | 80 EXPECT_EQ(ash::SubstituteChromeOSDeviceType( |
| 90 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING), | 81 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING), |
| 91 GetMessageContents()); | 82 GetMessageContents()); |
| 92 } | 83 } |
| 93 | 84 |
| 94 } // namespace ash | 85 } // namespace ash |
| OLD | NEW |