| 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/panel_window_resizer.h" | 5 #include "ash/wm/panel_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_widget.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/cursor_manager_test_api.h" | 13 #include "ash/test/cursor_manager_test_api.h" |
| 13 #include "ash/test/test_launcher_delegate.h" | 14 #include "ash/test/test_launcher_delegate.h" |
| 14 #include "ash/wm/panel_layout_manager.h" | 15 #include "ash/wm/panel_layout_manager.h" |
| 15 #include "ash/wm/window_properties.h" | 16 #include "ash/wm/window_properties.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 18 #include "ui/aura/test/test_window_delegate.h" | 19 #include "ui/aura/test/test_window_delegate.h" |
| 19 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
| 20 #include "ui/base/ui_base_types.h" | 21 #include "ui/base/ui_base_types.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 namespace internal { | 25 namespace internal { |
| 25 | 26 |
| 26 class PanelWindowResizerTest : public test::AshTestBase { | 27 class PanelWindowResizerTest : public test::AshTestBase { |
| 27 public: | 28 public: |
| 28 PanelWindowResizerTest() : window_(NULL) {} | 29 PanelWindowResizerTest() : window_(NULL) {} |
| 29 virtual ~PanelWindowResizerTest() {} | 30 virtual ~PanelWindowResizerTest() {} |
| 30 | 31 |
| 31 virtual void SetUp() OVERRIDE { | 32 virtual void SetUp() OVERRIDE { |
| 32 AshTestBase::SetUp(); | 33 AshTestBase::SetUp(); |
| 33 window_.reset(CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); | 34 window_.reset(CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); |
| 34 | 35 |
| 35 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>( | 36 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>( |
| 36 GetPanelContainer()->layout_manager()); | 37 GetPanelContainer()->layout_manager()); |
| 37 launcher_top_ = panel_layout_manager_->launcher()->widget()-> | 38 launcher_top_ = panel_layout_manager_->launcher()->shelf_widget()-> |
| 38 GetWindowBoundsInScreen().y(); | 39 GetWindowBoundsInScreen().y(); |
| 39 EXPECT_EQ(launcher_top_, window_->bounds().bottom()); | 40 EXPECT_EQ(launcher_top_, window_->bounds().bottom()); |
| 40 } | 41 } |
| 41 | 42 |
| 42 virtual void TearDown() OVERRIDE { | 43 virtual void TearDown() OVERRIDE { |
| 43 window_.reset(); | 44 window_.reset(); |
| 44 AshTestBase::TearDown(); | 45 AshTestBase::TearDown(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 protected: | 48 protected: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Release the mouse and the panel should be reattached. | 129 // Release the mouse and the panel should be reattached. |
| 129 resizer->CompleteDrag(0); | 130 resizer->CompleteDrag(0); |
| 130 } | 131 } |
| 131 // The panel should be reattached and have snapped to the launcher. | 132 // The panel should be reattached and have snapped to the launcher. |
| 132 EXPECT_TRUE(window_->GetProperty(kPanelAttachedKey)); | 133 EXPECT_TRUE(window_->GetProperty(kPanelAttachedKey)); |
| 133 EXPECT_EQ(launcher_top_, window_->bounds().bottom()); | 134 EXPECT_EQ(launcher_top_, window_->bounds().bottom()); |
| 134 } | 135 } |
| 135 | 136 |
| 136 } // namespace internal | 137 } // namespace internal |
| 137 } // namespace ash | 138 } // namespace ash |
| OLD | NEW |