OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/test/test_shell_delegate.h" | 10 #include "ash/test/test_shell_delegate.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 protected: | 38 protected: |
39 aura::Window* window() { return browser_->window()->GetNativeWindow(); } | 39 aura::Window* window() { return browser_->window()->GetNativeWindow(); } |
40 aura::Window* popup() { return browser_popup_->window()->GetNativeWindow(); } | 40 aura::Window* popup() { return browser_popup_->window()->GetNativeWindow(); } |
41 | 41 |
42 WindowPositioner* window_positioner() { return window_positioner_.get(); } | 42 WindowPositioner* window_positioner() { return window_positioner_.get(); } |
43 | 43 |
44 // The positioner & desktop's used grid alignment size. | 44 // The positioner & desktop's used grid alignment size. |
45 const int grid_size_; | 45 const int grid_size_; |
46 | 46 |
47 private: | 47 private: |
48 scoped_ptr<WindowPositioner> window_positioner_; | 48 std::unique_ptr<WindowPositioner> window_positioner_; |
49 | 49 |
50 TestingProfile profile_; | 50 TestingProfile profile_; |
51 | 51 |
52 scoped_ptr<Browser> browser_; | 52 std::unique_ptr<Browser> browser_; |
53 scoped_ptr<Browser> browser_popup_; | 53 std::unique_ptr<Browser> browser_popup_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(WindowPositionerTest); | 55 DISALLOW_COPY_AND_ASSIGN(WindowPositionerTest); |
56 }; | 56 }; |
57 | 57 |
58 WindowPositionerTest::WindowPositionerTest() | 58 WindowPositionerTest::WindowPositionerTest() |
59 : grid_size_(WindowPositioner::kMinimumWindowOffset) {} | 59 : grid_size_(WindowPositioner::kMinimumWindowOffset) {} |
60 | 60 |
61 void WindowPositionerTest::SetUp() { | 61 void WindowPositionerTest::SetUp() { |
62 AshTestBase::SetUp(); | 62 AshTestBase::SetUp(); |
63 // Create some default dummy windows. | 63 // Create some default dummy windows. |
64 scoped_ptr<aura::Window> dummy_window(CreateTestWindowInShellWithId(0)); | 64 std::unique_ptr<aura::Window> dummy_window(CreateTestWindowInShellWithId(0)); |
65 dummy_window->SetBounds(gfx::Rect(16, 32, 640, 320)); | 65 dummy_window->SetBounds(gfx::Rect(16, 32, 640, 320)); |
66 scoped_ptr<aura::Window> dummy_popup(CreateTestWindowInShellWithId(1)); | 66 std::unique_ptr<aura::Window> dummy_popup(CreateTestWindowInShellWithId(1)); |
67 dummy_popup->SetBounds(gfx::Rect(16, 32, 128, 256)); | 67 dummy_popup->SetBounds(gfx::Rect(16, 32, 128, 256)); |
68 | 68 |
69 // Create a browser for the window. | 69 // Create a browser for the window. |
70 Browser::CreateParams window_params(&profile_); | 70 Browser::CreateParams window_params(&profile_); |
71 browser_ = chrome::CreateBrowserWithAuraTestWindowForParams( | 71 browser_ = chrome::CreateBrowserWithAuraTestWindowForParams( |
72 std::move(dummy_window), &window_params); | 72 std::move(dummy_window), &window_params); |
73 | 73 |
74 // Creating a browser for the popup. | 74 // Creating a browser for the popup. |
75 Browser::CreateParams popup_params(Browser::TYPE_POPUP, &profile_); | 75 Browser::CreateParams popup_params(Browser::TYPE_POPUP, &profile_); |
76 browser_popup_ = chrome::CreateBrowserWithAuraTestWindowForParams( | 76 browser_popup_ = chrome::CreateBrowserWithAuraTestWindowForParams( |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 // Check that the popup is placed full screen. | 223 // Check that the popup is placed full screen. |
224 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); | 224 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); |
225 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), | 225 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), |
226 pop_position.width(), pop_position.height()), | 226 pop_position.width(), pop_position.height()), |
227 full); | 227 full); |
228 } | 228 } |
229 | 229 |
230 } // namespace test | 230 } // namespace test |
231 } // namespace ash | 231 } // namespace ash |
OLD | NEW |