Index: ash/system/chromeos/screen_layout_observer_unittest.cc |
diff --git a/ash/system/chromeos/tray_display_unittest.cc b/ash/system/chromeos/screen_layout_observer_unittest.cc |
similarity index 35% |
rename from ash/system/chromeos/tray_display_unittest.cc |
rename to ash/system/chromeos/screen_layout_observer_unittest.cc |
index 1b6a69a22241444fa3af175c7dfcaa38070d7769..ebdcc4fa4e6003cd024cf42afec41f33d416fa36 100644 |
--- a/ash/system/chromeos/tray_display_unittest.cc |
+++ b/ash/system/chromeos/screen_layout_observer_unittest.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "ash/system/chromeos/tray_display.h" |
+#include "ash/system/chromeos/screen_layout_observer.h" |
#include "ash/common/system/chromeos/devicetype_utils.h" |
#include "ash/common/system/tray/system_tray.h" |
@@ -26,34 +26,6 @@ |
namespace ash { |
-base::string16 GetTooltipText(const base::string16& headline, |
- const base::string16& name1, |
- const std::string& data1, |
- const base::string16& name2, |
- const std::string& data2) { |
- std::vector<base::string16> lines; |
- lines.push_back(headline); |
- if (data1.empty()) { |
- lines.push_back(name1); |
- } else { |
- lines.push_back( |
- l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY, |
- name1, base::UTF8ToUTF16(data1))); |
- } |
- if (!name2.empty()) { |
- lines.push_back( |
- l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY, |
- name2, base::UTF8ToUTF16(data2))); |
- } |
- return base::JoinString(lines, base::ASCIIToUTF16("\n")); |
-} |
- |
-base::string16 GetMirroredTooltipText(const base::string16& headline, |
- const base::string16& name, |
- const std::string& data) { |
- return GetTooltipText(headline, name, data, base::string16(), ""); |
-} |
- |
base::string16 GetFirstDisplayName() { |
DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
return base::UTF8ToUTF16(display_manager->GetDisplayNameForId( |
@@ -72,370 +44,65 @@ base::string16 GetMirroringDisplayName() { |
display_manager->mirroring_display_id())); |
} |
-class TrayDisplayTest : public ash::test::AshTestBase { |
+class ScreenLayoutObserverTest : public test::AshTestBase { |
public: |
- TrayDisplayTest(); |
- ~TrayDisplayTest() override; |
- |
- void SetUp() override; |
+ ScreenLayoutObserverTest(); |
+ ~ScreenLayoutObserverTest() override; |
protected: |
- SystemTray* GetTray(); |
- TrayDisplay* GetTrayDisplay(); |
+ ScreenLayoutObserver* GetScreenLayoutObserver(); |
void CheckUpdate(); |
void CloseNotification(); |
- bool IsDisplayVisibleInTray() const; |
- base::string16 GetTrayDisplayText() const; |
- void CheckAccessibleName() const; |
- base::string16 GetTrayDisplayTooltipText() const; |
base::string16 GetDisplayNotificationText() const; |
base::string16 GetDisplayNotificationAdditionalText() const; |
private: |
const message_center::Notification* GetDisplayNotification() const; |
- // Weak reference, owned by Shell. |
- SystemTray* tray_; |
- |
- // Weak reference, owned by |tray_|. |
- TrayDisplay* tray_display_; |
- |
- DISALLOW_COPY_AND_ASSIGN(TrayDisplayTest); |
+ DISALLOW_COPY_AND_ASSIGN(ScreenLayoutObserverTest); |
}; |
-TrayDisplayTest::TrayDisplayTest() : tray_(NULL), tray_display_(NULL) {} |
- |
-TrayDisplayTest::~TrayDisplayTest() {} |
- |
-void TrayDisplayTest::SetUp() { |
- ash::test::AshTestBase::SetUp(); |
- // Populate tray_ and tray_display_. |
- CheckUpdate(); |
-} |
- |
-SystemTray* TrayDisplayTest::GetTray() { |
- CheckUpdate(); |
- return tray_; |
-} |
+ScreenLayoutObserverTest::ScreenLayoutObserverTest() {} |
-TrayDisplay* TrayDisplayTest::GetTrayDisplay() { |
- CheckUpdate(); |
- return tray_display_; |
-} |
+ScreenLayoutObserverTest::~ScreenLayoutObserverTest() {} |
-void TrayDisplayTest::CheckUpdate() { |
- SystemTray* current = GetPrimarySystemTray(); |
- if (tray_ != current) { |
- tray_ = current; |
- tray_display_ = new TrayDisplay(tray_); |
- tray_->AddTrayItem(tray_display_); |
- } |
+ScreenLayoutObserver* ScreenLayoutObserverTest::GetScreenLayoutObserver() { |
+ return Shell::GetInstance()->screen_layout_observer(); |
} |
-void TrayDisplayTest::CloseNotification() { |
+void ScreenLayoutObserverTest::CloseNotification() { |
message_center::MessageCenter::Get()->RemoveNotification( |
- TrayDisplay::kNotificationId, false); |
+ ScreenLayoutObserver::kNotificationId, false); |
RunAllPendingInMessageLoop(); |
} |
-bool TrayDisplayTest::IsDisplayVisibleInTray() const { |
- return tray_->HasSystemBubble() && tray_display_->default_view() && |
- tray_display_->default_view()->visible(); |
-} |
- |
-base::string16 TrayDisplayTest::GetTrayDisplayText() const { |
- return tray_display_->GetDefaultViewMessage(); |
-} |
- |
-void TrayDisplayTest::CheckAccessibleName() const { |
- ui::AXViewState state; |
- if (tray_display_->GetAccessibleStateForTesting(&state)) { |
- base::string16 expected = tray_display_->GetDefaultViewMessage(); |
- EXPECT_EQ(expected, state.name); |
- } |
-} |
- |
-base::string16 TrayDisplayTest::GetTrayDisplayTooltipText() const { |
- if (!tray_display_->default_view()) |
- return base::string16(); |
- |
- base::string16 tooltip; |
- if (!tray_display_->default_view()->GetTooltipText(gfx::Point(), &tooltip)) |
- return base::string16(); |
- return tooltip; |
-} |
- |
-base::string16 TrayDisplayTest::GetDisplayNotificationText() const { |
+base::string16 ScreenLayoutObserverTest::GetDisplayNotificationText() const { |
const message_center::Notification* notification = GetDisplayNotification(); |
return notification ? notification->title() : base::string16(); |
} |
-base::string16 TrayDisplayTest::GetDisplayNotificationAdditionalText() const { |
+base::string16 ScreenLayoutObserverTest::GetDisplayNotificationAdditionalText() |
+ const { |
const message_center::Notification* notification = GetDisplayNotification(); |
return notification ? notification->message() : base::string16(); |
} |
-const message_center::Notification* TrayDisplayTest::GetDisplayNotification() |
- const { |
+const message_center::Notification* |
+ScreenLayoutObserverTest::GetDisplayNotification() const { |
const message_center::NotificationList::Notifications notifications = |
message_center::MessageCenter::Get()->GetVisibleNotifications(); |
for (message_center::NotificationList::Notifications::const_iterator iter = |
notifications.begin(); |
iter != notifications.end(); ++iter) { |
- if ((*iter)->id() == TrayDisplay::kNotificationId) |
+ if ((*iter)->id() == ScreenLayoutObserver::kNotificationId) |
return *iter; |
} |
return NULL; |
} |
-TEST_F(TrayDisplayTest, NoInternalDisplay) { |
- UpdateDisplay("400x400"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- UpdateDisplay("400x400,200x200"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 expected = l10n_util::GetStringUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL); |
- base::string16 first_name = GetFirstDisplayName(); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), "200x200"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // mirroring |
- Shell::GetInstance()->display_manager()->SetSoftwareMirroring(true); |
- UpdateDisplay("400x400,200x200"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- expected = l10n_util::GetStringUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING_NO_INTERNAL); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetMirroredTooltipText(expected, GetFirstDisplayName(), "400x400"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
-} |
- |
-TEST_F(TrayDisplayTest, InternalDisplay) { |
- UpdateDisplay("400x400"); |
- DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
- display::Display::SetInternalDisplayId(display_manager->first_display_id()); |
- |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- // Extended |
- UpdateDisplay("400x400,200x200"); |
- base::string16 expected = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetSecondDisplayName()); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), "200x200"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Mirroring |
- display_manager->SetSoftwareMirroring(true); |
- UpdateDisplay("400x400,200x200"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- |
- expected = l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, |
- GetMirroringDisplayName()); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetMirroredTooltipText(expected, GetFirstDisplayName(), "400x400"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
-} |
- |
-TEST_F(TrayDisplayTest, InternalDisplayResized) { |
- UpdateDisplay("400x400@1.5"); |
- DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
- display::Display::SetInternalDisplayId(display_manager->first_display_id()); |
- |
- // Shows the tray_display even though there's a single-display. |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 internal_info = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY, GetFirstDisplayName(), |
- base::UTF8ToUTF16("600x600")); |
- EXPECT_EQ(internal_info, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(base::string16(), GetFirstDisplayName(), "600x600", |
- base::string16(), std::string()), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Extended |
- UpdateDisplay("400x400@1.5,200x200"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 expected = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, GetSecondDisplayName()); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "600x600", |
- GetSecondDisplayName(), "200x200"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Mirroring |
- display_manager->SetSoftwareMirroring(true); |
- UpdateDisplay("400x400@1.5,200x200"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- expected = l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, |
- GetMirroringDisplayName()); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetMirroredTooltipText(expected, GetFirstDisplayName(), "600x600"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Closed lid mode. |
- display_manager->SetSoftwareMirroring(false); |
- UpdateDisplay("400x400@1.5,200x200"); |
- display::Display::SetInternalDisplayId( |
- ScreenUtil::GetSecondaryDisplay().id()); |
- UpdateDisplay("400x400@1.5"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- expected = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_DOCKED); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "600x600", |
- base::string16(), ""), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Unified mode |
- display_manager->SetUnifiedDesktopEnabled(true); |
- UpdateDisplay("300x200,400x500"); |
- // Update the cache variables as the primary root window changed. |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- expected = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_UNIFIED); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
-} |
- |
-TEST_F(TrayDisplayTest, ExternalDisplayResized) { |
- UpdateDisplay("400x400"); |
- DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
- display::Display::SetInternalDisplayId(display_manager->first_display_id()); |
- |
- // Shows the tray_display even though there's a single-display. |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- // Extended |
- UpdateDisplay("400x400,200x200@1.5"); |
- const display::Display& secondary_display = ScreenUtil::GetSecondaryDisplay(); |
- |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 expected = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, |
- l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, GetSecondDisplayName(), |
- base::UTF8ToUTF16(secondary_display.size().ToString()))); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), "300x300"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- // Mirroring |
- display_manager->SetSoftwareMirroring(true); |
- UpdateDisplay("400x400,200x200@1.5"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- expected = l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, |
- GetMirroringDisplayName()); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetMirroredTooltipText(expected, GetFirstDisplayName(), "400x400"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
-} |
- |
-TEST_F(TrayDisplayTest, OverscanDisplay) { |
- UpdateDisplay("400x400,300x300/o"); |
- DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
- display::Display::SetInternalDisplayId(display_manager->first_display_id()); |
- |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- |
- // /o creates the default overscan, and if overscan is set, the annotation |
- // should be the size. |
- base::string16 overscan = l10n_util::GetStringUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATION_OVERSCAN); |
- base::string16 headline = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, |
- l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, |
- GetSecondDisplayName(), |
- base::UTF8ToUTF16("286x286"))); |
- std::string second_data = |
- l10n_util::GetStringFUTF8(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATION, |
- base::UTF8ToUTF16("286x286"), overscan); |
- EXPECT_EQ(GetTooltipText(headline, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), second_data), |
- GetTrayDisplayTooltipText()); |
- |
- // reset the overscan. |
- display_manager->SetOverscanInsets(ScreenUtil::GetSecondaryDisplay().id(), |
- gfx::Insets()); |
- headline = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED, |
- l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME, |
- GetSecondDisplayName(), overscan)); |
- second_data = |
- l10n_util::GetStringFUTF8(IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATION, |
- base::UTF8ToUTF16("300x300"), overscan); |
- EXPECT_EQ(GetTooltipText(headline, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), second_data), |
- GetTrayDisplayTooltipText()); |
-} |
- |
-TEST_F(TrayDisplayTest, UpdateDuringDisplayConfigurationChange) { |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- UpdateDisplay("400x400@1.5"); |
- EXPECT_TRUE(GetTray()->HasSystemBubble()); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 internal_info = l10n_util::GetStringFUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_SINGLE_DISPLAY, GetFirstDisplayName(), |
- base::UTF8ToUTF16("600x600")); |
- EXPECT_EQ(internal_info, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(base::string16(), GetFirstDisplayName(), "600x600", |
- base::string16(), std::string()), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- UpdateDisplay("400x400,200x200"); |
- EXPECT_TRUE(GetTray()->HasSystemBubble()); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- base::string16 expected = l10n_util::GetStringUTF16( |
- IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL); |
- base::string16 first_name = GetFirstDisplayName(); |
- EXPECT_EQ(expected, GetTrayDisplayText()); |
- EXPECT_EQ(GetTooltipText(expected, GetFirstDisplayName(), "400x400", |
- GetSecondDisplayName(), "200x200"), |
- GetTrayDisplayTooltipText()); |
- CheckAccessibleName(); |
- |
- UpdateDisplay("400x400@1.5"); |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- |
- // Back to the default state, the display tray item should disappear. |
- UpdateDisplay("400x400"); |
- EXPECT_TRUE(GetTray()->HasSystemBubble()); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
-} |
- |
-TEST_F(TrayDisplayTest, DisplayNotifications) { |
+TEST_F(ScreenLayoutObserverTest, DisplayNotifications) { |
test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); |
tray_delegate->set_should_show_display_notification(true); |
@@ -541,10 +208,9 @@ TEST_F(TrayDisplayTest, DisplayNotifications) { |
GetDisplayNotificationAdditionalText()); |
} |
-TEST_F(TrayDisplayTest, DisplayConfigurationChangedTwice) { |
+TEST_F(ScreenLayoutObserverTest, DisplayConfigurationChangedTwice) { |
tdanderson
2016/08/15 18:55:16
While you're here, can you please add descriptions
yiyix
2016/08/16 15:58:37
Done.
|
test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); |
tray_delegate->set_should_show_display_notification(true); |
- |
UpdateDisplay("400x400,200x200"); |
EXPECT_EQ(l10n_util::GetStringUTF16( |
IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL), |
@@ -553,7 +219,7 @@ TEST_F(TrayDisplayTest, DisplayConfigurationChangedTwice) { |
// OnDisplayConfigurationChanged() may be called more than once for a single |
// update display in case of primary is swapped or recovered from dock mode. |
// Should not remove the notification in such case. |
- GetTrayDisplay()->OnDisplayConfigurationChanged(); |
+ GetScreenLayoutObserver()->OnDisplayConfigurationChanged(); |
EXPECT_EQ(l10n_util::GetStringUTF16( |
IDS_ASH_STATUS_TRAY_DISPLAY_EXTENDED_NO_INTERNAL), |
GetDisplayNotificationText()); |
@@ -564,7 +230,7 @@ TEST_F(TrayDisplayTest, DisplayConfigurationChangedTwice) { |
EXPECT_TRUE(GetDisplayNotificationText().empty()); |
} |
-TEST_F(TrayDisplayTest, UpdateAfterSuppressDisplayNotification) { |
+TEST_F(ScreenLayoutObserverTest, UpdateAfterSuppressDisplayNotification) { |
UpdateDisplay("400x400,200x200"); |
test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); |
@@ -579,39 +245,24 @@ TEST_F(TrayDisplayTest, UpdateAfterSuppressDisplayNotification) { |
GetDisplayNotificationAdditionalText()); |
} |
-// Tests that when the only change is rotation, that it is only displayed when |
-// caused by user changes, and not by accelerometers. |
-TEST_F(TrayDisplayTest, RotationOnInternalDisplay) { |
- UpdateDisplay("400x400"); |
+// Verify that if no notification is shown when overscan of a screen is changed. |
tdanderson
2016/08/15 18:55:16
nit: remove "if"
yiyix
2016/08/16 15:58:37
Done.
|
+TEST_F(ScreenLayoutObserverTest, OverscanDisplay) { |
+ UpdateDisplay("400x400, 300x300"); |
+ test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); |
+ tray_delegate->set_should_show_display_notification(true); |
DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
- const int64_t display_id = display_manager->first_display_id(); |
- display::Display::SetInternalDisplayId(display_id); |
- |
- GetTray()->ShowDefaultView(BUBBLE_USE_EXISTING); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- // Accelerometer change does not display. |
- display_manager->SetDisplayRotation( |
- display_id, display::Display::ROTATE_90, |
- display::Display::ROTATION_SOURCE_ACCELEROMETER); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- // User change does. |
- display_manager->SetDisplayRotation(display_id, display::Display::ROTATE_180, |
- display::Display::ROTATION_SOURCE_USER); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
- |
- // If a user setting matches the accelerometer, do not display if caused by |
- // the accelerometer. |
- display_manager->SetDisplayRotation( |
- display_id, display::Display::ROTATE_180, |
- display::Display::ROTATION_SOURCE_ACCELEROMETER); |
- EXPECT_FALSE(IsDisplayVisibleInTray()); |
- |
- // If a non-rotation setting is changed, display regardless of the source of |
- // rotation so that the full message is shown. |
- UpdateDisplay("400x400@1.5"); |
- EXPECT_TRUE(IsDisplayVisibleInTray()); |
+ display::Display::SetInternalDisplayId(display_manager->first_display_id()); |
+ |
+ // /o creates the default overscan. |
tdanderson
2016/08/15 18:55:16
nit: typo
yiyix
2016/08/16 15:58:37
Done.
|
+ UpdateDisplay("400x400, 300x300/o"); |
+ EXPECT_TRUE(GetDisplayNotificationText().empty()); |
+ EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
+ |
+ // reset the overscan. |
tdanderson
2016/08/15 18:55:16
nit: reset->Reset
yiyix
2016/08/16 15:58:37
Done.
|
+ Shell::GetInstance()->display_manager()->SetOverscanInsets( |
+ ScreenUtil::GetSecondaryDisplay().id(), gfx::Insets()); |
+ EXPECT_TRUE(GetDisplayNotificationText().empty()); |
+ EXPECT_TRUE(GetDisplayNotificationAdditionalText().empty()); |
} |
} // namespace ash |