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