diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-01 19:44:59 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-01 19:44:59 +0000 |
commit | 1a01538357fb26d6974a91fbe85b7f861e32c76f (patch) | |
tree | 8340058959698e218c6ae99377cc27a24b48aca7 /ash | |
parent | ed17b0d18ebb15f1a939d1d4e8f60899c1101661 (diff) | |
download | chromium_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')
-rw-r--r-- | ash/dip_unittest.cc | 9 | ||||
-rw-r--r-- | ash/display/display_controller_unittest.cc | 42 | ||||
-rw-r--r-- | ash/display/display_manager_unittest.cc | 64 | ||||
-rw-r--r-- | ash/extended_desktop_unittest.cc | 21 | ||||
-rw-r--r-- | ash/root_window_controller_unittest.cc | 8 | ||||
-rw-r--r-- | ash/screen_ash_unittest.cc | 2 | ||||
-rw-r--r-- | ash/test/ash_test_base.cc | 14 | ||||
-rw-r--r-- | ash/test/display_manager_test_api.cc | 22 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer_unittest.cc | 41 |
9 files changed, 63 insertions, 160 deletions
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index 84b230d..1df1ec7 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -27,15 +27,8 @@ namespace ash { typedef ash::test::AshTestBase DIPTest; -#if defined(OS_WIN) -// Windows/Aura doesn't have DIP support in display yet. -#define MAYBE_WorkArea DISABLED_WorkArea -#else -#define MAYBE_WorkArea WorkArea -#endif - // Test if the WM sets correct work area under different density. -TEST_F(DIPTest, MAYBE_WorkArea) { +TEST_F(DIPTest, WorkArea) { ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); aura::RootWindow* root = Shell::GetPrimaryRootWindow(); diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 56de605..cdf4f74 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -98,30 +98,11 @@ class DisplayControllerShutdownTest : public test::AshTestBase { typedef test::AshTestBase DisplayControllerTest; -#if defined(OS_WIN) -// TODO(oshima): Windows creates a window with smaller client area. -// Fix this and enable tests. -#define MAYBE_SecondaryDisplayLayout DISABLED_SecondaryDisplayLayout -#define MAYBE_BoundsUpdated DISABLED_BoundsUpdated -#define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin -#define MAYBE_CursorDeviceScaleFactorSwapPrimary \ - DISABLED_CursorDeviceScaleFactorSwapPrimary -#define MAYBE_Shutdown DISABLED_Shutdown -#else -#define MAYBE_SecondaryDisplayLayout SecondaryDisplayLayout -#define MAYBE_BoundsUpdated BoundsUpdated -#define MAYBE_CursorDeviceScaleFactorSwapPrimary \ - CursorDeviceScaleFactorSwapPrimary -#define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin -#define MAYBE_Shutdown Shutdown -#endif - -TEST_F(DisplayControllerShutdownTest, MAYBE_Shutdown) { +TEST_F(DisplayControllerShutdownTest, Shutdown) { UpdateDisplay("444x333, 200x200"); } -// Flaky - crbug.com/161857 -TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) { +TEST_F(DisplayControllerTest, SecondaryDisplayLayout) { TestObserver observer; UpdateDisplay("500x500,400x400"); EXPECT_EQ(2, observer.CountAndReset()) @@ -226,7 +207,7 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) { } -TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) { +TEST_F(DisplayControllerTest, BoundsUpdated) { TestObserver observer; SetSecondaryDisplayLayout(DisplayLayout::BOTTOM); UpdateDisplay("200x200,300x300"); // layout, resize and add. @@ -324,12 +305,10 @@ TEST_F(DisplayControllerTest, SwapPrimary) { EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); -#if !defined(OS_WIN) EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString()); EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); EXPECT_EQ("200,0 300x300", secondary_display.work_area().ToString()); -#endif // Switch primary and secondary display_controller->SetPrimaryDisplay(secondary_display); @@ -351,7 +330,6 @@ TEST_F(DisplayControllerTest, SwapPrimary) { EXPECT_TRUE(primary_root->Contains(launcher_window)); EXPECT_FALSE(secondary_root->Contains(launcher_window)); -#if !defined(OS_WIN) // Test if the bounds are correctly swapped. gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay(); gfx::Display swapped_secondary = ScreenAsh::GetSecondaryDisplay(); @@ -359,7 +337,6 @@ TEST_F(DisplayControllerTest, SwapPrimary) { EXPECT_EQ("0,0 300x252", swapped_primary.work_area().ToString()); EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); EXPECT_EQ("-200,-50 200x200", swapped_secondary.work_area().ToString()); -#endif const DisplayLayout& inverted_layout = display_controller->GetLayoutForDisplay(primary_display); @@ -502,7 +479,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { EXPECT_TRUE(primary_root->Contains(launcher_window)); } -TEST_F(DisplayControllerTest, MAYBE_CursorDeviceScaleFactorSwapPrimary) { +TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { DisplayController* display_controller = Shell::GetInstance()->display_controller(); @@ -554,16 +531,23 @@ TEST_F(DisplayControllerTest, MAYBE_CursorDeviceScaleFactorSwapPrimary) { EXPECT_EQ(1.0f, test_api.GetDeviceScaleFactor()); } +#if defined(OS_WIN) +// TODO(oshima): On Windows, we don't update the origin/size right away. +#define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin +#else +#define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin +#endif + TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) { UpdateDisplay("100x200,300x400"); ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); Shell::RootWindowList root_windows = Shell::GetInstance()->GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); - EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString()); + EXPECT_EQ("1,1", root_windows[0]->GetHostOrigin().ToString()); EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); // UpdateDisplay set the origin if it's not set. - EXPECT_NE("0,0", root_windows[1]->GetHostOrigin().ToString()); + EXPECT_NE("1,1", root_windows[1]->GetHostOrigin().ToString()); EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); UpdateDisplay("100x200,200+300-300x400"); diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index e7378b6..287d83d 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -95,21 +95,7 @@ class DisplayManagerTest : public test::AshTestBase, DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); }; -#if defined(OS_CHROMEOS) -// TODO(oshima): This fails with non extended desktop on windows. -// Reenable when extended desktop is enabled by default. -#define MAYBE_NativeDisplayTest NativeDisplayTest -#define MAYBE_EmulatorTest EmulatorTest -#define MAYBE_OverscanInsetsTest OverscanInsetsTest -#define MAYBE_ZeroOverscanInsets ZeroOverscanInsets -#else -#define MAYBE_NativeDisplayTest DISABLED_NativeDisplayTest -#define MAYBE_EmulatorTest DISABLED_EmulatorTest -#define MAYBE_OverscanInsetsTest DISABLED_OverscanInsetsTest -#define MAYBE_ZeroOverscanInsets DISABLED_ZeroOverscanInsets -#endif - -TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) { +TEST_F(DisplayManagerTest, NativeDisplayTest) { EXPECT_EQ(1U, display_manager()->GetNumDisplays()); // Update primary and add seconary. @@ -133,24 +119,24 @@ TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) { reset(); // Change primary. - UpdateDisplay("0+0-1000x600"); + UpdateDisplay("1+1-1000x600"); EXPECT_EQ("1 0 0", GetCountSummary()); EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); reset(); // Add secondary. - UpdateDisplay("0+0-1000x600,1001+0-600x400"); + UpdateDisplay("1+1-1000x600,1002+0-600x400"); EXPECT_EQ(2U, display_manager()->GetNumDisplays()); EXPECT_EQ("0 1 0", GetCountSummary()); EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); // Secondary display is on right. EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString()); - EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString()); + EXPECT_EQ("1002,0 600x400", added()[0].bounds_in_pixel().ToString()); reset(); // Secondary removed, primary changed. - UpdateDisplay("0+0-800x300"); + UpdateDisplay("1+1-800x300"); EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ("1 0 1", GetCountSummary()); EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); @@ -197,7 +183,7 @@ TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) { } // Test in emulation mode (use_fullscreen_host_window=false) -TEST_F(DisplayManagerTest, MAYBE_EmulatorTest) { +TEST_F(DisplayManagerTest, EmulatorTest) { EXPECT_EQ(1U, display_manager()->GetNumDisplays()); DisplayManager::CycleDisplay(); @@ -217,7 +203,7 @@ TEST_F(DisplayManagerTest, MAYBE_EmulatorTest) { reset(); } -TEST_F(DisplayManagerTest, MAYBE_OverscanInsetsTest) { +TEST_F(DisplayManagerTest, OverscanInsetsTest) { UpdateDisplay("0+0-500x500,0+501-400x400"); reset(); ASSERT_EQ(2u, display_manager()->GetNumDisplays()); @@ -291,7 +277,7 @@ TEST_F(DisplayManagerTest, MAYBE_OverscanInsetsTest) { GetPrimaryDisplay().bounds_in_pixel().ToString()); } -TEST_F(DisplayManagerTest, MAYBE_ZeroOverscanInsets) { +TEST_F(DisplayManagerTest, ZeroOverscanInsets) { // Make sure the display change events is emitted for overscan inset changes. UpdateDisplay("0+0-500x500,0+501-400x400"); ASSERT_EQ(2u, display_manager()->GetNumDisplays()); @@ -312,20 +298,7 @@ TEST_F(DisplayManagerTest, MAYBE_ZeroOverscanInsets) { EXPECT_EQ(display2_id, changed()[0].id()); } -// TODO(oshima): Device scale factor is supported on chromeos only for now. -#if defined(OS_CHROMEOS) -#define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange -#define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged -#define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ - NativeDisplaysChangedAfterPrimaryChange -#else -#define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange -#define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged -#define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ - DISABLED_NativeDisplaysChangedAfterPrimaryChange -#endif - -TEST_F(DisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { +TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { UpdateDisplay("1000x600"); EXPECT_EQ(1, Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); @@ -338,7 +311,7 @@ TEST_F(DisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { Shell::GetPrimaryRootWindow()->bounds().size().ToString()); } -TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { +TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { const int64 internal_display_id = display_manager()->SetFirstDisplayAsInternalDisplayForTest(); const gfx::Display native_display(internal_display_id, @@ -402,18 +375,7 @@ TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { FindDisplayForId(internal_display_id).bounds().ToString()); } -#if defined(OS_CHROMEOS) -#define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays -#define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ - EnsurePointerInDisplays_2ndOnLeft -#else -// TODO(oshima): Re-enable these tests on WinAura (http://crbug.com/158163). -#define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays -#define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ - DISABLED_EnsurePointerInDisplays_2ndOnLeft -#endif - -TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { +TEST_F(DisplayManagerTest, EnsurePointerInDisplays) { UpdateDisplay("200x200,300x300"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); @@ -451,7 +413,7 @@ TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { EXPECT_EQ("150,140", env->last_mouse_location().ToString()); } -TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { +TEST_F(DisplayManagerTest, EnsurePointerInDisplays_2ndOnLeft) { UpdateDisplay("200x200,300x300"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); @@ -486,7 +448,7 @@ TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { EXPECT_EQ("150,150", env->last_mouse_location().ToString()); } -TEST_F(DisplayManagerTest, MAYBE_NativeDisplaysChangedAfterPrimaryChange) { +TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) { const int64 internal_display_id = display_manager()->SetFirstDisplayAsInternalDisplayForTest(); const gfx::Display native_display(internal_display_id, diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 1d2b49e..d43fe02 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -325,14 +325,7 @@ TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { wm::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50))); } -#if defined(OS_WIN) -// TODO(mazda): Re-enable this (http://crbug.com/150986). -#define MAYBE_Capture DISABLED_Capture -#else -#define MAYBE_Capture Capture -#endif - -TEST_F(ExtendedDesktopTest, MAYBE_Capture) { +TEST_F(ExtendedDesktopTest, Capture) { UpdateDisplay("1000x600,600x400"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); @@ -359,11 +352,7 @@ TEST_F(ExtendedDesktopTest, MAYBE_Capture) { // The mouse is outside. On chromeos, the mouse is warped to the // dest root window, but it's not implemented on Win yet, so // no mouse move event on Win. -#if defined(OS_WIN) - EXPECT_EQ("1 0 0", r1_d1.GetMouseMotionCountsAndReset()); -#else EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset()); -#endif EXPECT_EQ("1 1", r1_d1.GetMouseButtonCountsAndReset()); // (15,15) on 1st display is (-985,15) on 2nd display. generator2.MoveMouseTo(-985, 15); @@ -442,13 +431,7 @@ TEST_F(ExtendedDesktopTest, MoveWindowByMouseClick) { EXPECT_EQ(root_windows[1], window->GetRootWindow()); } -// This test fails on the "Win Aura" bot: <http://crbug.com/157817>. -#if defined(OS_WIN) -#define MAYBE_MoveWindowToDisplay DISABLED_MoveWindowToDisplay -#else -#define MAYBE_MoveWindowToDisplay MoveWindowToDisplay -#endif -TEST_F(ExtendedDesktopTest, MAYBE_MoveWindowToDisplay) { +TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { UpdateDisplay("1000x1000,1000x1000"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index a1f3c3e..e8f5763 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -119,12 +119,10 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) { views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); maximized->Maximize(); EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); -#if !defined(OS_WIN) - // TODO(oshima): Window reports smaller screen size. Investigate why. + EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 500x500", maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); -#endif views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); minimized->Minimize(); @@ -135,13 +133,11 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) { views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); fullscreen->SetFullscreen(true); EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); -#if !defined(OS_WIN) - // TODO(oshima): Window reports smaller screen size. Investigate why. + EXPECT_EQ("600,0 500x500", fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 500x500", fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); -#endif // Make sure a window that will delete itself when losing focus // will not crash. diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc index 0fc71a6..79e5627 100644 --- a/ash/screen_ash_unittest.cc +++ b/ash/screen_ash_unittest.cc @@ -20,7 +20,6 @@ namespace test { typedef test::AshTestBase ScreenAshTest; -#if !defined(OS_WIN) TEST_F(ScreenAshTest, Bounds) { UpdateDisplay("600x600,500x500"); Shell::GetPrimaryRootWindowController()->SetShelfAutoHideBehavior( @@ -57,7 +56,6 @@ TEST_F(ScreenAshTest, Bounds) { ScreenAsh::GetDisplayWorkAreaBoundsInParent( secondary->GetNativeView()).ToString()); } -#endif TEST_F(ScreenAshTest, ConvertRect) { UpdateDisplay("600x600,500x500"); 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 diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index a9de503..b7c8eb0 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -163,25 +163,6 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { } // namespace -// Fails on win_aura since ash::GetRootWindowRelativeToWindow is not implemented -// yet for the platform. -#if defined(OS_WIN) -#define MAYBE_WindowDragWithMultiDisplays \ - DISABLED_WindowDragWithMultiDisplays -#define MAYBE_WindowDragWithMultiDisplaysRightToLeft \ - DISABLED_WindowDragWithMultiDisplaysRightToLeft -#define MAYBE_PhantomStyle DISABLED_PhantomStyle -#define MAYBE_CancelSnapPhantom DISABLED_CancelSnapPhantom -#define MAYBE_CursorDeviceScaleFactor DISABLED_CursorDeviceScaleFactor -#else -#define MAYBE_WindowDragWithMultiDisplays WindowDragWithMultiDisplays -#define MAYBE_WindowDragWithMultiDisplaysRightToLeft \ - WindowDragWithMultiDisplaysRightToLeft -#define MAYBE_PhantomStyle PhantomStyle -#define MAYBE_CancelSnapPhantom CancelSnapPhantom -#define MAYBE_CursorDeviceScaleFactor CursorDeviceScaleFactor -#endif - // Assertions around attached window resize dragging from the right with 2 // windows. TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { @@ -390,15 +371,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_2) { // Assertions around attached window resize dragging from the bottom with 3 // windows. -// TODO(oshima): Host window doesn't get a resize event after -// SetHostSize on Windows trybot, which gives wrong work/display area. -// crbug.com/141577. -#if defined(OS_WIN) -#define MAYBE_AttachedResize_BOTTOM_3 DISABLED_AttachedResize_BOTTOM_3 -#else -#define MAYBE_AttachedResize_BOTTOM_3 AttachedResize_BOTTOM_3 -#endif -TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) { +TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { aura::RootWindow* root = Shell::GetPrimaryRootWindow(); root->SetHostSize(gfx::Size(600, 800)); @@ -506,7 +479,6 @@ TEST_F(WorkspaceWindowResizerTest, Edge) { GetRestoreBoundsInScreen(window_.get())->ToString()); } -#if !defined(OS_WIN) // Test if the restore bounds is correct in multiple displays. ClearRestoreBounds(window_.get()); UpdateDisplay("800x600,200x600"); @@ -533,7 +505,6 @@ TEST_F(WorkspaceWindowResizerTest, Edge) { EXPECT_EQ("800,10 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); } -#endif } // Check that non resizable windows will not get resized. @@ -550,7 +521,7 @@ TEST_F(WorkspaceWindowResizerTest, NonResizableWindows) { } // Verifies a window can be moved from the primary display to another. -TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { +TEST_F(WorkspaceWindowResizerTest, WindowDragWithMultiDisplays) { // The secondary display is logically on the right, but on the system (e.g. X) // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. UpdateDisplay("800x600,800x600"); @@ -613,7 +584,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) { // Verifies a window can be moved from the secondary display to primary. TEST_F(WorkspaceWindowResizerTest, - MAYBE_WindowDragWithMultiDisplaysRightToLeft) { + WindowDragWithMultiDisplaysRightToLeft) { UpdateDisplay("800x600,800x600"); shelf_layout_manager()->LayoutShelf(); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); @@ -637,7 +608,7 @@ TEST_F(WorkspaceWindowResizerTest, } // Verifies the style of the drag phantom window is correct. -TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) { +TEST_F(WorkspaceWindowResizerTest, PhantomStyle) { UpdateDisplay("800x600,800x600"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); @@ -712,7 +683,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) { } // Verifies the style of the drag phantom window is correct. -TEST_F(WorkspaceWindowResizerTest, MAYBE_CancelSnapPhantom) { +TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { UpdateDisplay("800x600,800x600"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); @@ -1400,7 +1371,7 @@ TEST_F(WorkspaceWindowResizerTest, MagneticallyResize_LEFT) { // Verifies cursor's device scale factor is updated whe a window is moved across // root windows with different device scale factors (http://crbug.com/154183). -TEST_F(WorkspaceWindowResizerTest, MAYBE_CursorDeviceScaleFactor) { +TEST_F(WorkspaceWindowResizerTest, CursorDeviceScaleFactor) { // The secondary display is logically on the right, but on the system (e.g. X) // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. UpdateDisplay("400x400,800x800*2"); |