| 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> |
| 8 |
| 7 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/test_shell_delegate.h" | 11 #include "ash/test/test_shell_delegate.h" |
| 10 #include "ash/wm/window_resizer.h" | 12 #include "ash/wm/window_resizer.h" |
| 11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/host_desktop.h" | 17 #include "chrome/browser/ui/host_desktop.h" |
| 16 #include "chrome/test/base/test_browser_window_aura.h" | 18 #include "chrome/test/base/test_browser_window_aura.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Create some default dummy windows. | 65 // Create some default dummy windows. |
| 64 scoped_ptr<aura::Window> dummy_window(CreateTestWindowInShellWithId(0)); | 66 scoped_ptr<aura::Window> dummy_window(CreateTestWindowInShellWithId(0)); |
| 65 dummy_window->SetBounds(gfx::Rect(16, 32, 640, 320)); | 67 dummy_window->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 66 scoped_ptr<aura::Window> dummy_popup(CreateTestWindowInShellWithId(1)); | 68 scoped_ptr<aura::Window> dummy_popup(CreateTestWindowInShellWithId(1)); |
| 67 dummy_popup->SetBounds(gfx::Rect(16, 32, 128, 256)); | 69 dummy_popup->SetBounds(gfx::Rect(16, 32, 128, 256)); |
| 68 | 70 |
| 69 // Create a browser for the window. | 71 // Create a browser for the window. |
| 70 Browser::CreateParams window_params(&profile_, | 72 Browser::CreateParams window_params(&profile_, |
| 71 chrome::HOST_DESKTOP_TYPE_ASH); | 73 chrome::HOST_DESKTOP_TYPE_ASH); |
| 72 browser_ = chrome::CreateBrowserWithAuraTestWindowForParams( | 74 browser_ = chrome::CreateBrowserWithAuraTestWindowForParams( |
| 73 dummy_window.Pass(), &window_params); | 75 std::move(dummy_window), &window_params); |
| 74 | 76 |
| 75 // Creating a browser for the popup. | 77 // Creating a browser for the popup. |
| 76 Browser::CreateParams popup_params(Browser::TYPE_POPUP, &profile_, | 78 Browser::CreateParams popup_params(Browser::TYPE_POPUP, &profile_, |
| 77 chrome::HOST_DESKTOP_TYPE_ASH); | 79 chrome::HOST_DESKTOP_TYPE_ASH); |
| 78 browser_popup_ = chrome::CreateBrowserWithAuraTestWindowForParams( | 80 browser_popup_ = chrome::CreateBrowserWithAuraTestWindowForParams( |
| 79 dummy_popup.Pass(), &popup_params); | 81 std::move(dummy_popup), &popup_params); |
| 80 | 82 |
| 81 // We hide all windows upon start - each user is required to set it up | 83 // We hide all windows upon start - each user is required to set it up |
| 82 // as he needs it. | 84 // as he needs it. |
| 83 window()->Hide(); | 85 window()->Hide(); |
| 84 popup()->Hide(); | 86 popup()->Hide(); |
| 85 window_positioner_.reset(new WindowPositioner()); | 87 window_positioner_.reset(new WindowPositioner()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 void WindowPositionerTest::TearDown() { | 90 void WindowPositionerTest::TearDown() { |
| 89 // Since the AuraTestBase is needed to create our assets, we have to | 91 // Since the AuraTestBase is needed to create our assets, we have to |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 226 |
| 225 // Check that the popup is placed full screen. | 227 // Check that the popup is placed full screen. |
| 226 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); | 228 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); |
| 227 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), | 229 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), |
| 228 pop_position.width(), pop_position.height()), | 230 pop_position.width(), pop_position.height()), |
| 229 full); | 231 full); |
| 230 } | 232 } |
| 231 | 233 |
| 232 } // namespace test | 234 } // namespace test |
| 233 } // namespace ash | 235 } // namespace ash |
| OLD | NEW |