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