| 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/panels/panel_window_resizer.h" | 5 #include "ash/common/wm/panels/panel_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/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
| 9 #include "ash/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 PanelWindowResizerTransientTest() : transient_window_type_(GetParam()) {} | 217 PanelWindowResizerTransientTest() : transient_window_type_(GetParam()) {} |
| 218 virtual ~PanelWindowResizerTransientTest() {} | 218 virtual ~PanelWindowResizerTransientTest() {} |
| 219 | 219 |
| 220 protected: | 220 protected: |
| 221 ui::wm::WindowType transient_window_type_; | 221 ui::wm::WindowType transient_window_type_; |
| 222 | 222 |
| 223 private: | 223 private: |
| 224 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest); | 224 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 #if !defined(OS_WIN) |
| 227 // Verifies a window can be dragged from the panel and detached and then | 228 // Verifies a window can be dragged from the panel and detached and then |
| 228 // reattached. | 229 // reattached. |
| 229 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { | 230 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) { |
| 230 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 231 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 231 DetachReattachTest(window.get(), 0, -1); | 232 DetachReattachTest(window.get(), 0, -1); |
| 232 } | 233 } |
| 233 | 234 |
| 234 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { | 235 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) { |
| 235 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); | 236 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 236 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 237 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 263 EXPECT_FALSE(state->IsMinimized()); | 264 EXPECT_FALSE(state->IsMinimized()); |
| 264 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 265 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 265 DragEnd(); | 266 DragEnd(); |
| 266 | 267 |
| 267 // When the drag ends the window should be detached and placed where it was | 268 // When the drag ends the window should be detached and placed where it was |
| 268 // dragged to. | 269 // dragged to. |
| 269 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 270 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 270 EXPECT_FALSE(state->IsMinimized()); | 271 EXPECT_FALSE(state->IsMinimized()); |
| 271 EXPECT_EQ(expected_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 272 EXPECT_EQ(expected_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 272 } | 273 } |
| 274 #endif // !defined(OS_WIN) |
| 273 | 275 |
| 274 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { | 276 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) { |
| 275 if (!SupportsMultipleDisplays()) | 277 if (!SupportsMultipleDisplays()) |
| 276 return; | 278 return; |
| 277 | 279 |
| 278 UpdateDisplay("600x400,600x400"); | 280 UpdateDisplay("600x400,600x400"); |
| 279 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 281 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 280 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(600, 0))); | 282 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(600, 0))); |
| 281 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 283 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 282 DetachReattachTest(window.get(), 0, -1); | 284 DetachReattachTest(window.get(), 0, -1); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 INSTANTIATE_TEST_CASE_P(LtrRtl, | 538 INSTANTIATE_TEST_CASE_P(LtrRtl, |
| 537 PanelWindowResizerTextDirectionTest, | 539 PanelWindowResizerTextDirectionTest, |
| 538 testing::Bool()); | 540 testing::Bool()); |
| 539 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 541 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 540 PanelWindowResizerTransientTest, | 542 PanelWindowResizerTransientTest, |
| 541 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 543 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 542 ui::wm::WINDOW_TYPE_PANEL, | 544 ui::wm::WINDOW_TYPE_PANEL, |
| 543 ui::wm::WINDOW_TYPE_POPUP)); | 545 ui::wm::WINDOW_TYPE_POPUP)); |
| 544 | 546 |
| 545 } // namespace ash | 547 } // namespace ash |
| OLD | NEW |