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/panels/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) { | 265 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) { |
266 if (!SupportsHostWindowResize()) | 266 if (!SupportsHostWindowResize()) |
267 return; | 267 return; |
268 | 268 |
269 ash::Shell* shell = ash::Shell::GetInstance(); | 269 ash::Shell* shell = ash::Shell::GetInstance(); |
270 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow()); | 270 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow()); |
271 scoped_ptr<aura::Window> window( | 271 scoped_ptr<aura::Window> window( |
272 CreatePanelWindow(gfx::Point(0, 0))); | 272 CreatePanelWindow(gfx::Point(0, 0))); |
273 DetachReattachTest(window.get(), 0, 1); | 273 DetachReattachTest(window.get(), 0, 1); |
274 } | 274 } |
275 | 275 |
Mr4D (OOO till 08-26)
2014/09/18 23:39:00
Could you please add a comment for this test? You
flackr
2014/09/19 14:17:06
Done.
| |
276 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) { | |
277 if (!SupportsHostWindowResize()) | |
278 return; | |
279 scoped_ptr<aura::Window> window( | |
280 CreatePanelWindow(gfx::Point(0, 0))); | |
281 wm::WindowState* state = wm::GetWindowState(window.get()); | |
282 gfx::Rect expected_bounds = window->GetBoundsInScreen(); | |
283 expected_bounds.set_y(expected_bounds.y() - 100); | |
284 DragStart(window.get()); | |
285 DragMove(0, -100); | |
286 EXPECT_FALSE(state->IsMinimized()); | |
287 | |
288 // Hide the shelf. This minimizes all attached windows but should ignore | |
289 // the dragged window. | |
290 ShelfLayoutManager* shelf = RootWindowController::ForWindow(window.get())-> | |
291 shelf()->shelf_layout_manager(); | |
292 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | |
293 shelf->UpdateVisibilityState(); | |
294 RunAllPendingInMessageLoop(); | |
295 EXPECT_FALSE(state->IsMinimized()); | |
296 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | |
297 DragEnd(); | |
298 | |
299 // When the drag ends the window should be detached and where it was dragged | |
300 // to. | |
Mr4D (OOO till 08-26)
2014/09/18 23:39:00
This sentence is odd.
When the drag ends, the win
flackr
2014/09/19 14:17:06
Done.
| |
301 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | |
302 EXPECT_FALSE(state->IsMinimized()); | |
303 EXPECT_EQ(expected_bounds.ToString(), window->GetBoundsInScreen().ToString()); | |
304 } | |
305 | |
276 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { | 306 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { |
277 if (!SupportsMultipleDisplays()) | 307 if (!SupportsMultipleDisplays()) |
278 return; | 308 return; |
279 | 309 |
280 UpdateDisplay("600x400,600x400"); | 310 UpdateDisplay("600x400,600x400"); |
281 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 311 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
282 scoped_ptr<aura::Window> window( | 312 scoped_ptr<aura::Window> window( |
283 CreatePanelWindow(gfx::Point(600, 0))); | 313 CreatePanelWindow(gfx::Point(600, 0))); |
284 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 314 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
285 DetachReattachTest(window.get(), 0, -1); | 315 DetachReattachTest(window.get(), 0, -1); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
554 | 584 |
555 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, | 585 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, |
556 testing::Bool()); | 586 testing::Bool()); |
557 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 587 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
558 PanelWindowResizerTransientTest, | 588 PanelWindowResizerTransientTest, |
559 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 589 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
560 ui::wm::WINDOW_TYPE_PANEL, | 590 ui::wm::WINDOW_TYPE_PANEL, |
561 ui::wm::WINDOW_TYPE_POPUP)); | 591 ui::wm::WINDOW_TYPE_POPUP)); |
562 | 592 |
563 } // namespace ash | 593 } // namespace ash |
OLD | NEW |