diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-01 02:17:55 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-01 02:17:55 +0000 |
commit | b49c0117dde28ea3745b9774042e61703d10822d (patch) | |
tree | 42e2940f9d1c8f453a63d7e16efefe2a745fc1cf /ash/test | |
parent | 8e7bed1e9d453e808b32c446c58fc29b823ceacd (diff) | |
download | chromium_src-b49c0117dde28ea3745b9774042e61703d10822d.zip chromium_src-b49c0117dde28ea3745b9774042e61703d10822d.tar.gz chromium_src-b49c0117dde28ea3745b9774042e61703d10822d.tar.bz2 |
Revert "Use WS_POPUP for ash_unittests"
Use WS_POPUP for ash_unittests
- Layout test windows starting from (1,1) and move
mouse to (0,0) so that they don't overlap unless
test moves the cursor.
- Enabled disabled tests.
- RootWindowHostWin::SetBounds should move the window
and call OnHostResized when the scale factor has changed.
This also seems to fix the desktop size limitation issue (148691)
probably because a popup window can be larger than the desktop size.
TBR=oshima@chromium.org
BUG=150986, 157817, 141577, 148691
TEST=none
Review URL: https://codereview.chromium.org/11419271
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r-- | ash/test/ash_test_base.cc | 18 | ||||
-rw-r--r-- | ash/test/display_manager_test_api.cc | 22 |
2 files changed, 12 insertions, 28 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index e8d3514..479bc40 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -26,10 +26,6 @@ #include "ui/gfx/display.h" #include "ui/gfx/screen.h" -#if defined(OS_WIN) -#include "ui/aura/root_window_host_win.h" -#endif - namespace ash { namespace test { @@ -47,13 +43,8 @@ AshTestBase::~AshTestBase() { } void AshTestBase::SetUp() { - // Use the origin (1,1) so that it doesn't over - // lap with the native mouse cursor. CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kAuraHostWindowSize, "1+1-800x600"); -#if defined(OS_WIN) - aura::test::SetUsePopupAsRootWindowForTest(true); -#endif + switches::kAuraHostWindowSize, "0+0-800x600"); // Disable animations during tests. ui::LayerAnimator::set_disable_animations_for_test(true); ui::TextInputTestSupport::Initialize(); @@ -62,9 +53,9 @@ void AshTestBase::SetUp() { ash::Shell::CreateInstance(test_shell_delegate_); Shell::GetPrimaryRootWindow()->Show(); Shell::GetPrimaryRootWindow()->ShowRootWindow(); - // Move the mouse cursor to (0,0) so that native events doesn't + // Move the mouse cursor to far away so that native events doesn't // interfere test expectations. - Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(0, 0)); + Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); Shell::GetInstance()->cursor_manager()->ShowCursor(true); } @@ -76,9 +67,6 @@ void AshTestBase::TearDown() { Shell::DeleteInstance(); aura::Env::DeleteInstance(); ui::TextInputTestSupport::Shutdown(); -#if defined(OS_WIN) - aura::test::SetUsePopupAsRootWindowForTest(false); -#endif } void AshTestBase::ChangeDisplayConfig(float scale, diff --git a/ash/test/display_manager_test_api.cc b/ash/test/display_manager_test_api.cc index 0f87b62..f068b64 100644 --- a/ash/test/display_manager_test_api.cc +++ b/ash/test/display_manager_test_api.cc @@ -41,6 +41,9 @@ DisplayManagerTestApi::~DisplayManagerTestApi() {} void DisplayManagerTestApi::UpdateDisplay( const std::string& display_specs) { std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs); + display_manager_->SetDisplayIdsForTest(&displays); + display_manager_->OnNativeDisplaysChanged(displays); + bool is_host_origin_set = false; for (size_t i = 0; i < displays.size(); ++i) { if (displays[i].bounds_in_pixel().origin() != gfx::Point(0, 0)) { @@ -54,21 +57,14 @@ void DisplayManagerTestApi::UpdateDisplay( // previous one for GPU performance reasons. Try to emulate the behavior // unless host origins are explicitly set. if (!is_host_origin_set) { - // Sart from (1,1) so that windows won't overlap with native mouse cursor. - // See |AshTestBase::SetUp()|. - int next_y = 1; - for (std::vector<gfx::Display>::iterator iter = displays.begin(); - iter != displays.end(); ++iter) { - gfx::Rect bounds(iter->GetSizeInPixel()); - bounds.set_x(1); - bounds.set_y(next_y); - next_y += bounds.height(); - iter->SetScaleAndBounds(iter->device_scale_factor(), bounds); + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + int 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(); } } - - display_manager_->SetDisplayIdsForTest(&displays); - display_manager_->OnNativeDisplaysChanged(displays); } } // namespace test |