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

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

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/drag_window_controller.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_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/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 // Tests that docking and undocking a |window| with a transient child properly 1438 // Tests that docking and undocking a |window| with a transient child properly
1439 // maintains the parent of that transient child to be the same as the |window|. 1439 // maintains the parent of that transient child to be the same as the |window|.
1440 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) { 1440 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) {
1441 if (!SupportsHostWindowResize()) 1441 if (!SupportsHostWindowResize())
1442 return; 1442 return;
1443 1443
1444 // Create a window with a transient child. 1444 // Create a window with a transient child.
1445 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 1445 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
1446 scoped_ptr<aura::Window> child(CreateTestWindowInShellWithDelegateAndType( 1446 scoped_ptr<aura::Window> child(CreateTestWindowInShellWithDelegateAndType(
1447 NULL, ui::wm::WINDOW_TYPE_NORMAL, 0, gfx::Rect(20, 20, 150, 20))); 1447 NULL, ui::wm::WINDOW_TYPE_NORMAL, 0, gfx::Rect(20, 20, 150, 20)));
1448 views::corewm::AddTransientChild(window.get(), child.get()); 1448 ::wm::AddTransientChild(window.get(), child.get());
1449 if (window->parent() != child->parent()) 1449 if (window->parent() != child->parent())
1450 window->parent()->AddChild(child.get()); 1450 window->parent()->AddChild(child.get());
1451 EXPECT_EQ(window.get(), views::corewm::GetTransientParent(child.get())); 1451 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
1452 1452
1453 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, window.get(), 20); 1453 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, window.get(), 20);
1454 1454
1455 // A window should be docked at the right edge. 1455 // A window should be docked at the right edge.
1456 EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id()); 1456 EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
1457 EXPECT_EQ(internal::kShellWindowId_DockedContainer, child->parent()->id()); 1457 EXPECT_EQ(internal::kShellWindowId_DockedContainer, child->parent()->id());
1458 1458
1459 // Drag the child - it should move freely and stay where it is dragged. 1459 // Drag the child - it should move freely and stay where it is dragged.
1460 ASSERT_NO_FATAL_FAILURE(DragStart(child.get())); 1460 ASSERT_NO_FATAL_FAILURE(DragStart(child.get()));
1461 DragMove(500, 20); 1461 DragMove(500, 20);
(...skipping 26 matching lines...) Expand all
1488 1488
1489 // Start dragging the window. 1489 // Start dragging the window.
1490 ASSERT_NO_FATAL_FAILURE(DragStart(window.get())); 1490 ASSERT_NO_FATAL_FAILURE(DragStart(window.get()));
1491 gfx::Vector2d move_vector(40, test_panels() ? -60 : 60); 1491 gfx::Vector2d move_vector(40, test_panels() ? -60 : 60);
1492 DragMove(move_vector.x(), move_vector.y()); 1492 DragMove(move_vector.x(), move_vector.y());
1493 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); 1493 EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
1494 1494
1495 // While still dragging create a modal window and make it a transient child of 1495 // While still dragging create a modal window and make it a transient child of
1496 // the |window|. 1496 // the |window|.
1497 scoped_ptr<aura::Window> child(CreateModalWindow(gfx::Rect(20, 20, 150, 20))); 1497 scoped_ptr<aura::Window> child(CreateModalWindow(gfx::Rect(20, 20, 150, 20)));
1498 views::corewm::AddTransientChild(window.get(), child.get()); 1498 ::wm::AddTransientChild(window.get(), child.get());
1499 EXPECT_EQ(window.get(), views::corewm::GetTransientParent(child.get())); 1499 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
1500 EXPECT_EQ(internal::kShellWindowId_SystemModalContainer, 1500 EXPECT_EQ(internal::kShellWindowId_SystemModalContainer,
1501 child->parent()->id()); 1501 child->parent()->id());
1502 1502
1503 // End the drag, the |window| should have moved (if it is a panel it will 1503 // End the drag, the |window| should have moved (if it is a panel it will
1504 // no longer be attached to the shelf since we dragged it above). 1504 // no longer be attached to the shelf since we dragged it above).
1505 DragEnd(); 1505 DragEnd();
1506 bounds.Offset(move_vector); 1506 bounds.Offset(move_vector);
1507 EXPECT_EQ(bounds.ToString(), window->GetBoundsInScreen().ToString()); 1507 EXPECT_EQ(bounds.ToString(), window->GetBoundsInScreen().ToString());
1508 1508
1509 // The original |window| should be in the default container (not docked or 1509 // The original |window| should be in the default container (not docked or
1510 // attached). 1510 // attached).
1511 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id()); 1511 EXPECT_EQ(internal::kShellWindowId_DefaultContainer, window->parent()->id());
1512 // The transient |child| should still be in system modal container. 1512 // The transient |child| should still be in system modal container.
1513 EXPECT_EQ(internal::kShellWindowId_SystemModalContainer, 1513 EXPECT_EQ(internal::kShellWindowId_SystemModalContainer,
1514 child->parent()->id()); 1514 child->parent()->id());
1515 // The |child| should not have moved. 1515 // The |child| should not have moved.
1516 EXPECT_EQ(gfx::Point(20, 20).ToString(), 1516 EXPECT_EQ(gfx::Point(20, 20).ToString(),
1517 child->GetBoundsInScreen().origin().ToString()); 1517 child->GetBoundsInScreen().origin().ToString());
1518 // The |child| should still be a transient child of |window|. 1518 // The |child| should still be a transient child of |window|.
1519 EXPECT_EQ(window.get(), views::corewm::GetTransientParent(child.get())); 1519 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
1520 } 1520 }
1521 1521
1522 // Tests that side snapping a window undocks it, closes the dock and then snaps. 1522 // Tests that side snapping a window undocks it, closes the dock and then snaps.
1523 TEST_P(DockedWindowResizerTest, SideSnapDocked) { 1523 TEST_P(DockedWindowResizerTest, SideSnapDocked) {
1524 if (!SupportsHostWindowResize() || test_panels()) 1524 if (!SupportsHostWindowResize() || test_panels())
1525 return; 1525 return;
1526 1526
1527 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 1527 scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
1528 wm::WindowState* window_state = wm::GetWindowState(w1.get()); 1528 wm::WindowState* window_state = wm::GetWindowState(w1.get());
1529 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); 1529 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 EXPECT_TRUE(window_state->IsMaximized()); 1617 EXPECT_TRUE(window_state->IsMaximized());
1618 } 1618 }
1619 1619
1620 // Tests run twice - on both panels and normal windows 1620 // Tests run twice - on both panels and normal windows
1621 INSTANTIATE_TEST_CASE_P(NormalOrPanel, 1621 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
1622 DockedWindowResizerTest, 1622 DockedWindowResizerTest,
1623 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 1623 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
1624 ui::wm::WINDOW_TYPE_PANEL)); 1624 ui::wm::WINDOW_TYPE_PANEL));
1625 } // namespace internal 1625 } // namespace internal
1626 } // namespace ash 1626 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/drag_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698