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

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

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: 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" 27 #include "ash/common/wm_lookup.h"
28 #include "ash/common/wm_shell.h" 28 #include "ash/common/wm_shell.h"
29 #include "ash/common/wm_window.h" 29 #include "ash/common/wm_window.h"
30 #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"
38 #include "ash/test/test_app_list_view_presenter_impl.h" 37 #include "ash/test/test_app_list_view_presenter_impl.h"
39 #include "ash/wm/window_state_aura.h" 38 #include "ash/wm/window_state_aura.h"
40 #include "ash/wm/window_util.h" 39 #include "ash/wm/window_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = WmLookup::Get()->GetWindowForWidget(widget.get());
164 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); 163 window->aura_window()->SetProperty(aura::client::kTopViewInset,
164 kHeaderHeight);
165 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); 165 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow());
166 return widget; 166 return widget;
167 } 167 }
168 168
169 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { 169 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
170 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 170 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
171 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); 171 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds);
172 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); 172 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight);
173 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window)); 173 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window));
174 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); 174 shelf_view_test()->RunMessageLoopUntilAnimationsDone();
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 // 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
1124 // parented to a non-primary root window. 1124 // parented to a non-primary root window.
1125 std::unique_ptr<views::Widget> widget(new views::Widget); 1125 std::unique_ptr<views::Widget> widget(new views::Widget);
1126 views::Widget::InitParams params; 1126 views::Widget::InitParams params;
1127 params.bounds = gfx::Rect(650, 0, 400, 400); 1127 params.bounds = gfx::Rect(650, 0, 400, 400);
1128 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 1128 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
1129 params.parent = window1->parent(); 1129 params.parent = window1->parent();
1130 widget->Init(params); 1130 widget->Init(params);
1131 widget->Show(); 1131 widget->Show();
1132 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 1132 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get());
1133 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); 1133 window->aura_window()->SetProperty(aura::client::kTopViewInset,
1134 kHeaderHeight);
1134 1135
1135 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); 1136 ASSERT_EQ(root_windows[1], window1->GetRootWindow());
1136 1137
1137 ToggleOverview(); 1138 ToggleOverview();
1138 1139
1139 aura::Window* window2 = widget->GetNativeWindow(); 1140 aura::Window* window2 = widget->GetNativeWindow();
1140 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); 1141 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2);
1141 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); 1142 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5);
1142 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); 1143 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point);
1143 1144
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 2129 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
2129 ASSERT_TRUE(resizer.get()); 2130 ASSERT_TRUE(resizer.get());
2130 gfx::Point location = resizer->GetInitialLocation(); 2131 gfx::Point location = resizer->GetInitialLocation();
2131 location.Offset(20, 20); 2132 location.Offset(20, 20);
2132 resizer->Drag(location, 0); 2133 resizer->Drag(location, 0);
2133 ToggleOverview(); 2134 ToggleOverview();
2134 resizer->RevertDrag(); 2135 resizer->RevertDrag();
2135 } 2136 }
2136 2137
2137 } // namespace ash 2138 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698