OLD | NEW |
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_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); | 373 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); |
374 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); | 374 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); |
375 | 375 |
376 // The window should be docked at the right edge. | 376 // The window should be docked at the right edge. |
377 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 377 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
378 window->GetBoundsInScreen().right()); | 378 window->GetBoundsInScreen().right()); |
379 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 379 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
380 | 380 |
381 // set launcher shelf to be aligned on the right | 381 // set launcher shelf to be aligned on the right |
382 ash::Shell* shell = ash::Shell::GetInstance(); | 382 ash::Shell* shell = ash::Shell::GetInstance(); |
383 shell->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT, | 383 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_RIGHT, |
384 shell->GetPrimaryRootWindow()); | 384 shell->GetPrimaryRootWindow()); |
385 // The window should have moved and get attached to the left dock. | 385 // The window should have moved and get attached to the left dock. |
386 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().x(), | 386 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().x(), |
387 window->GetBoundsInScreen().x()); | 387 window->GetBoundsInScreen().x()); |
388 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 388 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
389 | 389 |
390 // set launcher shelf to be aligned on the left | 390 // set launcher shelf to be aligned on the left |
391 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, | 391 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_LEFT, |
392 shell->GetPrimaryRootWindow()); | 392 shell->GetPrimaryRootWindow()); |
393 // The window should have moved and get attached to the right edge. | 393 // The window should have moved and get attached to the right edge. |
394 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 394 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
395 window->GetBoundsInScreen().right()); | 395 window->GetBoundsInScreen().right()); |
396 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 396 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
397 | 397 |
398 // set launcher shelf to be aligned at the bottom | 398 // set launcher shelf to be aligned at the bottom |
399 shell->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM, | 399 shell->SetShelfAlignment(wm::SHELF_ALIGNMENT_BOTTOM, |
400 shell->GetPrimaryRootWindow()); | 400 shell->GetPrimaryRootWindow()); |
401 // The window should stay in the right edge. | 401 // The window should stay in the right edge. |
402 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 402 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
403 window->GetBoundsInScreen().right()); | 403 window->GetBoundsInScreen().right()); |
404 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 404 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
405 } | 405 } |
406 | 406 |
407 // Dock on the right side, try to undock, then drag more to really undock | 407 // Dock on the right side, try to undock, then drag more to really undock |
408 TEST_P(DockedWindowResizerTest, AttachTryDetach) { | 408 TEST_P(DockedWindowResizerTest, AttachTryDetach) { |
409 if (!SupportsHostWindowResize()) | 409 if (!SupportsHostWindowResize()) |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 EXPECT_TRUE(window_state->IsMaximized()); | 1615 EXPECT_TRUE(window_state->IsMaximized()); |
1616 } | 1616 } |
1617 | 1617 |
1618 // Tests run twice - on both panels and normal windows | 1618 // Tests run twice - on both panels and normal windows |
1619 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1619 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
1620 DockedWindowResizerTest, | 1620 DockedWindowResizerTest, |
1621 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1621 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
1622 ui::wm::WINDOW_TYPE_PANEL)); | 1622 ui::wm::WINDOW_TYPE_PANEL)); |
1623 | 1623 |
1624 } // namespace ash | 1624 } // namespace ash |
OLD | NEW |