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

Side by Side Diff: ash/wm/panels/panel_window_resizer_unittest.cc

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 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/panels/panel_window_resizer.cc ('k') | ash/wm/window_animations.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/panels/panel_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/public/cpp/config.h" 7 #include "ash/public/cpp/config.h"
8 #include "ash/public/cpp/shelf_types.h" 8 #include "ash/public/cpp/shelf_types.h"
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/public/cpp/window_properties.h" 10 #include "ash/public/cpp/window_properties.h"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/shelf/shelf.h"
12 #include "ash/shelf/shelf_layout_manager.h" 13 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shelf/shelf_model.h" 14 #include "ash/shelf/shelf_model.h"
14 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
15 #include "ash/shelf/wm_shelf.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/shell_port.h" 17 #include "ash/shell_port.h"
18 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
19 #include "ash/test/cursor_manager_test_api.h" 19 #include "ash/test/cursor_manager_test_api.h"
20 #include "ash/test/shelf_view_test_api.h" 20 #include "ash/test/shelf_view_test_api.h"
21 #include "ash/wm/drag_window_resizer.h" 21 #include "ash/wm/drag_window_resizer.h"
22 #include "ash/wm/window_properties.h" 22 #include "ash/wm/window_properties.h"
23 #include "ash/wm/window_state.h" 23 #include "ash/wm/window_state.h"
24 #include "ash/wm/wm_event.h" 24 #include "ash/wm/wm_event.h"
25 #include "ash/wm_window.h" 25 #include "ash/wm_window.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); 122 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
123 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); 123 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y());
124 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); 124 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
125 } 125 }
126 126
127 // Ensure |first| and its shelf item come before those of |second|: 127 // Ensure |first| and its shelf item come before those of |second|:
128 // - |first| should be left of |second| in an LTR bottom-aligned shelf. 128 // - |first| should be left of |second| in an LTR bottom-aligned shelf.
129 // - |first| should be right of |second| in an RTL bottom-aligned shelf. 129 // - |first| should be right of |second| in an RTL bottom-aligned shelf.
130 // - |first| should be above |second| in a left- or right-aligned shelf. 130 // - |first| should be above |second| in a left- or right-aligned shelf.
131 void CheckWindowAndItemPlacement(aura::Window* first, aura::Window* second) { 131 void CheckWindowAndItemPlacement(aura::Window* first, aura::Window* second) {
132 WmShelf* shelf = GetPrimaryShelf(); 132 Shelf* shelf = GetPrimaryShelf();
133 const gfx::Rect first_item_bounds = 133 const gfx::Rect first_item_bounds =
134 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(first)); 134 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(first));
135 const gfx::Rect second_item_bounds = 135 const gfx::Rect second_item_bounds =
136 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(second)); 136 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(second));
137 if (!base::i18n::IsRTL()) { 137 if (!base::i18n::IsRTL()) {
138 EXPECT_TRUE((first->bounds().x() < second->bounds().x()) || 138 EXPECT_TRUE((first->bounds().x() < second->bounds().x()) ||
139 (first->bounds().y() < second->bounds().y())); 139 (first->bounds().y() < second->bounds().y()));
140 EXPECT_TRUE((first_item_bounds.x() < second_item_bounds.x()) || 140 EXPECT_TRUE((first_item_bounds.x() < second_item_bounds.x()) ||
141 (first_item_bounds.y() < second_item_bounds.y())); 141 (first_item_bounds.y() < second_item_bounds.y()));
142 } else { 142 } else {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 258 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
259 wm::WindowState* state = wm::GetWindowState(window.get()); 259 wm::WindowState* state = wm::GetWindowState(window.get());
260 gfx::Rect expected_bounds = window->GetBoundsInScreen(); 260 gfx::Rect expected_bounds = window->GetBoundsInScreen();
261 expected_bounds.set_y(expected_bounds.y() - 100); 261 expected_bounds.set_y(expected_bounds.y() - 100);
262 DragStart(window.get()); 262 DragStart(window.get());
263 DragMove(0, -100); 263 DragMove(0, -100);
264 EXPECT_FALSE(state->IsMinimized()); 264 EXPECT_FALSE(state->IsMinimized());
265 265
266 // Hide the shelf. This minimizes all attached windows but should ignore 266 // Hide the shelf. This minimizes all attached windows but should ignore
267 // the dragged window. 267 // the dragged window.
268 WmShelf* shelf = GetPrimaryShelf(); 268 Shelf* shelf = GetPrimaryShelf();
269 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 269 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
270 shelf->shelf_layout_manager()->UpdateVisibilityState(); 270 shelf->shelf_layout_manager()->UpdateVisibilityState();
271 RunAllPendingInMessageLoop(); 271 RunAllPendingInMessageLoop();
272 EXPECT_FALSE(state->IsMinimized()); 272 EXPECT_FALSE(state->IsMinimized());
273 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); 273 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
274 DragEnd(); 274 DragEnd();
275 275
276 // When the drag ends the window should be detached and placed where it was 276 // When the drag ends the window should be detached and placed where it was
277 // dragged to. 277 // dragged to.
278 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); 278 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 558
559 INSTANTIATE_TEST_CASE_P(LtrRtl, 559 INSTANTIATE_TEST_CASE_P(LtrRtl,
560 PanelWindowResizerTextDirectionTest, 560 PanelWindowResizerTextDirectionTest,
561 testing::Bool()); 561 testing::Bool());
562 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, 562 INSTANTIATE_TEST_CASE_P(NormalPanelPopup,
563 PanelWindowResizerTransientTest, 563 PanelWindowResizerTransientTest,
564 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 564 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
565 ui::wm::WINDOW_TYPE_POPUP)); 565 ui::wm::WINDOW_TYPE_POPUP));
566 566
567 } // namespace ash 567 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_window_resizer.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698