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/launcher/launcher.h" | |
9 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
10 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shelf/shelf.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shelf/shelf_model.h" | 12 #include "ash/shelf/shelf_model.h" |
13 #include "ash/shelf/shelf_types.h" | 13 #include "ash/shelf/shelf_types.h" |
14 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
17 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
18 #include "ash/test/cursor_manager_test_api.h" | 18 #include "ash/test/cursor_manager_test_api.h" |
19 #include "ash/test/shell_test_api.h" | 19 #include "ash/test/shell_test_api.h" |
20 #include "ash/test/test_shelf_delegate.h" | 20 #include "ash/test/test_shelf_delegate.h" |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 // Detach and drag down to shelf. | 1264 // Detach and drag down to shelf. |
1265 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); | 1265 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); |
1266 DragMove(-40, 0); | 1266 DragMove(-40, 0); |
1267 // Alignment is set to "NONE" when drag starts. | 1267 // Alignment is set to "NONE" when drag starts. |
1268 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); | 1268 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); |
1269 // Release the mouse and the window should be no longer attached to the edge. | 1269 // Release the mouse and the window should be no longer attached to the edge. |
1270 DragEnd(); | 1270 DragEnd(); |
1271 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); | 1271 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); |
1272 | 1272 |
1273 // Drag down almost to shelf. A panel will snap, a regular window won't. | 1273 // Drag down almost to shelf. A panel will snap, a regular window won't. |
1274 ShelfWidget* shelf = Launcher::ForPrimaryDisplay()->shelf_widget(); | 1274 ShelfWidget* shelf = Shelf::ForPrimaryDisplay()->shelf_widget(); |
1275 const int shelf_y = shelf->GetWindowBoundsInScreen().y(); | 1275 const int shelf_y = shelf->GetWindowBoundsInScreen().y(); |
1276 const int kDistanceFromShelf = 10; | 1276 const int kDistanceFromShelf = 10; |
1277 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); | 1277 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); |
1278 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); | 1278 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); |
1279 DragEnd(); | 1279 DragEnd(); |
1280 if (test_panels()) { | 1280 if (test_panels()) { |
1281 // The panel should be touching the shelf and attached. | 1281 // The panel should be touching the shelf and attached. |
1282 EXPECT_EQ(shelf_y, w1->bounds().bottom()); | 1282 EXPECT_EQ(shelf_y, w1->bounds().bottom()); |
1283 EXPECT_TRUE(wm::GetWindowState(w1.get())->panel_attached()); | 1283 EXPECT_TRUE(wm::GetWindowState(w1.get())->panel_attached()); |
1284 } else { | 1284 } else { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 EXPECT_TRUE(window_state->IsSnapped()); | 1427 EXPECT_TRUE(window_state->IsSnapped()); |
1428 } | 1428 } |
1429 | 1429 |
1430 // Tests run twice - on both panels and normal windows | 1430 // Tests run twice - on both panels and normal windows |
1431 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1431 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
1432 DockedWindowResizerTest, | 1432 DockedWindowResizerTest, |
1433 testing::Values(aura::client::WINDOW_TYPE_NORMAL, | 1433 testing::Values(aura::client::WINDOW_TYPE_NORMAL, |
1434 aura::client::WINDOW_TYPE_PANEL)); | 1434 aura::client::WINDOW_TYPE_PANEL)); |
1435 } // namespace internal | 1435 } // namespace internal |
1436 } // namespace ash | 1436 } // namespace ash |
OLD | NEW |