summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 04:07:24 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 04:07:24 +0000
commit36f5665394b23c0f2a4b678838f5b93a11b9e17d (patch)
tree357de618b23bafb153f75cd03fda9bbfb27681d0 /ash/test
parent9dd1d5809c8420f1e636154424826bf575804cdc (diff)
downloadchromium_src-36f5665394b23c0f2a4b678838f5b93a11b9e17d.zip
chromium_src-36f5665394b23c0f2a4b678838f5b93a11b9e17d.tar.gz
chromium_src-36f5665394b23c0f2a4b678838f5b93a11b9e17d.tar.bz2
Add switch primary display option by swapping primary root window between displays.
This has following sub-changes - DisplayController now manages which display is primary display, instead of relying on the order in DisplayManager - MultiDisplayManager uses display ID instead of order to check if a display has added/removed or its bounds has change. (which is fixes the TODO) - Primary display always has 0,0 origin. This also fixed a few issues that i discovered while working on this. - RootWindowHostLinux::SetBounds causes 2 ConfigureNotify, which causes unnecessary move/resize event. - mouse_cursor_event_filter and display_controller were using default_display_layout, which is wrong. It should use the layout for currently used secondary display. BUG=146886 TEST=covered by test. On device, press alt-f4 to switch primary display. Review URL: https://codereview.chromium.org/10905288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/ash_test_base.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 80c92a6..1676d36 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "ash/display/display_controller.h"
+#include "ash/display/multi_display_manager.h"
#include "ash/shell.h"
#include "ash/test/test_shell_delegate.h"
#include "base/run_loop.h"
@@ -58,7 +59,10 @@ void AshTestBase::SetUp() {
TestShellDelegate* delegate = new TestShellDelegate;
ash::Shell::CreateInstance(delegate);
Shell::GetPrimaryRootWindow()->Show();
- Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600));
+ // Move the mouse cursor to far away so that native events doesn't
+ // interfere test expectations.
+ Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
+ UpdateDisplay("800x600");
Shell::GetInstance()->cursor_manager()->ShowCursor(true);
// Disable animations during tests.
@@ -87,8 +91,11 @@ void AshTestBase::ChangeDisplayConfig(float scale,
void AshTestBase::UpdateDisplay(const std::string& display_specs) {
std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs);
- aura::Env::GetInstance()->display_manager()->
- OnNativeDisplaysChanged(displays);
+ internal::MultiDisplayManager* display_manager =
+ static_cast<internal::MultiDisplayManager*>(
+ aura::Env::GetInstance()->display_manager());
+ display_manager->SetDisplayIdsForTest(&displays);
+ 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