Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 2726823003: Remove WmLookup. (Closed)
Patch Set: Clean up include and modify comment. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/common/accessibility_delegate.h" 8 #include "ash/common/accessibility_delegate.h"
9 #include "ash/common/accessibility_types.h" 9 #include "ash/common/accessibility_types.h"
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
11 #include "ash/common/shelf/shelf_widget.h" 11 #include "ash/common/shelf/shelf_widget.h"
12 #include "ash/common/shelf/wm_shelf.h" 12 #include "ash/common/shelf/wm_shelf.h"
13 #include "ash/common/system/tray/system_tray.h" 13 #include "ash/common/system/tray/system_tray.h"
14 #include "ash/common/test/test_shelf_delegate.h" 14 #include "ash/common/test/test_shelf_delegate.h"
15 #include "ash/common/wm/dock/docked_window_layout_manager.h" 15 #include "ash/common/wm/dock/docked_window_layout_manager.h"
16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
17 #include "ash/common/wm/mru_window_tracker.h" 17 #include "ash/common/wm/mru_window_tracker.h"
18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
19 #include "ash/common/wm/overview/window_grid.h" 19 #include "ash/common/wm/overview/window_grid.h"
20 #include "ash/common/wm/overview/window_selector.h" 20 #include "ash/common/wm/overview/window_selector.h"
21 #include "ash/common/wm/overview/window_selector_controller.h" 21 #include "ash/common/wm/overview/window_selector_controller.h"
22 #include "ash/common/wm/overview/window_selector_item.h" 22 #include "ash/common/wm/overview/window_selector_item.h"
23 #include "ash/common/wm/panels/panel_layout_manager.h" 23 #include "ash/common/wm/panels/panel_layout_manager.h"
24 #include "ash/common/wm/window_state.h" 24 #include "ash/common/wm/window_state.h"
25 #include "ash/common/wm/wm_event.h" 25 #include "ash/common/wm/wm_event.h"
26 #include "ash/common/wm/workspace/workspace_window_resizer.h" 26 #include "ash/common/wm/workspace/workspace_window_resizer.h"
27 #include "ash/common/wm_lookup.h"
28 #include "ash/common/wm_shell.h" 27 #include "ash/common/wm_shell.h"
29 #include "ash/common/wm_window.h" 28 #include "ash/common/wm_window.h"
30 #include "ash/common/wm_window_property.h" 29 #include "ash/common/wm_window_property.h"
31 #include "ash/drag_drop/drag_drop_controller.h" 30 #include "ash/drag_drop/drag_drop_controller.h"
32 #include "ash/public/cpp/shell_window_ids.h" 31 #include "ash/public/cpp/shell_window_ids.h"
33 #include "ash/root_window_controller.h" 32 #include "ash/root_window_controller.h"
34 #include "ash/shell.h" 33 #include "ash/shell.h"
35 #include "ash/test/ash_test_base.h" 34 #include "ash/test/ash_test_base.h"
36 #include "ash/test/shelf_view_test_api.h" 35 #include "ash/test/shelf_view_test_api.h"
37 #include "ash/test/shell_test_api.h" 36 #include "ash/test/shell_test_api.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // cause a window to be closed via 152 // cause a window to be closed via
154 // views::Widget::GetWidgetForNativeView(window)->Close(). 153 // views::Widget::GetWidgetForNativeView(window)->Close().
155 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) { 154 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) {
156 std::unique_ptr<views::Widget> widget(new views::Widget); 155 std::unique_ptr<views::Widget> widget(new views::Widget);
157 views::Widget::InitParams params; 156 views::Widget::InitParams params;
158 params.bounds = bounds; 157 params.bounds = bounds;
159 params.type = views::Widget::InitParams::TYPE_WINDOW; 158 params.type = views::Widget::InitParams::TYPE_WINDOW;
160 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 159 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
161 widget->Init(params); 160 widget->Init(params);
162 widget->Show(); 161 widget->Show();
163 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 162 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
164 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); 163 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight);
165 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); 164 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow());
166 return widget; 165 return widget;
167 } 166 }
168 167
169 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { 168 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
170 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 169 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
171 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); 170 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds);
172 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); 171 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight);
173 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window)); 172 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window));
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // via the widget. We also use the widget to determine if the window has been 1122 // via the widget. We also use the widget to determine if the window has been
1124 // closed or not. We explicity create the widget so that the window can be 1123 // closed or not. We explicity create the widget so that the window can be
1125 // parented to a non-primary root window. 1124 // parented to a non-primary root window.
1126 std::unique_ptr<views::Widget> widget(new views::Widget); 1125 std::unique_ptr<views::Widget> widget(new views::Widget);
1127 views::Widget::InitParams params; 1126 views::Widget::InitParams params;
1128 params.bounds = gfx::Rect(650, 0, 400, 400); 1127 params.bounds = gfx::Rect(650, 0, 400, 400);
1129 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 1128 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1130 params.parent = window1->parent(); 1129 params.parent = window1->parent();
1131 widget->Init(params); 1130 widget->Init(params);
1132 widget->Show(); 1131 widget->Show();
1133 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 1132 WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
1134 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); 1133 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight);
1135 1134
1136 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); 1135 ASSERT_EQ(root_windows[1], window1->GetRootWindow());
1137 1136
1138 ToggleOverview(); 1137 ToggleOverview();
1139 1138
1140 aura::Window* window2 = widget->GetNativeWindow(); 1139 aura::Window* window2 = widget->GetNativeWindow();
1141 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); 1140 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2);
1142 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); 1141 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5);
1143 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); 1142 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point);
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 2133 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
2135 ASSERT_TRUE(resizer.get()); 2134 ASSERT_TRUE(resizer.get());
2136 gfx::Point location = resizer->GetInitialLocation(); 2135 gfx::Point location = resizer->GetInitialLocation();
2137 location.Offset(20, 20); 2136 location.Offset(20, 20);
2138 resizer->Drag(location, 0); 2137 resizer->Drag(location, 0);
2139 ToggleOverview(); 2138 ToggleOverview();
2140 resizer->RevertDrag(); 2139 resizer->RevertDrag();
2141 } 2140 }
2142 2141
2143 } // namespace ash 2142 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698