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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager_unittest.cc

Issue 1918883002: Makes Panel related classes use ash/wm/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@phantom_window_controller
Patch Set: feedback Created 4 years, 7 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
« no previous file with comments | « ash/wm/common/wm_window_property.h ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" 5 #include "ash/wm/dock/docked_window_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_model.h" 12 #include "ash/shelf/shelf_model.h"
12 #include "ash/shelf/shelf_types.h" 13 #include "ash/shelf/shelf_types.h"
13 #include "ash/shelf/shelf_widget.h" 14 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 16 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h" 17 #include "ash/test/ash_test_base.h"
17 #include "ash/test/display_manager_test_api.h" 18 #include "ash/test/display_manager_test_api.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 71 }
71 72
72 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 73 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
73 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 74 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
74 nullptr, window_type_, 0, bounds); 75 nullptr, window_type_, 0, bounds);
75 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { 76 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) {
76 test::TestShelfDelegate* shelf_delegate = 77 test::TestShelfDelegate* shelf_delegate =
77 test::TestShelfDelegate::instance(); 78 test::TestShelfDelegate::instance();
78 shelf_delegate->AddShelfItem(window); 79 shelf_delegate->AddShelfItem(window);
79 PanelLayoutManager* manager = 80 PanelLayoutManager* manager =
80 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> 81 PanelLayoutManager::Get(wm::WmWindowAura::Get(window));
81 layout_manager());
82 manager->Relayout(); 82 manager->Relayout();
83 } 83 }
84 return window; 84 return window;
85 } 85 }
86 86
87 aura::Window* CreateTestWindowWithDelegate( 87 aura::Window* CreateTestWindowWithDelegate(
88 const gfx::Rect& bounds, 88 const gfx::Rect& bounds,
89 aura::test::TestWindowDelegate* delegate) { 89 aura::test::TestWindowDelegate* delegate) {
90 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 90 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
91 delegate, window_type_, 0, bounds); 91 delegate, window_type_, 0, bounds);
92 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) { 92 if (window_type_ == ui::wm::WINDOW_TYPE_PANEL) {
93 test::TestShelfDelegate* shelf_delegate = 93 test::TestShelfDelegate* shelf_delegate =
94 test::TestShelfDelegate::instance(); 94 test::TestShelfDelegate::instance();
95 shelf_delegate->AddShelfItem(window); 95 shelf_delegate->AddShelfItem(window);
96 PanelLayoutManager* manager = 96 PanelLayoutManager* manager =
97 static_cast<PanelLayoutManager*>(GetPanelContainer(window)-> 97 PanelLayoutManager::Get(wm::WmWindowAura::Get(window));
98 layout_manager());
99 manager->Relayout(); 98 manager->Relayout();
100 } 99 }
101 return window; 100 return window;
102 } 101 }
103 102
104 aura::Window* GetPanelContainer(aura::Window* panel) {
105 return Shell::GetContainer(panel->GetRootWindow(),
106 kShellWindowId_PanelContainer);
107 }
108
109 static WindowResizer* CreateSomeWindowResizer( 103 static WindowResizer* CreateSomeWindowResizer(
110 aura::Window* window, 104 aura::Window* window,
111 const gfx::Point& point_in_parent, 105 const gfx::Point& point_in_parent,
112 int window_component) { 106 int window_component) {
113 return CreateWindowResizer(wm::WmWindowAura::Get(window), point_in_parent, 107 return CreateWindowResizer(wm::WmWindowAura::Get(window), point_in_parent,
114 window_component, 108 window_component,
115 aura::client::WINDOW_MOVE_SOURCE_MOUSE) 109 aura::client::WINDOW_MOVE_SOURCE_MOUSE)
116 .release(); 110 .release();
117 } 111 }
118 112
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); 855 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height());
862 } 856 }
863 857
864 // Tests run twice - on both panels and normal windows 858 // Tests run twice - on both panels and normal windows
865 INSTANTIATE_TEST_CASE_P(NormalOrPanel, 859 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
866 DockedWindowLayoutManagerTest, 860 DockedWindowLayoutManagerTest,
867 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 861 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
868 ui::wm::WINDOW_TYPE_PANEL)); 862 ui::wm::WINDOW_TYPE_PANEL));
869 863
870 } // namespace ash 864 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/common/wm_window_property.h ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698