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

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: rebase again, and 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
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 RETURN_IF_WIN8;
63
62 UpdateDisplay("200x200,300x300"); 64 UpdateDisplay("200x200,300x300");
63 DisplayErrorDialog* dialog = 65 DisplayErrorDialog* dialog =
64 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR); 66 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR);
65 EXPECT_TRUE(dialog); 67 EXPECT_TRUE(dialog);
66 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); 68 EXPECT_TRUE(dialog->GetWidget()->IsVisible());
67 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), 69 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
68 GetMessageContents(dialog)); 70 GetMessageContents(dialog));
69 EXPECT_EQ(Shell::GetAllRootWindows()[1], 71 EXPECT_EQ(Shell::GetAllRootWindows()[1],
70 dialog->GetWidget()->GetNativeView()->GetRootWindow()); 72 dialog->GetWidget()->GetNativeView()->GetRootWindow());
71 } 73 }
72 74
73 TEST_F(DisplayErrorDialogTest, CallTwice) { 75 TEST_F(DisplayErrorDialogTest, CallTwice) {
76 RETURN_IF_WIN8;
77
74 UpdateDisplay("200x200,300x300"); 78 UpdateDisplay("200x200,300x300");
75 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 79 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
76 const DisplayErrorDialog* dialog = observer()->dialog(); 80 const DisplayErrorDialog* dialog = observer()->dialog();
77 EXPECT_TRUE(dialog); 81 EXPECT_TRUE(dialog);
78 82
79 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 83 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
80 EXPECT_EQ(dialog, observer()->dialog()); 84 EXPECT_EQ(dialog, observer()->dialog());
81 } 85 }
82 86
83 TEST_F(DisplayErrorDialogTest, CallWithDifferentState) { 87 TEST_F(DisplayErrorDialogTest, CallWithDifferentState) {
88 RETURN_IF_WIN8;
89
84 UpdateDisplay("200x200,300x300"); 90 UpdateDisplay("200x200,300x300");
85 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 91 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
86 const DisplayErrorDialog* dialog = observer()->dialog(); 92 const DisplayErrorDialog* dialog = observer()->dialog();
87 EXPECT_TRUE(dialog); 93 EXPECT_TRUE(dialog);
88 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING), 94 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
89 GetMessageContents(dialog)); 95 GetMessageContents(dialog));
90 96
91 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_EXTENDED); 97 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_EXTENDED);
92 EXPECT_EQ(dialog, observer()->dialog()); 98 EXPECT_EQ(dialog, observer()->dialog());
93 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING), 99 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING),
94 GetMessageContents(dialog)); 100 GetMessageContents(dialog));
95 } 101 }
96 102
97 TEST_F(DisplayErrorDialogTest, SingleDisplay) { 103 TEST_F(DisplayErrorDialogTest, SingleDisplay) {
98 UpdateDisplay("200x200"); 104 UpdateDisplay("200x200");
99 DisplayErrorDialog* dialog = 105 DisplayErrorDialog* dialog =
100 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR); 106 DisplayErrorDialog::ShowDialog(chromeos::STATE_DUAL_MIRROR);
101 EXPECT_TRUE(dialog); 107 EXPECT_TRUE(dialog);
102 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); 108 EXPECT_TRUE(dialog->GetWidget()->IsVisible());
103 EXPECT_EQ(Shell::GetInstance()->GetPrimaryRootWindow(), 109 EXPECT_EQ(Shell::GetInstance()->GetPrimaryRootWindow(),
104 dialog->GetWidget()->GetNativeView()->GetRootWindow()); 110 dialog->GetWidget()->GetNativeView()->GetRootWindow());
105 } 111 }
106 112
107 TEST_F(DisplayErrorDialogTest, DisplayDisconnected) { 113 TEST_F(DisplayErrorDialogTest, DisplayDisconnected) {
114 RETURN_IF_WIN8;
115
108 UpdateDisplay("200x200,300x300"); 116 UpdateDisplay("200x200,300x300");
109 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR); 117 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
110 EXPECT_TRUE(observer()->dialog()); 118 EXPECT_TRUE(observer()->dialog());
111 119
112 UpdateDisplay("200x200"); 120 UpdateDisplay("200x200");
113 // Disconnection will close the dialog but we have to run all pending tasks 121 // Disconnection will close the dialog but we have to run all pending tasks
114 // to make the effect of the close. 122 // to make the effect of the close.
115 RunAllPendingInMessageLoop(); 123 RunAllPendingInMessageLoop();
116 EXPECT_FALSE(observer()->dialog()); 124 EXPECT_FALSE(observer()->dialog());
117 } 125 }
118 126
119 } // namespace internal 127 } // namespace internal
120 } // namespace ash 128 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698