OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/workspace/snap_sizer.h" | 5 #include "ash/wm/workspace/snap_sizer.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 window->SetBounds(gfx::Rect(10, 10, 500, 300)); | 152 window->SetBounds(gfx::Rect(10, 10, 500, 300)); |
153 EXPECT_EQ(expected.ToString(), window->GetBoundsInScreen().ToString()); | 153 EXPECT_EQ(expected.ToString(), window->GetBoundsInScreen().ToString()); |
154 } | 154 } |
155 | 155 |
156 // Test that snapping left/right preserves the restore bounds. | 156 // Test that snapping left/right preserves the restore bounds. |
157 TEST_F(SnapSizerTest, RestoreBounds) { | 157 TEST_F(SnapSizerTest, RestoreBounds) { |
158 scoped_ptr<aura::Window> window( | 158 scoped_ptr<aura::Window> window( |
159 CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100))); | 159 CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100))); |
160 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 160 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
161 | 161 |
162 EXPECT_TRUE(window_state->IsNormalShowState()); | 162 EXPECT_TRUE(window_state->IsNormalShowType()); |
163 | 163 |
164 // 1) Start with restored window with restore bounds set. | 164 // 1) Start with restored window with restore bounds set. |
165 gfx::Rect restore_bounds = window->GetBoundsInScreen(); | 165 gfx::Rect restore_bounds = window->GetBoundsInScreen(); |
166 restore_bounds.set_width(restore_bounds.width() + 1); | 166 restore_bounds.set_width(restore_bounds.width() + 1); |
167 window_state->SetRestoreBoundsInScreen(restore_bounds); | 167 window_state->SetRestoreBoundsInScreen(restore_bounds); |
168 SnapSizer::SnapWindow(window_state, SnapSizer::LEFT_EDGE); | 168 SnapSizer::SnapWindow(window_state, SnapSizer::LEFT_EDGE); |
169 SnapSizer::SnapWindow(window_state, SnapSizer::RIGHT_EDGE); | 169 SnapSizer::SnapWindow(window_state, SnapSizer::RIGHT_EDGE); |
170 EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 170 EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
171 EXPECT_EQ(restore_bounds.ToString(), | 171 EXPECT_EQ(restore_bounds.ToString(), |
172 window_state->GetRestoreBoundsInScreen().ToString()); | 172 window_state->GetRestoreBoundsInScreen().ToString()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 window->bounds().width(), // No expectation for the width. | 212 window->bounds().width(), // No expectation for the width. |
213 kWorkAreaBounds.height()); | 213 kWorkAreaBounds.height()); |
214 EXPECT_EQ(expected_snapped_bounds.ToString(), | 214 EXPECT_EQ(expected_snapped_bounds.ToString(), |
215 window->GetBoundsInScreen().ToString()); | 215 window->GetBoundsInScreen().ToString()); |
216 | 216 |
217 // The window should still be auto managed despite being right maximized. | 217 // The window should still be auto managed despite being right maximized. |
218 EXPECT_TRUE(window_state->window_position_managed()); | 218 EXPECT_TRUE(window_state->window_position_managed()); |
219 } | 219 } |
220 | 220 |
221 } // namespace ash | 221 } // namespace ash |
OLD | NEW |