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

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

Issue 2272793005: ash: Move alignment and autohide behavior from Shelf to WmShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 3 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_layout_manager_unittest.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/common/wm/panels/panel_window_resizer.h" 5 #include "ash/common/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/shelf.h"
9 #include "ash/common/shelf/shelf_layout_manager.h" 8 #include "ash/common/shelf/shelf_layout_manager.h"
10 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
11 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
12 #include "ash/common/shelf/shelf_widget.h" 11 #include "ash/common/shelf/shelf_widget.h"
12 #include "ash/common/shelf/wm_shelf.h"
13 #include "ash/common/shell_window_ids.h" 13 #include "ash/common/shell_window_ids.h"
14 #include "ash/common/wm/window_state.h" 14 #include "ash/common/wm/window_state.h"
15 #include "ash/common/wm/wm_event.h" 15 #include "ash/common/wm/wm_event.h"
16 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
17 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
18 #include "ash/shelf/shelf_util.h" 18 #include "ash/shelf/shelf_util.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "ash/test/ash_test_base.h" 20 #include "ash/test/ash_test_base.h"
21 #include "ash/test/cursor_manager_test_api.h" 21 #include "ash/test/cursor_manager_test_api.h"
22 #include "ash/test/test_shelf_delegate.h" 22 #include "ash/test/test_shelf_delegate.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return; 231 return;
232 232
233 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 233 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
234 DetachReattachTest(window.get(), 0, -1); 234 DetachReattachTest(window.get(), 0, -1);
235 } 235 }
236 236
237 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { 237 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) {
238 if (!SupportsHostWindowResize()) 238 if (!SupportsHostWindowResize())
239 return; 239 return;
240 240
241 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT); 241 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
242 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 242 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
243 DetachReattachTest(window.get(), 1, 0); 243 DetachReattachTest(window.get(), 1, 0);
244 } 244 }
245 245
246 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) { 246 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) {
247 if (!SupportsHostWindowResize()) 247 if (!SupportsHostWindowResize())
248 return; 248 return;
249 249
250 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_RIGHT); 250 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
251 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 251 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
252 DetachReattachTest(window.get(), -1, 0); 252 DetachReattachTest(window.get(), -1, 0);
253 } 253 }
254 254
255 // Tests that a drag continues when the shelf is hidden. This occurs as part of 255 // Tests that a drag continues when the shelf is hidden. This occurs as part of
256 // the animation when switching profiles. http://crbug.com/393047. 256 // the animation when switching profiles. http://crbug.com/393047.
257 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { 257 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) {
258 if (!SupportsHostWindowResize()) 258 if (!SupportsHostWindowResize())
259 return; 259 return;
260 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 260 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
261 wm::WindowState* state = wm::GetWindowState(window.get()); 261 wm::WindowState* state = wm::GetWindowState(window.get());
262 gfx::Rect expected_bounds = window->GetBoundsInScreen(); 262 gfx::Rect expected_bounds = window->GetBoundsInScreen();
263 expected_bounds.set_y(expected_bounds.y() - 100); 263 expected_bounds.set_y(expected_bounds.y() - 100);
264 DragStart(window.get()); 264 DragStart(window.get());
265 DragMove(0, -100); 265 DragMove(0, -100);
266 EXPECT_FALSE(state->IsMinimized()); 266 EXPECT_FALSE(state->IsMinimized());
267 267
268 // Hide the shelf. This minimizes all attached windows but should ignore 268 // Hide the shelf. This minimizes all attached windows but should ignore
269 // the dragged window. 269 // the dragged window.
270 Shelf* shelf = RootWindowController::ForWindow(window.get())->GetShelf(); 270 WmShelf* shelf = GetPrimaryShelf();
271 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 271 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
272 shelf->shelf_layout_manager()->UpdateVisibilityState(); 272 shelf->shelf_layout_manager()->UpdateVisibilityState();
273 RunAllPendingInMessageLoop(); 273 RunAllPendingInMessageLoop();
274 EXPECT_FALSE(state->IsMinimized()); 274 EXPECT_FALSE(state->IsMinimized());
275 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); 275 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
276 DragEnd(); 276 DragEnd();
277 277
278 // When the drag ends the window should be detached and placed where it was 278 // When the drag ends the window should be detached and placed where it was
279 // dragged to. 279 // dragged to.
280 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); 280 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (!SupportsHostWindowResize()) 479 if (!SupportsHostWindowResize())
480 return; 480 return;
481 481
482 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0); 482 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0);
483 } 483 }
484 484
485 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { 485 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) {
486 if (!SupportsHostWindowResize()) 486 if (!SupportsHostWindowResize())
487 return; 487 return;
488 488
489 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT); 489 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
490 DragAlongShelfReorder(0, -1); 490 DragAlongShelfReorder(0, -1);
491 } 491 }
492 492
493 // Tests that panels can have transient children of different types. 493 // Tests that panels can have transient children of different types.
494 // The transient children should be reparented in sync with the panel. 494 // The transient children should be reparented in sync with the panel.
495 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) { 495 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) {
496 if (!SupportsHostWindowResize()) 496 if (!SupportsHostWindowResize())
497 return; 497 return;
498 498
499 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); 499 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 INSTANTIATE_TEST_CASE_P(LtrRtl, 556 INSTANTIATE_TEST_CASE_P(LtrRtl,
557 PanelWindowResizerTextDirectionTest, 557 PanelWindowResizerTextDirectionTest,
558 testing::Bool()); 558 testing::Bool());
559 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, 559 INSTANTIATE_TEST_CASE_P(NormalPanelPopup,
560 PanelWindowResizerTransientTest, 560 PanelWindowResizerTransientTest,
561 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 561 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
562 ui::wm::WINDOW_TYPE_PANEL, 562 ui::wm::WINDOW_TYPE_PANEL,
563 ui::wm::WINDOW_TYPE_POPUP)); 563 ui::wm::WINDOW_TYPE_POPUP));
564 564
565 } // namespace ash 565 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698