Chromium Code Reviews| 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/screen_ash.h" | 5 #include "ash/screen_ash.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "ash/test/test_shell_delegate.h" | 8 #include "ash/test/test_shell_delegate.h" |
| 9 #include "ash/wm/window_positioner.h" | 9 #include "ash/wm/window_positioner.h" |
| 10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
| 11 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 14 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/test/render_view_test.h" | 17 #include "content/public/test/render_view_test.h" |
| 18 #include "content/public/test/test_renderer_host.h" | |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/aura/client/activation_client.h" | 20 #include "ui/aura/client/activation_client.h" |
| 20 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
| 21 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
| 22 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
| 23 #include "ui/aura/test/test_windows.h" | 24 #include "ui/aura/test/test_windows.h" |
| 24 | 25 |
| 25 typedef ash::test::AshTestBase WindowSizerAshTest; | |
| 26 | |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| 29 // A browser window proxy which is able to associate an aura native window with | 28 // A browser window proxy which is able to associate an aura native window with |
| 30 // it. | 29 // it. |
| 31 class TestBrowserWindowAura : public TestBrowserWindow { | 30 class TestBrowserWindowAura : public TestBrowserWindow { |
| 32 public: | 31 public: |
| 33 // |native_window| will still be owned by the caller after the constructor | 32 // |native_window| will still be owned by the caller after the constructor |
| 34 // was called. | 33 // was called. |
| 35 explicit TestBrowserWindowAura(aura::Window* native_window) | 34 explicit TestBrowserWindowAura(aura::Window* native_window) |
| 36 : native_window_(native_window) { | 35 : native_window_(native_window) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 if (!bounds.IsEmpty()) | 81 if (!bounds.IsEmpty()) |
| 83 window->SetBounds(bounds); | 82 window->SetBounds(bounds); |
| 84 scoped_ptr<TestBrowserWindowAura> browser_window( | 83 scoped_ptr<TestBrowserWindowAura> browser_window( |
| 85 new TestBrowserWindowAura(window)); | 84 new TestBrowserWindowAura(window)); |
| 86 browser_window->CreateBrowser(params); | 85 browser_window->CreateBrowser(params); |
| 87 return browser_window.Pass(); | 86 return browser_window.Pass(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 } // namespace | 89 } // namespace |
| 91 | 90 |
| 91 class WindowSizerAshTest : public ash::test::AshTestBase { | |
| 92 private: | |
| 93 // The existence of this object enables tests via | |
| 94 // RenderViewHostTester. | |
| 95 content::RenderViewHostTestEnabler rvh_test_enabler_; | |
| 96 }; | |
|
sky
2013/10/11 22:34:27
DISALLOW...
samarth
2013/10/14 16:58:57
Done.
samarth
2013/10/14 17:22:33
Actually I can't do that since the test cases will
| |
| 97 | |
| 92 // Test that the window is sized appropriately for the first run experience | 98 // Test that the window is sized appropriately for the first run experience |
| 93 // where the default window bounds calculation is invoked. | 99 // where the default window bounds calculation is invoked. |
| 94 TEST_F(WindowSizerAshTest, DefaultSizeCase) { | 100 TEST_F(WindowSizerAshTest, DefaultSizeCase) { |
| 95 { // 4:3 monitor case, 1024x768, no taskbar | 101 { // 4:3 monitor case, 1024x768, no taskbar |
| 96 gfx::Rect window_bounds; | 102 gfx::Rect window_bounds; |
| 97 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), | 103 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), |
| 98 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); | 104 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); |
| 99 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize, | 105 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize, |
| 100 ash::WindowPositioner::kDesktopBorderSize, | 106 ash::WindowPositioner::kDesktopBorderSize, |
| 101 1024 - ash::WindowPositioner::kDesktopBorderSize * 2, | 107 1024 - ash::WindowPositioner::kDesktopBorderSize * 2, |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 browser_window->browser(), | 840 browser_window->browser(), |
| 835 p1600x1200), ui::SHOW_STATE_MAXIMIZED); | 841 p1600x1200), ui::SHOW_STATE_MAXIMIZED); |
| 836 | 842 |
| 837 // The popup should favor the initial show state over the command line. | 843 // The popup should favor the initial show state over the command line. |
| 838 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 844 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
| 839 ui::SHOW_STATE_NORMAL, | 845 ui::SHOW_STATE_NORMAL, |
| 840 BOTH, | 846 BOTH, |
| 841 browser_popup->browser(), | 847 browser_popup->browser(), |
| 842 p1600x1200), ui::SHOW_STATE_NORMAL); | 848 p1600x1200), ui::SHOW_STATE_NORMAL); |
| 843 } | 849 } |
| OLD | NEW |