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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 2950083002: Add accelerometer support property to Display. (Closed)
Patch Set: fixed to bool Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/display/screen_ash.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 924f2148278ae1bfc63eb93cb8839471249b2212..4e21b73f2074d78a5dcb1401f94c270e1da1c254 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -2931,6 +2931,42 @@ TEST_F(DisplayManagerTest, GuessDisplayIdFieldsInDisplayLayout) {
EXPECT_EQ(id2, stored.placement_list[0].display_id);
}
+TEST_F(DisplayManagerTest, AccelerometerSupport) {
+ display::test::DisplayManagerTestApi(display_manager())
+ .SetFirstDisplayAsInternalDisplay();
+ display::Screen* screen = display::Screen::GetScreen();
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE,
+ screen->GetPrimaryDisplay().accelerometer_support());
+
+ display_manager()->set_internal_display_has_accelerometer(true);
+ display_manager()->UpdateDisplays();
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE,
+ screen->GetPrimaryDisplay().accelerometer_support());
+
+ UpdateDisplay("1000x1000,800x800");
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE,
+ screen->GetPrimaryDisplay().accelerometer_support());
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE,
+ display_manager()->GetSecondaryDisplay().accelerometer_support());
+
+ // Secondary is now primary and should not have accelerometer support.
+ std::vector<display::ManagedDisplayInfo> display_info_list;
+ display_info_list.push_back(
+ CreateDisplayInfo(display_manager()->GetSecondaryDisplay().id(),
+ gfx::Rect(1, 1, 100, 100)));
+ display_manager()->OnNativeDisplaysChanged(display_info_list);
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_UNAVAILABLE,
+ screen->GetPrimaryDisplay().accelerometer_support());
+
+ // Re-enable internal display.
+ display_info_list.clear();
+ display_info_list.push_back(CreateDisplayInfo(
+ display::Display::InternalDisplayId(), gfx::Rect(1, 1, 100, 100)));
+ display_manager()->OnNativeDisplaysChanged(display_info_list);
+ EXPECT_EQ(display::Display::ACCELEROMETER_SUPPORT_AVAILABLE,
+ screen->GetPrimaryDisplay().accelerometer_support());
+}
+
namespace {
class DisplayManagerOrientationTest : public DisplayManagerTest {
« no previous file with comments | « no previous file | ash/display/screen_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698