| 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/common/wm/dock/docked_window_resizer.h" | 5 #include "ash/common/wm/dock/docked_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/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/shelf/shelf_types.h" | 9 #include "ash/common/shelf/shelf_types.h" |
| 10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 // Detach and drag down to shelf. | 1364 // Detach and drag down to shelf. |
| 1365 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); | 1365 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); |
| 1366 DragMove(-40, 0); | 1366 DragMove(-40, 0); |
| 1367 // Alignment is set to "NONE" when drag starts. | 1367 // Alignment is set to "NONE" when drag starts. |
| 1368 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); | 1368 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); |
| 1369 // Release the mouse and the window should be no longer attached to the edge. | 1369 // Release the mouse and the window should be no longer attached to the edge. |
| 1370 DragEnd(); | 1370 DragEnd(); |
| 1371 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); | 1371 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); |
| 1372 | 1372 |
| 1373 // Drag down almost to shelf. A panel will snap, a regular window won't. | 1373 // Drag down almost to shelf. A panel will snap, a regular window won't. |
| 1374 ShelfWidget* shelf = GetPrimaryShelf()->GetShelfWidgetForTesting(); | 1374 const int shelf_y = |
| 1375 const int shelf_y = shelf->GetWindowBoundsInScreen().y(); | 1375 GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen().y(); |
| 1376 const int kDistanceFromShelf = 10; | 1376 const int kDistanceFromShelf = 10; |
| 1377 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); | 1377 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); |
| 1378 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); | 1378 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); |
| 1379 DragEnd(); | 1379 DragEnd(); |
| 1380 if (test_panels()) { | 1380 if (test_panels()) { |
| 1381 // The panel should be touching the shelf and attached. | 1381 // The panel should be touching the shelf and attached. |
| 1382 EXPECT_EQ(shelf_y, w1->bounds().bottom()); | 1382 EXPECT_EQ(shelf_y, w1->bounds().bottom()); |
| 1383 EXPECT_TRUE(wm::GetWindowState(w1.get())->panel_attached()); | 1383 EXPECT_TRUE(wm::GetWindowState(w1.get())->panel_attached()); |
| 1384 } else { | 1384 } else { |
| 1385 // The window should not be touching the shelf. | 1385 // The window should not be touching the shelf. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 EXPECT_TRUE(window_state->IsMaximized()); | 1570 EXPECT_TRUE(window_state->IsMaximized()); |
| 1571 } | 1571 } |
| 1572 | 1572 |
| 1573 // Tests run twice - on both panels and normal windows | 1573 // Tests run twice - on both panels and normal windows |
| 1574 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1574 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1575 DockedWindowResizerTest, | 1575 DockedWindowResizerTest, |
| 1576 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1576 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1577 ui::wm::WINDOW_TYPE_PANEL)); | 1577 ui::wm::WINDOW_TYPE_PANEL)); |
| 1578 | 1578 |
| 1579 } // namespace ash | 1579 } // namespace ash |
| OLD | NEW |