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

Side by Side Diff: ash/system/chromeos/tray_display_unittest.cc

Issue 1138253003: Notificaiton Message for Unified mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « ash/system/chromeos/tray_display.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/chromeos/tray_display.h" 5 #include "ash/system/chromeos/tray_display.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 class TrayDisplayTest : public ash::test::AshTestBase { 74 class TrayDisplayTest : public ash::test::AshTestBase {
75 public: 75 public:
76 TrayDisplayTest(); 76 TrayDisplayTest();
77 ~TrayDisplayTest() override; 77 ~TrayDisplayTest() override;
78 78
79 void SetUp() override; 79 void SetUp() override;
80 80
81 protected: 81 protected:
82 SystemTray* tray() { return tray_; } 82 SystemTray* tray() { return tray_; }
83 TrayDisplay* tray_display() { return tray_display_; } 83 TrayDisplay* tray_display() { return tray_display_; }
84 void UpdateTray();
84 85
85 void CloseNotification(); 86 void CloseNotification();
86 bool IsDisplayVisibleInTray() const; 87 bool IsDisplayVisibleInTray() const;
87 base::string16 GetTrayDisplayText() const; 88 base::string16 GetTrayDisplayText() const;
88 void CheckAccessibleName() const; 89 void CheckAccessibleName() const;
89 base::string16 GetTrayDisplayTooltipText() const; 90 base::string16 GetTrayDisplayTooltipText() const;
90 base::string16 GetDisplayNotificationText() const; 91 base::string16 GetDisplayNotificationText() const;
91 base::string16 GetDisplayNotificationAdditionalText() const; 92 base::string16 GetDisplayNotificationAdditionalText() const;
92 93
93 private: 94 private:
94 const message_center::Notification* GetDisplayNotification() const; 95 const message_center::Notification* GetDisplayNotification() const;
95 96
96 // Weak reference, owned by Shell. 97 // Weak reference, owned by Shell.
97 SystemTray* tray_; 98 SystemTray* tray_;
98 99
99 // Weak reference, owned by |tray_|. 100 // Weak reference, owned by |tray_|.
100 TrayDisplay* tray_display_; 101 TrayDisplay* tray_display_;
101 102
102 DISALLOW_COPY_AND_ASSIGN(TrayDisplayTest); 103 DISALLOW_COPY_AND_ASSIGN(TrayDisplayTest);
103 }; 104 };
104 105
105 TrayDisplayTest::TrayDisplayTest() : tray_(NULL), tray_display_(NULL) { 106 TrayDisplayTest::TrayDisplayTest() : tray_(NULL), tray_display_(NULL) {
106 } 107 }
107 108
108 TrayDisplayTest::~TrayDisplayTest() { 109 TrayDisplayTest::~TrayDisplayTest() {
109 } 110 }
110 111
111 void TrayDisplayTest::SetUp() { 112 void TrayDisplayTest::SetUp() {
112 ash::test::AshTestBase::SetUp(); 113 ash::test::AshTestBase::SetUp();
114 UpdateTray();
115 }
116
117 void TrayDisplayTest::UpdateTray() {
113 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray(); 118 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray();
114 tray_display_ = new TrayDisplay(tray_); 119 tray_display_ = new TrayDisplay(tray_);
115 tray_->AddTrayItem(tray_display_); 120 tray_->AddTrayItem(tray_display_);
116 } 121 }
117 122
118 void TrayDisplayTest::CloseNotification() { 123 void TrayDisplayTest::CloseNotification() {
119 message_center::MessageCenter::Get()->RemoveNotification( 124 message_center::MessageCenter::Get()->RemoveNotification(
120 TrayDisplay::kNotificationId, false); 125 TrayDisplay::kNotificationId, false);
121 RunAllPendingInMessageLoop(); 126 RunAllPendingInMessageLoop();
122 } 127 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 UpdateDisplay("400x400@1.5"); 289 UpdateDisplay("400x400@1.5");
285 tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 290 tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
286 EXPECT_TRUE(IsDisplayVisibleInTray()); 291 EXPECT_TRUE(IsDisplayVisibleInTray());
287 expected = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); 292 expected = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED);
288 EXPECT_EQ(expected, GetTrayDisplayText()); 293 EXPECT_EQ(expected, GetTrayDisplayText());
289 EXPECT_EQ( 294 EXPECT_EQ(
290 GetTooltipText( 295 GetTooltipText(
291 expected, GetFirstDisplayName(), "600x600", base::string16(), ""), 296 expected, GetFirstDisplayName(), "600x600", base::string16(), ""),
292 GetTrayDisplayTooltipText()); 297 GetTrayDisplayTooltipText());
293 CheckAccessibleName(); 298 CheckAccessibleName();
299
300 // Unified mode
301 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED);
302 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED);
303 UpdateDisplay("300x200,400x500");
304 // Update the cache variables as the primary root window changed.
305 UpdateTray();
Jun Mukai 2015/05/13 18:03:49 Resetting the variable explicitly from a test case
306 tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
307 EXPECT_TRUE(IsDisplayVisibleInTray());
308 expected = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_UNIFIED);
309 EXPECT_EQ(expected, GetTrayDisplayText());
294 } 310 }
295 311
296 TEST_F(TrayDisplayTest, ExternalDisplayResized) { 312 TEST_F(TrayDisplayTest, ExternalDisplayResized) {
297 UpdateDisplay("400x400"); 313 UpdateDisplay("400x400");
298 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 314 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
299 gfx::Display::SetInternalDisplayId(display_manager->first_display_id()); 315 gfx::Display::SetInternalDisplayId(display_manager->first_display_id());
300 316
301 // Shows the tray_display even though there's a single-display. 317 // Shows the tray_display even though there's a single-display.
302 tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 318 tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
303 EXPECT_FALSE(IsDisplayVisibleInTray()); 319 EXPECT_FALSE(IsDisplayVisibleInTray());
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // rotate the second. 573 // rotate the second.
558 UpdateDisplay("400x400,200x200/r"); 574 UpdateDisplay("400x400,200x200/r");
559 EXPECT_EQ(l10n_util::GetStringFUTF16( 575 EXPECT_EQ(l10n_util::GetStringFUTF16(
560 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(), 576 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetSecondDisplayName(),
561 l10n_util::GetStringUTF16( 577 l10n_util::GetStringUTF16(
562 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)), 578 IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90)),
563 GetDisplayNotificationAdditionalText()); 579 GetDisplayNotificationAdditionalText());
564 } 580 }
565 581
566 } // namespace ash 582 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/tray_display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698