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

Side by Side Diff: ash/wm/base_layout_manager_unittest.cc

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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
« no previous file with comments | « ash/wm/base_layout_manager.cc ('k') | ash/wm/custom_frame_view_ash_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wm/base_layout_manager.h" 5 #include "ash/wm/base_layout_manager.h"
6 6
7 #include "ash/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DISALLOW_COPY_AND_ASSIGN(BaseLayoutManagerTest); 48 DISALLOW_COPY_AND_ASSIGN(BaseLayoutManagerTest);
49 }; 49 };
50 50
51 // Tests normal->maximize->normal. 51 // Tests normal->maximize->normal.
52 TEST_F(BaseLayoutManagerTest, Maximize) { 52 TEST_F(BaseLayoutManagerTest, Maximize) {
53 gfx::Rect bounds(100, 100, 200, 200); 53 gfx::Rect bounds(100, 100, 200, 200);
54 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); 54 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
55 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 55 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
56 // Maximized window fills the work area, not the whole display. 56 // Maximized window fills the work area, not the whole display.
57 EXPECT_EQ( 57 EXPECT_EQ(
58 ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString(), 58 ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
59 window->bounds().ToString()); 59 window->bounds().ToString());
60 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 60 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
61 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); 61 EXPECT_EQ(bounds.ToString(), window->bounds().ToString());
62 } 62 }
63 63
64 // Tests normal->minimize->normal. 64 // Tests normal->minimize->normal.
65 TEST_F(BaseLayoutManagerTest, Minimize) { 65 TEST_F(BaseLayoutManagerTest, Minimize) {
66 gfx::Rect bounds(100, 100, 200, 200); 66 gfx::Rect bounds(100, 100, 200, 200);
67 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); 67 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
68 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 68 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
69 // Note: Currently minimize doesn't do anything except set the state. 69 // Note: Currently minimize doesn't do anything except set the state.
70 // See crbug.com/104571. 70 // See crbug.com/104571.
71 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); 71 EXPECT_EQ(bounds.ToString(), window->bounds().ToString());
72 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 72 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
73 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); 73 EXPECT_EQ(bounds.ToString(), window->bounds().ToString());
74 } 74 }
75 75
76 // Tests maximized window size during root window resize. 76 // Tests maximized window size during root window resize.
77 TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { 77 TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) {
78 gfx::Rect bounds(100, 100, 200, 200); 78 gfx::Rect bounds(100, 100, 200, 200);
79 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); 79 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
80 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 80 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
81 gfx::Rect initial_work_area_bounds = 81 gfx::Rect initial_work_area_bounds =
82 ScreenAsh::GetMaximizedWindowParentBounds(window.get()); 82 ScreenAsh::GetMaximizedWindowBoundsInParent(window.get());
83 EXPECT_EQ(initial_work_area_bounds.ToString(), window->bounds().ToString()); 83 EXPECT_EQ(initial_work_area_bounds.ToString(), window->bounds().ToString());
84 // Enlarge the root window. We should still match the work area size. 84 // Enlarge the root window. We should still match the work area size.
85 Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(900, 700)); 85 Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(900, 700));
86 EXPECT_EQ( 86 EXPECT_EQ(
87 ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString(), 87 ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
88 window->bounds().ToString()); 88 window->bounds().ToString());
89 EXPECT_NE(initial_work_area_bounds.ToString(), 89 EXPECT_NE(
90 ScreenAsh::GetMaximizedWindowParentBounds(window.get()).ToString()); 90 initial_work_area_bounds.ToString(),
91 ScreenAsh::GetMaximizedWindowBoundsInParent(window.get()).ToString());
91 } 92 }
92 93
93 // Tests normal->fullscreen->normal. 94 // Tests normal->fullscreen->normal.
94 TEST_F(BaseLayoutManagerTest, Fullscreen) { 95 TEST_F(BaseLayoutManagerTest, Fullscreen) {
95 gfx::Rect bounds(100, 100, 200, 200); 96 gfx::Rect bounds(100, 100, 200, 200);
96 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); 97 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
97 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 98 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
98 // Fullscreen window fills the whole display. 99 // Fullscreen window fills the whole display.
99 EXPECT_EQ( 100 EXPECT_EQ(
100 gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(), 101 gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Create a window with bounds that fill the screen. 163 // Create a window with bounds that fill the screen.
163 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds(); 164 gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds();
164 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); 165 scoped_ptr<aura::Window> window(CreateTestWindow(bounds));
165 // Maximize it, which writes the old bounds to restore bounds. 166 // Maximize it, which writes the old bounds to restore bounds.
166 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 167 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
167 // Restore it. 168 // Restore it.
168 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 169 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
169 // It should have the default maximized window bounds, inset by the grid size. 170 // It should have the default maximized window bounds, inset by the grid size.
170 int grid_size = ash::Shell::GetInstance()->GetGridSize(); 171 int grid_size = ash::Shell::GetInstance()->GetGridSize();
171 gfx::Rect max_bounds = 172 gfx::Rect max_bounds =
172 ash::ScreenAsh::GetMaximizedWindowParentBounds(window.get()); 173 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window.get());
173 max_bounds.Inset(grid_size, grid_size); 174 max_bounds.Inset(grid_size, grid_size);
174 EXPECT_EQ(max_bounds.ToString(), window->bounds().ToString()); 175 EXPECT_EQ(max_bounds.ToString(), window->bounds().ToString());
175 } 176 }
176 177
177 } // namespace 178 } // namespace
178 179
179 } // namespace ash 180 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/base_layout_manager.cc ('k') | ash/wm/custom_frame_view_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698