Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: ash/display/display_error_dialog_unittest.cc

Issue 16539005: Skip mulitple-dispay tests on win8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comment Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | ash/display/display_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_dialog.h" 5 #include "ash/display/display_error_dialog.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 scoped_ptr<DisplayErrorObserver> observer_; 52 scoped_ptr<DisplayErrorObserver> observer_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialogTest); 54 DISALLOW_COPY_AND_ASSIGN(DisplayErrorDialogTest);
55 }; 55 };
56 56
57 } 57 }
58 58
59 // The test cases in this file usually check if the showing dialog doesn't 59 // The test cases in this file usually check if the showing dialog doesn't
60 // cause any crashes, and the code doesn't cause any memory leaks. 60 // cause any crashes, and the code doesn't cause any memory leaks.
61 TEST_F(DisplayErrorDialogTest, Normal) { 61 TEST_F(DisplayErrorDialogTest, Normal) {
62 if (!SupportsMultipleDisplays())
63 return;
64
62 UpdateDisplay("200x200,300x300"); 65 UpdateDisplay("200x200,300x300");
63 DisplayErrorDialog* dialog = 66 DisplayErrorDialog* dialog =
64 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR); 67 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR);
65 EXPECT_TRUE(dialog); 68 EXPECT_TRUE(dialog);
66 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); 69 EXPECT_TRUE(dialog->GetWidget()->IsVisible());
67 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), 70 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
68 GetMessageContents(dialog)); 71 GetMessageContents(dialog));
69 EXPECT_EQ(Shell::GetAllRootWindows()[1], 72 EXPECT_EQ(Shell::GetAllRootWindows()[1],
70 dialog->GetWidget()->GetNativeView()->GetRootWindow()); 73 dialog->GetWidget()->GetNativeView()->GetRootWindow());
71 } 74 }
72 75
73 TEST_F(DisplayErrorDialogTest, CallTwice) { 76 TEST_F(DisplayErrorDialogTest, CallTwice) {
77 if (!SupportsMultipleDisplays())
78 return;
79
74 UpdateDisplay("200x200,300x300"); 80 UpdateDisplay("200x200,300x300");
75 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 81 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
76 const DisplayErrorDialog* dialog = observer()->dialog(); 82 const DisplayErrorDialog* dialog = observer()->dialog();
77 EXPECT_TRUE(dialog); 83 EXPECT_TRUE(dialog);
78 84
79 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 85 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
80 EXPECT_EQ(dialog, observer()->dialog()); 86 EXPECT_EQ(dialog, observer()->dialog());
81 } 87 }
82 88
83 TEST_F(DisplayErrorDialogTest, CallWithDifferentState) { 89 TEST_F(DisplayErrorDialogTest, CallWithDifferentState) {
90 if (!SupportsMultipleDisplays())
91 return;
92
84 UpdateDisplay("200x200,300x300"); 93 UpdateDisplay("200x200,300x300");
85 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 94 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
86 const DisplayErrorDialog* dialog = observer()->dialog(); 95 const DisplayErrorDialog* dialog = observer()->dialog();
87 EXPECT_TRUE(dialog); 96 EXPECT_TRUE(dialog);
88 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), 97 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
89 GetMessageContents(dialog)); 98 GetMessageContents(dialog));
90 99
91 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_EXTENDED); 100 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_EXTENDED);
92 EXPECT_EQ(dialog, observer()->dialog()); 101 EXPECT_EQ(dialog, observer()->dialog());
93 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING), 102 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING),
94 GetMessageContents(dialog)); 103 GetMessageContents(dialog));
95 } 104 }
96 105
97 TEST_F(DisplayErrorDialogTest, SingleDisplay) { 106 TEST_F(DisplayErrorDialogTest, SingleDisplay) {
98 UpdateDisplay("200x200"); 107 UpdateDisplay("200x200");
99 DisplayErrorDialog* dialog = 108 DisplayErrorDialog* dialog =
100 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR); 109 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR);
101 EXPECT_TRUE(dialog); 110 EXPECT_TRUE(dialog);
102 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); 111 EXPECT_TRUE(dialog->GetWidget()->IsVisible());
103 EXPECT_EQ(Shell::GetInstance()->GetPrimaryRootWindow(), 112 EXPECT_EQ(Shell::GetInstance()->GetPrimaryRootWindow(),
104 dialog->GetWidget()->GetNativeView()->GetRootWindow()); 113 dialog->GetWidget()->GetNativeView()->GetRootWindow());
105 } 114 }
106 115
107 TEST_F(DisplayErrorDialogTest, DisplayDisconnected) { 116 TEST_F(DisplayErrorDialogTest, DisplayDisconnected) {
117 if (!SupportsMultipleDisplays())
118 return;
119
108 UpdateDisplay("200x200,300x300"); 120 UpdateDisplay("200x200,300x300");
109 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 121 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
110 EXPECT_TRUE(observer()->dialog()); 122 EXPECT_TRUE(observer()->dialog());
111 123
112 UpdateDisplay("200x200"); 124 UpdateDisplay("200x200");
113 // Disconnection will close the dialog but we have to run all pending tasks 125 // Disconnection will close the dialog but we have to run all pending tasks
114 // to make the effect of the close. 126 // to make the effect of the close.
115 RunAllPendingInMessageLoop(); 127 RunAllPendingInMessageLoop();
116 EXPECT_FALSE(observer()->dialog()); 128 EXPECT_FALSE(observer()->dialog());
117 } 129 }
118 130
119 } // namespace internal 131 } // namespace internal
120 } // namespace ash 132 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | ash/display/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698