OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/common/wm/workspace_controller.h" | 5 #include "ash/common/wm/workspace_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/shelf_layout_manager.h" | 10 #include "ash/common/shelf/shelf_layout_manager.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 w1->Show(); | 714 w1->Show(); |
715 wm::ActivateWindow(w1.get()); | 715 wm::ActivateWindow(w1.get()); |
716 | 716 |
717 // The window with the transient parent should get added to the same parent as | 717 // The window with the transient parent should get added to the same parent as |
718 // the normal window. | 718 // the normal window. |
719 EXPECT_EQ(w2->parent(), w1->parent()); | 719 EXPECT_EQ(w2->parent(), w1->parent()); |
720 } | 720 } |
721 | 721 |
722 // Test the placement of newly created windows. | 722 // Test the placement of newly created windows. |
723 TEST_P(WorkspaceControllerTest, BasicAutoPlacingOnCreate) { | 723 TEST_P(WorkspaceControllerTest, BasicAutoPlacingOnCreate) { |
724 if (!SupportsHostWindowResize()) | |
725 return; | |
726 UpdateDisplay("1600x1200"); | 724 UpdateDisplay("1600x1200"); |
727 // Creating a popup handler here to make sure it does not interfere with the | 725 // Creating a popup handler here to make sure it does not interfere with the |
728 // existing windows. | 726 // existing windows. |
729 gfx::Rect source_browser_bounds(16, 32, 640, 320); | 727 gfx::Rect source_browser_bounds(16, 32, 640, 320); |
730 std::unique_ptr<aura::Window> browser_window( | 728 std::unique_ptr<aura::Window> browser_window( |
731 CreateBrowserLikeWindow(source_browser_bounds)); | 729 CreateBrowserLikeWindow(source_browser_bounds)); |
732 | 730 |
733 // Creating a popup to make sure it does not interfere with the positioning. | 731 // Creating a popup to make sure it does not interfere with the positioning. |
734 std::unique_ptr<aura::Window> browser_popup( | 732 std::unique_ptr<aura::Window> browser_popup( |
735 CreatePopupLikeWindow(gfx::Rect(16, 32, 128, 256))); | 733 CreatePopupLikeWindow(gfx::Rect(16, 32, 128, 256))); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 // After the other window get hidden the window has to move back to the | 1028 // After the other window get hidden the window has to move back to the |
1031 // previous position and the bounds should still be set and unchanged. | 1029 // previous position and the bounds should still be set and unchanged. |
1032 EXPECT_EQ(user_pos.ToString(), window1->bounds().ToString()); | 1030 EXPECT_EQ(user_pos.ToString(), window1->bounds().ToString()); |
1033 ASSERT_TRUE(window1_state->pre_auto_manage_window_bounds()); | 1031 ASSERT_TRUE(window1_state->pre_auto_manage_window_bounds()); |
1034 EXPECT_EQ(user_pos.ToString(), | 1032 EXPECT_EQ(user_pos.ToString(), |
1035 window1_state->pre_auto_manage_window_bounds()->ToString()); | 1033 window1_state->pre_auto_manage_window_bounds()->ToString()); |
1036 } | 1034 } |
1037 | 1035 |
1038 // Solo window should be restored to the bounds where a user moved to. | 1036 // Solo window should be restored to the bounds where a user moved to. |
1039 TEST_P(WorkspaceControllerTest, TestRestoreToUserModifiedBounds) { | 1037 TEST_P(WorkspaceControllerTest, TestRestoreToUserModifiedBounds) { |
1040 if (!SupportsHostWindowResize()) | |
1041 return; | |
1042 | |
1043 UpdateDisplay("400x300"); | 1038 UpdateDisplay("400x300"); |
1044 gfx::Rect default_bounds(10, 0, 100, 100); | 1039 gfx::Rect default_bounds(10, 0, 100, 100); |
1045 std::unique_ptr<aura::Window> window1( | 1040 std::unique_ptr<aura::Window> window1( |
1046 CreateTestWindowInShellWithBounds(default_bounds)); | 1041 CreateTestWindowInShellWithBounds(default_bounds)); |
1047 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); | 1042 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); |
1048 window1->Hide(); | 1043 window1->Hide(); |
1049 window1_state->set_window_position_managed(true); | 1044 window1_state->set_window_position_managed(true); |
1050 window1->Show(); | 1045 window1->Show(); |
1051 // First window is centered. | 1046 // First window is centered. |
1052 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); | 1047 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 ui::EventTimeForNow()); | 1608 ui::EventTimeForNow()); |
1614 target = targeter->FindTargetForEvent(root, &touch); | 1609 target = targeter->FindTargetForEvent(root, &touch); |
1615 if (points[i].is_target_hit) | 1610 if (points[i].is_target_hit) |
1616 EXPECT_EQ(window.get(), target); | 1611 EXPECT_EQ(window.get(), target); |
1617 else | 1612 else |
1618 EXPECT_NE(window.get(), target); | 1613 EXPECT_NE(window.get(), target); |
1619 } | 1614 } |
1620 } | 1615 } |
1621 | 1616 |
1622 } // namespace ash | 1617 } // namespace ash |
OLD | NEW |