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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 738243002: Notify primary display reassignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index b9ed83d8150c41228ea16cefbda3250af2070f82..775f3d5c9fbcb5d7999b643eccacfa8b790c56db 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -1381,6 +1381,48 @@ TEST_F(DisplayManagerTest, InvertLayout) {
DisplayLayout(DisplayLayout::BOTTOM, -80).Invert().ToString());
}
+TEST_F(DisplayManagerTest, NotifyPrimaryChange) {
+ if (!SupportsMultipleDisplays())
+ return;
+ UpdateDisplay("500x500,500x500");
+ ash::Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
Jun Mukai 2014/11/20 00:58:38 Doesn't "SwapPrimaryDisplay" need to emit DISPLAY_
oshima 2014/11/20 01:12:20 metrics is reset below.
+ reset();
+ UpdateDisplay("500x500");
+ EXPECT_FALSE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
+ EXPECT_FALSE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
+ EXPECT_TRUE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
+
+ UpdateDisplay("500x500,500x500");
+ ash::Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
+ reset();
+ UpdateDisplay("500x400");
+ EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
+ EXPECT_TRUE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
+ EXPECT_TRUE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
+}
+
+TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) {
+ if (!SupportsMultipleDisplays())
+ return;
+ // Assume the default display is an external display, and
+ // emulates undocking by switching to another display.
+ DisplayInfo another_display_info =
+ CreateDisplayInfo(1, gfx::Rect(0, 0, 1280, 800));
+ std::vector<DisplayInfo> info_list;
+ info_list.push_back(another_display_info);
+ reset();
+ display_manager()->OnNativeDisplaysChanged(info_list);
+ EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS);
+ EXPECT_TRUE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
+ EXPECT_TRUE(changed_metrics() &
+ gfx::DisplayObserver::DISPLAY_METRIC_PRIMARY);
+}
+
#if defined(OS_WIN)
// TODO(scottmg): RootWindow doesn't get resized on Windows
// Ash. http://crbug.com/247916.

Powered by Google App Engine
This is Rietveld 408576698