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/wm/workspace_controller.h" | 5 #include "ash/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/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
10 #include "ash/common/wm/panels/panel_layout_manager.h" | 11 #include "ash/common/wm/panels/panel_layout_manager.h" |
11 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 13 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
13 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
14 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
15 #include "ash/shelf/shelf_layout_manager.h" | 16 #include "ash/shelf/shelf_layout_manager.h" |
16 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
18 #include "ash/system/status_area_widget.h" | 19 #include "ash/system/status_area_widget.h" |
19 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
20 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
21 #include "ash/test/test_shelf_delegate.h" | 22 #include "ash/test/test_shelf_delegate.h" |
22 #include "ash/wm/aura/wm_window_aura.h" | |
23 #include "ash/wm/window_state_aura.h" | 23 #include "ash/wm/window_state_aura.h" |
24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
26 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/test/test_window_delegate.h" | 27 #include "ui/aura/test/test_window_delegate.h" |
28 #include "ui/aura/test/test_windows.h" | 28 #include "ui/aura/test/test_windows.h" |
29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
31 #include "ui/base/hit_test.h" | 31 #include "ui/base/hit_test.h" |
32 #include "ui/base/ui_base_types.h" | 32 #include "ui/base/ui_base_types.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const gfx::Rect& bounds) { | 122 const gfx::Rect& bounds) { |
123 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 123 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
124 delegate, | 124 delegate, |
125 ui::wm::WINDOW_TYPE_PANEL, | 125 ui::wm::WINDOW_TYPE_PANEL, |
126 0, | 126 0, |
127 bounds); | 127 bounds); |
128 test::TestShelfDelegate* shelf_delegate = | 128 test::TestShelfDelegate* shelf_delegate = |
129 test::TestShelfDelegate::instance(); | 129 test::TestShelfDelegate::instance(); |
130 shelf_delegate->AddShelfItem(window); | 130 shelf_delegate->AddShelfItem(window); |
131 PanelLayoutManager* manager = | 131 PanelLayoutManager* manager = |
132 PanelLayoutManager::Get(wm::WmWindowAura::Get(window)); | 132 PanelLayoutManager::Get(WmWindowAura::Get(window)); |
133 manager->Relayout(); | 133 manager->Relayout(); |
134 return window; | 134 return window; |
135 } | 135 } |
136 | 136 |
137 aura::Window* GetDesktop() { | 137 aura::Window* GetDesktop() { |
138 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 138 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
139 kShellWindowId_DefaultContainer); | 139 kShellWindowId_DefaultContainer); |
140 } | 140 } |
141 | 141 |
142 gfx::Rect GetFullscreenBounds(aura::Window* window) { | 142 gfx::Rect GetFullscreenBounds(aura::Window* window) { |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 // Auto positioning pushes windows to each sides. | 1057 // Auto positioning pushes windows to each sides. |
1058 EXPECT_EQ("0,0 100x100", window1->bounds().ToString()); | 1058 EXPECT_EQ("0,0 100x100", window1->bounds().ToString()); |
1059 EXPECT_EQ("300,0 100x100", window2->bounds().ToString()); | 1059 EXPECT_EQ("300,0 100x100", window2->bounds().ToString()); |
1060 | 1060 |
1061 window2->Hide(); | 1061 window2->Hide(); |
1062 // Restores to the center. | 1062 // Restores to the center. |
1063 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); | 1063 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); |
1064 | 1064 |
1065 // A user moved the window. | 1065 // A user moved the window. |
1066 std::unique_ptr<WindowResizer> resizer( | 1066 std::unique_ptr<WindowResizer> resizer( |
1067 CreateWindowResizer(wm::WmWindowAura::Get(window1.get()), gfx::Point(), | 1067 CreateWindowResizer(WmWindowAura::Get(window1.get()), gfx::Point(), |
1068 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE) | 1068 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE) |
1069 .release()); | 1069 .release()); |
1070 gfx::Point location = resizer->GetInitialLocation(); | 1070 gfx::Point location = resizer->GetInitialLocation(); |
1071 location.Offset(-50, 0); | 1071 location.Offset(-50, 0); |
1072 resizer->Drag(location, 0); | 1072 resizer->Drag(location, 0); |
1073 resizer->CompleteDrag(); | 1073 resizer->CompleteDrag(); |
1074 | 1074 |
1075 window1_state->set_bounds_changed_by_user(true); | 1075 window1_state->set_bounds_changed_by_user(true); |
1076 window1->SetBounds(gfx::Rect(100, 0, 100, 100)); | 1076 window1->SetBounds(gfx::Rect(100, 0, 100, 100)); |
1077 | 1077 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 ui::EventTimeForNow()); | 1610 ui::EventTimeForNow()); |
1611 target = targeter->FindTargetForEvent(root, &touch); | 1611 target = targeter->FindTargetForEvent(root, &touch); |
1612 if (points[i].is_target_hit) | 1612 if (points[i].is_target_hit) |
1613 EXPECT_EQ(window.get(), target); | 1613 EXPECT_EQ(window.get(), target); |
1614 else | 1614 else |
1615 EXPECT_NE(window.get(), target); | 1615 EXPECT_NE(window.get(), target); |
1616 } | 1616 } |
1617 } | 1617 } |
1618 | 1618 |
1619 } // namespace ash | 1619 } // namespace ash |
OLD | NEW |