Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up test. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" 13 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "content/public/test/render_view_test.h" 16 #include "content/public/test/render_view_test.h"
17 #include "content/public/test/test_renderer_host.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/aura/client/activation_client.h" 19 #include "ui/aura/client/activation_client.h"
19 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
21 #include "ui/aura/root_window.h" 22 #include "ui/aura/root_window.h"
22 #include "ui/aura/test/test_windows.h" 23 #include "ui/aura/test/test_windows.h"
23 24
24 typedef ash::test::AshTestBase WindowSizerAshTest;
25
26 namespace { 25 namespace {
27 26
28 // A browser window proxy which is able to associate an aura native window with 27 // A browser window proxy which is able to associate an aura native window with
29 // it. 28 // it.
30 class TestBrowserWindowAura : public TestBrowserWindow { 29 class TestBrowserWindowAura : public TestBrowserWindow {
31 public: 30 public:
32 // |native_window| will still be owned by the caller after the constructor 31 // |native_window| will still be owned by the caller after the constructor
33 // was called. 32 // was called.
34 explicit TestBrowserWindowAura(aura::Window* native_window) 33 explicit TestBrowserWindowAura(aura::Window* native_window)
35 : native_window_(native_window) { 34 : native_window_(native_window) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!bounds.IsEmpty()) 86 if (!bounds.IsEmpty())
88 window->SetBounds(bounds); 87 window->SetBounds(bounds);
89 scoped_ptr<TestBrowserWindowAura> browser_window( 88 scoped_ptr<TestBrowserWindowAura> browser_window(
90 new TestBrowserWindowAura(window)); 89 new TestBrowserWindowAura(window));
91 browser_window->CreateBrowser(params); 90 browser_window->CreateBrowser(params);
92 return browser_window.Pass(); 91 return browser_window.Pass();
93 } 92 }
94 93
95 } // namespace 94 } // namespace
96 95
96 class WindowSizerAshTest : public ash::test::AshTestBase {
97 private:
98 // The existence of this object enables tests via
99 // RenderViewHostTester.
100 content::RenderViewHostTestEnabler rvh_test_enabler_;
101 };
102
97 // Test that the window is sized appropriately for the first run experience 103 // Test that the window is sized appropriately for the first run experience
98 // where the default window bounds calculation is invoked. 104 // where the default window bounds calculation is invoked.
99 TEST_F(WindowSizerAshTest, DefaultSizeCase) { 105 TEST_F(WindowSizerAshTest, DefaultSizeCase) {
100 int grid = WindowSizer::kDesktopBorderSize; 106 int grid = WindowSizer::kDesktopBorderSize;
101 { // 4:3 monitor case, 1024x768, no taskbar 107 { // 4:3 monitor case, 1024x768, no taskbar
102 gfx::Rect window_bounds; 108 gfx::Rect window_bounds;
103 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), 109 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(),
104 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); 110 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds);
105 EXPECT_EQ(gfx::Rect(WindowSizer::kDesktopBorderSize, 111 EXPECT_EQ(gfx::Rect(WindowSizer::kDesktopBorderSize,
106 WindowSizer::kDesktopBorderSize, 112 WindowSizer::kDesktopBorderSize,
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 browser_window->browser(), 838 browser_window->browser(),
833 p1600x1200), ui::SHOW_STATE_MAXIMIZED); 839 p1600x1200), ui::SHOW_STATE_MAXIMIZED);
834 840
835 // The popup should favor the initial show state over the command line. 841 // The popup should favor the initial show state over the command line.
836 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, 842 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL,
837 ui::SHOW_STATE_NORMAL, 843 ui::SHOW_STATE_NORMAL,
838 BOTH, 844 BOTH,
839 browser_popup->browser(), 845 browser_popup->browser(),
840 p1600x1200), ui::SHOW_STATE_NORMAL); 846 p1600x1200), ui::SHOW_STATE_NORMAL);
841 } 847 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698