Index: ash/test/ash_test_base.cc |
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc |
index 07f93d061b7ee077197e500eac5a45d6b040e157..e559833f26b13dd12124b64342372fd2f11f811a 100644 |
--- a/ash/test/ash_test_base.cc |
+++ b/ash/test/ash_test_base.cc |
@@ -7,6 +7,7 @@ |
#include <string> |
#include <vector> |
+#include "ash/display/display_controller.h" |
#include "ash/shell.h" |
#include "ash/test/test_shell_delegate.h" |
#include "base/run_loop.h" |
@@ -87,6 +88,20 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) { |
std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs); |
aura::Env::GetInstance()->display_manager()-> |
OnNativeDisplaysChanged(displays); |
+ |
+ // On non-testing environment, when a secondary display is connected, a new |
+ // native (i.e. X) window for the display is always created below the previous |
+ // one for GPU performance reasons. Try to emulate the behavior. |
+ if (internal::DisplayController::IsExtendedDesktopEnabled()) { |
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
+ DCHECK_EQ(displays.size(), root_windows.size()); |
+ size_t next_y = 0; |
+ for (size_t i = 0; i < root_windows.size(); ++i) { |
+ const gfx::Size size = root_windows[i]->GetHostSize(); |
+ root_windows[i]->SetHostBounds(gfx::Rect(gfx::Point(0, next_y), size)); |
+ next_y += size.height(); |
+ } |
+ } |
} |
void AshTestBase::RunAllPendingInMessageLoop() { |