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

Unified Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 615133002: Add support for a virtual display on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ash/ dep from content Created 5 years, 9 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 | « ui/display/chromeos/display_configurator.cc ('k') | ui/display/chromeos/display_snapshot_virtual.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/chromeos/display_configurator_unittest.cc
diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc
index dd99ab5e0fec68e6acb9fbbf9518281b9c282530..700fd28816b00be7c90c62ddacf5187a5d603934 100644
--- a/ui/display/chromeos/display_configurator_unittest.cc
+++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -305,6 +305,56 @@ TEST_F(DisplayConfiguratorTest, FindDisplayModeMatchingSize) {
output, gfx::Size(1440, 900)));
}
+TEST_F(DisplayConfiguratorTest, EnableVirtualDisplay) {
+ InitWithSingleOutput();
+
+ observer_.Reset();
+ const DisplayConfigurator::DisplayStateList* cached =
+ &configurator_.cached_displays();
+ ASSERT_EQ(static_cast<size_t>(1), cached->size());
+ EXPECT_EQ(small_mode_.size(), (*cached)[0].display->current_mode()->size());
+
+ // Add virtual display.
+ configurator_.EnableVirtualDisplay(big_mode_.size());
+ EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
+ EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
+ configurator_.display_state());
+
+ // Virtual should not trigger addition of added crtc but does change FB
+ // height.
+ const int kDualHeight = small_mode_.size().height() +
+ DisplayConfigurator::kVerticalGap +
+ big_mode_.size().height();
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
+ &outputs_[0], NULL).c_str(),
+ GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
+ kUngrab, NULL),
+ log_->GetActionsAndClear());
+ EXPECT_EQ(1, observer_.num_changes());
+ cached = &configurator_.cached_displays();
+ ASSERT_EQ(static_cast<size_t>(2), cached->size());
+ EXPECT_EQ(small_mode_.size(), (*cached)[0].display->current_mode()->size());
+ EXPECT_EQ(big_mode_.size(), (*cached)[1].display->current_mode()->size());
+
+ // Remove virtual display.
+ observer_.Reset();
+ configurator_.DisableVirtualDisplay();
+ EXPECT_EQ(JoinActions(kGrab, GetFramebufferAction(small_mode_.size(),
+ &outputs_[0], NULL).c_str(),
+ GetCrtcAction(outputs_[0], &small_mode_,
+ gfx::Point(0, 0)).c_str(),
+ kUngrab, NULL),
+ log_->GetActionsAndClear());
+ EXPECT_EQ(1, observer_.num_changes());
+ cached = &configurator_.cached_displays();
+ ASSERT_EQ(static_cast<size_t>(1), cached->size());
+ EXPECT_EQ(small_mode_.size(), (*cached)[0].display->current_mode()->size());
+ EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state());
+}
+
TEST_F(DisplayConfiguratorTest, ConnectSecondOutput) {
InitWithSingleOutput();
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | ui/display/chromeos/display_snapshot_virtual.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698