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

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

Issue 23286003: ash: Get output info from chromeos instead of XRandR. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use index from XRandR Created 7 years, 4 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_error_observer_chromeos_unittest.cc ('k') | ash/display/display_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/display/display_error_observer.h"
6
7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h"
9 #include "grit/ash_strings.h"
10 #include "ui/aura/window.h"
11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/controls/label.h"
13 #include "ui/views/view.h"
14 #include "ui/views/widget/widget.h"
15
16 namespace ash {
17 namespace internal {
18
19 class DisplayErrorObserverTest : public test::AshTestBase {
20 protected:
21 DisplayErrorObserverTest() {
22 }
23
24 virtual ~DisplayErrorObserverTest() {
25 }
26
27 virtual void SetUp() OVERRIDE {
28 test::AshTestBase::SetUp();
29 observer_.reset(new DisplayErrorObserver());
30 }
31
32 protected:
33 DisplayErrorObserver* observer() { return observer_.get(); }
34
35 base::string16 GetMessageContents() {
36 return observer_->GetTitleOfDisplayErrorNotificationForTest();
37 }
38
39 private:
40 scoped_ptr<DisplayErrorObserver> observer_;
41
42 DISALLOW_COPY_AND_ASSIGN(DisplayErrorObserverTest);
43 };
44
45 TEST_F(DisplayErrorObserverTest, Normal) {
46 if (!SupportsMultipleDisplays())
47 return;
48
49 UpdateDisplay("200x200,300x300");
50 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
51 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
52 GetMessageContents());
53 }
54
55 TEST_F(DisplayErrorObserverTest, CallTwice) {
56 if (!SupportsMultipleDisplays())
57 return;
58
59 UpdateDisplay("200x200,300x300");
60 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
61 base::string16 message = GetMessageContents();
62 EXPECT_FALSE(message.empty());
63
64 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
65 base::string16 message2 = GetMessageContents();
66 EXPECT_FALSE(message2.empty());
67 EXPECT_EQ(message, message2);
68 }
69
70 TEST_F(DisplayErrorObserverTest, CallWithDifferentState) {
71 if (!SupportsMultipleDisplays())
72 return;
73
74 UpdateDisplay("200x200,300x300");
75 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_MIRROR);
76 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING),
77 GetMessageContents());
78
79 observer()->OnDisplayModeChangeFailed(chromeos::STATE_DUAL_EXTENDED);
80 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING),
81 GetMessageContents());
82 }
83
84 } // namespace internal
85 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_error_observer_chromeos_unittest.cc ('k') | ash/display/display_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698