| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/test_shell_delegate.h" | 9 #include "ash/test/test_shell_delegate.h" |
| 10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
| 15 #include "chrome/test/base/test_browser_window.h" | 15 #include "chrome/test/base/test_browser_window.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/browser/browser_thread.h" | |
| 18 #include "content/public/test/render_view_test.h" | 17 #include "content/public/test/render_view_test.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 21 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
| 22 #include "ui/aura/test/test_windows.h" | 21 #include "ui/aura/test/test_windows.h" |
| 23 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 24 | 23 |
| 25 namespace ash { | 24 namespace ash { |
| 26 namespace test { | 25 namespace test { |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 // A browser window proxy which is able to associate an aura native window with | 29 // A browser window proxy which is able to associate an aura native window with |
| 31 // it. | 30 // it. |
| 32 class TestBrowserWindowAura : public TestBrowserWindow { | 31 class TestBrowserWindowAura : public TestBrowserWindow { |
| 33 public: | 32 public: |
| 34 explicit TestBrowserWindowAura(aura::Window *native_window); | 33 explicit TestBrowserWindowAura(aura::Window* native_window); |
| 35 virtual ~TestBrowserWindowAura(); | 34 virtual ~TestBrowserWindowAura(); |
| 36 | 35 |
| 37 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE { | 36 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE { |
| 38 return native_window_; | 37 return native_window_; |
| 39 } | 38 } |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 gfx::NativeWindow native_window_; | 41 gfx::NativeWindow native_window_; |
| 43 | 42 |
| 44 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowAura); | 43 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowAura); |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 TestBrowserWindowAura::TestBrowserWindowAura(aura::Window *native_window) | 46 TestBrowserWindowAura::TestBrowserWindowAura(aura::Window *native_window) |
| 48 : native_window_(native_window) { | 47 : native_window_(native_window) { |
| 49 } | 48 } |
| 50 | 49 |
| 51 TestBrowserWindowAura::~TestBrowserWindowAura() {} | 50 TestBrowserWindowAura::~TestBrowserWindowAura() {} |
| 52 | 51 |
| 53 } // namespace | 52 } // namespace |
| 54 | 53 |
| 55 // A test class for preparing window positioner tests - it creates a testing | 54 // A test class for preparing window positioner tests - it creates a testing |
| 56 // base by adding a window and a popup which can be independently | 55 // base by adding a window and a popup which can be independently |
| 57 // positioned to see where the positioner will place the window. | 56 // positioned to see where the positioner will place the window. |
| 58 class WindowPositionerTest : public AshTestBase { | 57 class WindowPositionerTest : public AshTestBase { |
| 59 public: | 58 public: |
| 60 WindowPositionerTest(); | 59 WindowPositionerTest(); |
| 61 | 60 |
| 62 virtual void SetUp() OVERRIDE; | 61 virtual void SetUp() OVERRIDE; |
| 63 virtual void TearDown() OVERRIDE; | 62 virtual void TearDown() OVERRIDE; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 273 |
| 275 // Check that the popup is placed full screen. | 274 // Check that the popup is placed full screen. |
| 276 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); | 275 gfx::Rect full = window_positioner()->GetPopupPosition(pop_position); |
| 277 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), | 276 EXPECT_EQ(gfx::Rect(work_area.x(), work_area.y(), |
| 278 pop_position.width(), pop_position.height()), | 277 pop_position.width(), pop_position.height()), |
| 279 full); | 278 full); |
| 280 } | 279 } |
| 281 | 280 |
| 282 } // namespace test | 281 } // namespace test |
| 283 } // namespace ash | 282 } // namespace ash |
| OLD | NEW |