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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 2823133002: Clean up some ash constants. (Closed)
Patch Set: ditto Created 3 years, 8 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
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/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/cpp/config.h" 10 #include "ash/public/cpp/config.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 CreateTestWindow(gfx::Rect(1, 2, 30, 40))); 213 CreateTestWindow(gfx::Rect(1, 2, 30, 40)));
214 WmWindow* window = window_owner->window(); 214 WmWindow* window = window_owner->window();
215 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 215 EXPECT_EQ(root_windows[0], window->GetRootWindow());
216 216
217 wm::WindowState* window_state = window->GetWindowState(); 217 wm::WindowState* window_state = window->GetWindowState();
218 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); 218 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40));
219 // Maximize the window in 2nd display as the restore bounds 219 // Maximize the window in 2nd display as the restore bounds
220 // is inside 2nd display. 220 // is inside 2nd display.
221 window_state->Maximize(); 221 window_state->Maximize();
222 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 222 EXPECT_EQ(root_windows[1], window->GetRootWindow());
223 EXPECT_EQ( 223 EXPECT_EQ(gfx::Rect(300, 0, 400, 500 - kShelfSize).ToString(),
224 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(), 224 window->GetBoundsInScreen().ToString());
225 window->GetBoundsInScreen().ToString());
226 225
227 window_state->Restore(); 226 window_state->Restore();
228 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 227 EXPECT_EQ(root_windows[1], window->GetRootWindow());
229 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString()); 228 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString());
230 229
231 // If the restore bounds intersects with the current display, 230 // If the restore bounds intersects with the current display,
232 // don't move. 231 // don't move.
233 window_state->SetRestoreBoundsInScreen(gfx::Rect(295, 0, 30, 40)); 232 window_state->SetRestoreBoundsInScreen(gfx::Rect(295, 0, 30, 40));
234 window_state->Maximize(); 233 window_state->Maximize();
235 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 234 EXPECT_EQ(root_windows[1], window->GetRootWindow());
236 EXPECT_EQ( 235 EXPECT_EQ(gfx::Rect(300, 0, 400, 500 - kShelfSize).ToString(),
237 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(), 236 window->GetBoundsInScreen().ToString());
238 window->GetBoundsInScreen().ToString());
239 237
240 window_state->Restore(); 238 window_state->Restore();
241 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 239 EXPECT_EQ(root_windows[1], window->GetRootWindow());
242 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString()); 240 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString());
243 241
244 // Restoring widget state. 242 // Restoring widget state.
245 std::unique_ptr<views::Widget> w1(new views::Widget); 243 std::unique_ptr<views::Widget> w1(new views::Widget);
246 views::Widget::InitParams params; 244 views::Widget::InitParams params;
247 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 245 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
248 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); 246 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40));
249 ConfigureWidgetInitParamsForDisplay(root_windows[0], &params); 247 ConfigureWidgetInitParamsForDisplay(root_windows[0], &params);
250 w1->Init(params); 248 w1->Init(params);
251 EXPECT_EQ(root_windows[0], 249 EXPECT_EQ(root_windows[0],
252 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow()); 250 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
253 w1->Show(); 251 w1->Show();
254 EXPECT_TRUE(w1->IsMaximized()); 252 EXPECT_TRUE(w1->IsMaximized());
255 EXPECT_EQ(root_windows[1], 253 EXPECT_EQ(root_windows[1],
256 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow()); 254 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
257 EXPECT_EQ( 255 EXPECT_EQ(gfx::Rect(300, 0, 400, 500 - kShelfSize).ToString(),
258 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(), 256 w1->GetWindowBoundsInScreen().ToString());
259 w1->GetWindowBoundsInScreen().ToString());
260 w1->Restore(); 257 w1->Restore();
261 EXPECT_EQ(root_windows[1], 258 EXPECT_EQ(root_windows[1],
262 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow()); 259 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
263 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); 260 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString());
264 } 261 }
265 262
266 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { 263 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) {
267 UpdateDisplay("300x400,400x500"); 264 UpdateDisplay("300x400,400x500");
268 265
269 WmWindow::Windows root_windows = ShellPort::Get()->GetAllRootWindows(); 266 WmWindow::Windows root_windows = ShellPort::Get()->GetAllRootWindows();
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 window->SetBounds(keyboard_bounds()); 1273 window->SetBounds(keyboard_bounds());
1277 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); 1274 window->GetWindowState()->set_ignore_keyboard_bounds_change(true);
1278 window->Activate(); 1275 window->Activate();
1279 1276
1280 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1277 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1281 ShowKeyboard(); 1278 ShowKeyboard();
1282 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1279 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1283 } 1280 }
1284 1281
1285 } // namespace ash 1282 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/web_notification/ash_popup_alignment_delegate.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698