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

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

Issue 2165693002: Fix tests in when MD is set to EXPERIMENTAL by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/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/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
11 #include "ash/common/session/session_state_delegate.h" 11 #include "ash/common/session/session_state_delegate.h"
12 #include "ash/common/shelf/shelf_constants.h"
12 #include "ash/common/shell_observer.h" 13 #include "ash/common/shell_observer.h"
13 #include "ash/common/shell_window_ids.h" 14 #include "ash/common/shell_window_ids.h"
14 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h" 15 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h"
15 #include "ash/common/wm/window_state.h" 16 #include "ash/common/wm/window_state.h"
16 #include "ash/common/wm/wm_event.h" 17 #include "ash/common/wm/wm_event.h"
17 #include "ash/common/wm/workspace/workspace_window_resizer.h" 18 #include "ash/common/wm/workspace/workspace_window_resizer.h"
18 #include "ash/common/wm_shell.h" 19 #include "ash/common/wm_shell.h"
19 #include "ash/display/display_manager.h" 20 #include "ash/display/display_manager.h"
20 #include "ash/root_window_controller.h" 21 #include "ash/root_window_controller.h"
21 #include "ash/screen_util.h" 22 #include "ash/screen_util.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::unique_ptr<aura::Window> window( 217 std::unique_ptr<aura::Window> window(
217 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); 218 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40)));
218 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 219 EXPECT_EQ(root_windows[0], window->GetRootWindow());
219 220
220 wm::WindowState* window_state = wm::GetWindowState(window.get()); 221 wm::WindowState* window_state = wm::GetWindowState(window.get());
221 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); 222 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40));
222 // Maximize the window in 2nd display as the restore bounds 223 // Maximize the window in 2nd display as the restore bounds
223 // is inside 2nd display. 224 // is inside 2nd display.
224 window_state->Maximize(); 225 window_state->Maximize();
225 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 226 EXPECT_EQ(root_windows[1], window->GetRootWindow());
226 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString()); 227 EXPECT_EQ(
228 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(),
229 window->GetBoundsInScreen().ToString());
227 230
228 window_state->Restore(); 231 window_state->Restore();
229 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 232 EXPECT_EQ(root_windows[1], window->GetRootWindow());
230 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString()); 233 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString());
231 234
232 // If the restore bounds intersects with the current display, 235 // If the restore bounds intersects with the current display,
233 // don't move. 236 // don't move.
234 window_state->SetRestoreBoundsInScreen(gfx::Rect(295, 0, 30, 40)); 237 window_state->SetRestoreBoundsInScreen(gfx::Rect(295, 0, 30, 40));
235 window_state->Maximize(); 238 window_state->Maximize();
236 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 239 EXPECT_EQ(root_windows[1], window->GetRootWindow());
237 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString()); 240 EXPECT_EQ(
241 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(),
242 window->GetBoundsInScreen().ToString());
238 243
239 window_state->Restore(); 244 window_state->Restore();
240 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 245 EXPECT_EQ(root_windows[1], window->GetRootWindow());
241 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString()); 246 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString());
242 247
243 // Restoring widget state. 248 // Restoring widget state.
244 std::unique_ptr<views::Widget> w1(new views::Widget); 249 std::unique_ptr<views::Widget> w1(new views::Widget);
245 views::Widget::InitParams params; 250 views::Widget::InitParams params;
246 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 251 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
247 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); 252 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40));
248 params.context = root_windows[0]; 253 params.context = root_windows[0];
249 w1->Init(params); 254 w1->Init(params);
250 w1->Show(); 255 w1->Show();
251 EXPECT_TRUE(w1->IsMaximized()); 256 EXPECT_TRUE(w1->IsMaximized());
252 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 257 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
253 EXPECT_EQ("300,0 400x453", w1->GetWindowBoundsInScreen().ToString()); 258 EXPECT_EQ(
259 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(),
260 w1->GetWindowBoundsInScreen().ToString());
254 w1->Restore(); 261 w1->Restore();
255 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 262 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
256 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); 263 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString());
257 } 264 }
258 265
259 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { 266 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) {
260 if (!SupportsMultipleDisplays()) 267 if (!SupportsMultipleDisplays())
261 return; 268 return;
262 UpdateDisplay("300x400,400x500"); 269 UpdateDisplay("300x400,400x500");
263 270
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 CreateTestWindowInShellWithDelegate(&delegate2, -1, keyboard_bounds())); 1197 CreateTestWindowInShellWithDelegate(&delegate2, -1, keyboard_bounds()));
1191 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true); 1198 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true);
1192 wm::ActivateWindow(window.get()); 1199 wm::ActivateWindow(window.get());
1193 1200
1194 EXPECT_EQ(keyboard_bounds(), window->bounds()); 1201 EXPECT_EQ(keyboard_bounds(), window->bounds());
1195 ShowKeyboard(); 1202 ShowKeyboard();
1196 EXPECT_EQ(keyboard_bounds(), window->bounds()); 1203 EXPECT_EQ(keyboard_bounds(), window->bounds());
1197 } 1204 }
1198 1205
1199 } // namespace ash 1206 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698