diff options
author | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-11 13:24:13 +0000 |
---|---|---|
committer | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-11 13:24:13 +0000 |
commit | 7d56f819d0d4c20c9448c68c8e251e06e010376e (patch) | |
tree | 8765b1a12525c75b1e085105493c6db9509e6d74 /ash/wm/workspace_controller_unittest.cc | |
parent | e92742011debdfab91e2622816aa5f91ff777177 (diff) | |
download | chromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.zip chromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.tar.gz chromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.tar.bz2 |
Revert 222512 "Group WM related properties to ash::wm::WindowSet..."
> Group WM related properties to ash::wm::WindowSettings
> * Introduced Observer to observe changes to the settings.
> * renamed UserHasChangedWindowPositinoOrSize to bounds_channed_by_user
>
> BUG=272460
>
> Review URL: https://chromiumcodereview.appspot.com/23518006
REASON FOR REVERT:
- Causing compiler errors on the tree: Win Aura Builder
http://build.chromium.org/p/chromium.win/buildstatus?builder=Win%20Aura%20Builder&number=11959
TBR=oshima@chromium.org
Review URL: https://codereview.chromium.org/23478025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/workspace_controller_unittest.cc')
-rw-r--r-- | ash/wm/workspace_controller_unittest.cc | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index 39b1906..4327225 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc @@ -17,7 +17,7 @@ #include "ash/test/ash_test_base.h" #include "ash/test/shell_test_api.h" #include "ash/wm/property_util.h" -#include "ash/wm/window_settings.h" +#include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" #include "base/command_line.h" #include "base/strings/string_number_conversions.h" @@ -103,9 +103,8 @@ class WorkspaceControllerTest : public test::AshTestBase { aura::Window* CreateBrowserLikeWindow(const gfx::Rect& bounds) { aura::Window* window = CreateTestWindow(); window->SetBounds(bounds); - wm::WindowSettings* settings = wm::GetWindowSettings(window); - settings->SetTrackedByWorkspace(true); - settings->set_window_position_managed(true); + SetTrackedByWorkspace(window, true); + wm::SetWindowPositionManaged(window, true); window->Show(); return window; } @@ -353,7 +352,7 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) { // A visible ignored window should not trigger the overlap. scoped_ptr<Window> w_ignored(CreateTestWindow()); w_ignored->SetBounds(touches_shelf_bounds); - wm::GetWindowSettings(&(*w_ignored))->set_ignored_by_shelf(true); + SetIgnoredByShelf(&(*w_ignored), true); w_ignored->Show(); EXPECT_FALSE(GetWindowOverlapsShelf()); @@ -695,7 +694,7 @@ TEST_F(WorkspaceControllerTest, TrackedByWorkspace) { w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); SetDefaultParentByPrimaryRootWindow(w2.get()); w2->Show(); - wm::GetWindowSettings(w2.get())->SetTrackedByWorkspace(false); + SetTrackedByWorkspace(w2.get(), false); wm::ActivateWindow(w2.get()); // Activating |w2| should force it to have the same parent as |w1|. @@ -712,7 +711,7 @@ TEST_F(WorkspaceControllerTest, TrackedByWorkspace) { // Transition it to tracked by worskpace. It should end up in the desktop // workspace. - wm::GetWindowSettings(w2.get())->SetTrackedByWorkspace(true); + SetTrackedByWorkspace(w2.get(), true); EXPECT_TRUE(wm::IsActiveWindow(w2.get())); EXPECT_TRUE(w1->IsVisible()); EXPECT_TRUE(w2->IsVisible()); @@ -800,10 +799,9 @@ TEST_F(WorkspaceControllerTest, BasicAutoPlacingOnShowHide) { EXPECT_EQ("16,32 640x320", window1->bounds().ToString()); // Test 2: Set up two managed windows and check their auto positioning. - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); - + ash::wm::SetWindowPositionManaged(window1.get(), true); scoped_ptr<aura::Window> window3(CreateTestWindowInShellWithId(2)); - wm::GetWindowSettings(window3.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window3.get(), true); // To avoid any auto window manager changes due to SetBounds, the window // gets first hidden and then shown again. window3->Hide(); @@ -840,7 +838,7 @@ TEST_F(WorkspaceControllerTest, BasicAutoPlacingOnShowHide) { // Test4: A single manageable window should get centered. window4.reset(); - wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(false); + ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), false); // Trigger the auto window placement function by showing (and hiding) it. window1->Hide(); window1->Show(); @@ -860,19 +858,19 @@ TEST_F(WorkspaceControllerTest, TestUserMovedWindowRepositioning) { window2->SetBounds(gfx::Rect(32, 48, 256, 512)); window1->Hide(); window2->Hide(); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); - EXPECT_FALSE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user()); - EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user()); + ash::wm::SetWindowPositionManaged(window1.get(), true); + ash::wm::SetWindowPositionManaged(window2.get(), true); + EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); + EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window2.get())); // Check that the current location gets preserved if the user has // positioned it previously. - wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(true); + ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true); window1->Show(); EXPECT_EQ("16,32 640x320", window1->bounds().ToString()); // Flag should be still set. - EXPECT_TRUE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user()); - EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user()); + EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); + EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window2.get())); // Turn on the second window and make sure that both windows are now // positionable again (user movement cleared). @@ -884,14 +882,14 @@ TEST_F(WorkspaceControllerTest, TestUserMovedWindowRepositioning) { base::IntToString(desktop_area.width() - window2->bounds().width()) + ",48 256x512", window2->bounds().ToString()); // FLag should now be reset. - EXPECT_FALSE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user()); - EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user()); + EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); + EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); // Going back to one shown window should keep the state. - wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(true); + ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true); window2->Hide(); EXPECT_EQ("0,32 640x320", window1->bounds().ToString()); - EXPECT_TRUE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user()); + EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get())); } // Test if the single window will be restored at original position. @@ -905,9 +903,9 @@ TEST_F(WorkspaceControllerTest, TestSingleWindowsRestoredBounds) { window1->Hide(); window2->Hide(); window3->Hide(); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); - wm::GetWindowSettings(window3.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); + ash::wm::SetWindowPositionManaged(window2.get(), true); + ash::wm::SetWindowPositionManaged(window3.get(), true); window1->Show(); wm::ActivateWindow(window1.get()); @@ -956,8 +954,8 @@ TEST_F(WorkspaceControllerTest, TestUserHandledWindowRestore) { window2->SetBounds(gfx::Rect(32, 48, 256, 512)); window1->Hide(); window2->Hide(); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); + ash::wm::SetWindowPositionManaged(window2.get(), true); window1->Show(); EXPECT_EQ(user_pos.ToString(), window1->bounds().ToString()); window2->Show(); @@ -981,12 +979,12 @@ TEST_F(WorkspaceControllerTest, TestUserHandledWindowRestore) { // Test that a window from normal to minimize will repos the remaining. TEST_F(WorkspaceControllerTest, ToMinimizeRepositionsRemaining) { scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); window1->SetBounds(gfx::Rect(16, 32, 640, 320)); gfx::Rect desktop_area = window1->parent()->bounds(); scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1)); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window2.get(), true); window2->SetBounds(gfx::Rect(32, 48, 256, 512)); ash::wm::MinimizeWindow(window1.get()); @@ -1009,11 +1007,11 @@ TEST_F(WorkspaceControllerTest, ToMinimizeRepositionsRemaining) { // Test that minimizing an initially maximized window will repos the remaining. TEST_F(WorkspaceControllerTest, MaxToMinRepositionsRemaining) { scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); gfx::Rect desktop_area = window1->parent()->bounds(); scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1)); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window2.get(), true); window2->SetBounds(gfx::Rect(32, 48, 256, 512)); ash::wm::MaximizeWindow(window1.get()); @@ -1031,11 +1029,11 @@ TEST_F(WorkspaceControllerTest, MaxToMinRepositionsRemaining) { TEST_F(WorkspaceControllerTest, NormToMaxToMinRepositionsRemaining) { scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); window1->SetBounds(gfx::Rect(16, 32, 640, 320)); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); gfx::Rect desktop_area = window1->parent()->bounds(); scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1)); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window2.get(), true); window2->SetBounds(gfx::Rect(32, 40, 256, 512)); // Trigger the auto window placement function by showing (and hiding) it. @@ -1063,11 +1061,11 @@ TEST_F(WorkspaceControllerTest, NormToMaxToMinRepositionsRemaining) { TEST_F(WorkspaceControllerTest, NormToMaxToNormRepositionsRemaining) { scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); window1->SetBounds(gfx::Rect(16, 32, 640, 320)); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); gfx::Rect desktop_area = window1->parent()->bounds(); scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1)); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window2.get(), true); window2->SetBounds(gfx::Rect(32, 40, 256, 512)); // Trigger the auto window placement function by showing (and hiding) it. @@ -1102,8 +1100,8 @@ TEST_F(WorkspaceControllerTest, AnimatedNormToMaxToNormRepositionsRemaining) { window2->Hide(); window2->SetBounds(gfx::Rect(32, 48, 256, 512)); - wm::GetWindowSettings(window1.get())->set_window_position_managed(true); - wm::GetWindowSettings(window2.get())->set_window_position_managed(true); + ash::wm::SetWindowPositionManaged(window1.get(), true); + ash::wm::SetWindowPositionManaged(window2.get(), true); // Make sure nothing is animating. window1->layer()->GetAnimator()->StopAnimating(); window2->layer()->GetAnimator()->StopAnimating(); @@ -1277,7 +1275,7 @@ TEST_F(WorkspaceControllerTest, DragFullscreenNonTrackedWindow) { EXPECT_EQ(0, observer.change_count()); // Set tracked to false and repeat, now the window should move. - wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(false); + SetTrackedByWorkspace(w1.get(), false); generator.MoveMouseTo(5, 5); generator.PressLeftButton(); generator.MoveMouseBy(100, 100); @@ -1286,7 +1284,7 @@ TEST_F(WorkspaceControllerTest, DragFullscreenNonTrackedWindow) { w1->bounds().ToString()); generator.ReleaseLeftButton(); - wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(true); + SetTrackedByWorkspace(w1.get(), true); // Marking the window tracked again should snap back to origin. EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString()); EXPECT_EQ(0, observer.change_count()); @@ -1326,7 +1324,7 @@ TEST_F(WorkspaceControllerTest, DragMaximizedNonTrackedWindow) { EXPECT_EQ(0, observer.change_count()); // Set tracked to false and repeat, now the window should move. - wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(false); + SetTrackedByWorkspace(w1.get(), false); generator.MoveMouseTo(5, 5); generator.PressLeftButton(); generator.MoveMouseBy(100, 100); @@ -1335,7 +1333,7 @@ TEST_F(WorkspaceControllerTest, DragMaximizedNonTrackedWindow) { w1->bounds().ToString()); generator.ReleaseLeftButton(); - wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(true); + SetTrackedByWorkspace(w1.get(), true); // Marking the window tracked again should snap back to origin. EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString()); EXPECT_EQ(0, observer.change_count()); |