summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-01 19:44:59 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-01 19:44:59 +0000
commit1a01538357fb26d6974a91fbe85b7f861e32c76f (patch)
tree8340058959698e218c6ae99377cc27a24b48aca7 /ash/test
parented17b0d18ebb15f1a939d1d4e8f60899c1101661 (diff)
downloadchromium_src-1a01538357fb26d6974a91fbe85b7f861e32c76f.zip
chromium_src-1a01538357fb26d6974a91fbe85b7f861e32c76f.tar.gz
chromium_src-1a01538357fb26d6974a91fbe85b7f861e32c76f.tar.bz2
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. BUG=150986,157817,141577,148691 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=170621 Review URL: https://chromiumcodereview.appspot.com/11428066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/ash_test_base.cc14
-rw-r--r--ash/test/display_manager_test_api.cc22
2 files changed, 26 insertions, 10 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 479bc40..f308e69 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -26,6 +26,10 @@
#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 {
@@ -43,8 +47,13 @@ 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, "0+0-800x600");
+ switches::kAuraHostWindowSize, "1+1-800x600");
+#if defined(OS_WIN)
+ aura::test::SetUsePopupAsRootWindowForTest(true);
+#endif
// Disable animations during tests.
ui::LayerAnimator::set_disable_animations_for_test(true);
ui::TextInputTestSupport::Initialize();
@@ -67,6 +76,9 @@ 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 f068b64..0f87b62 100644
--- a/ash/test/display_manager_test_api.cc
+++ b/ash/test/display_manager_test_api.cc
@@ -41,9 +41,6 @@ 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)) {
@@ -57,14 +54,21 @@ 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) {
- 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();
+ // 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);
}
}
+
+ display_manager_->SetDisplayIdsForTest(&displays);
+ display_manager_->OnNativeDisplaysChanged(displays);
}
} // namespace test