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

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

Issue 2726823003: Remove WmLookup. (Closed)
Patch Set: Clean up include and modify comment. Created 3 years, 9 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/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
11 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
12 #include "ash/common/shelf/shelf_layout_manager.h" 12 #include "ash/common/shelf/shelf_layout_manager.h"
13 #include "ash/common/shelf/wm_shelf.h" 13 #include "ash/common/shelf/wm_shelf.h"
14 #include "ash/common/shell_observer.h" 14 #include "ash/common/shell_observer.h"
15 #include "ash/common/test/ash_test.h" 15 #include "ash/common/test/ash_test.h"
16 #include "ash/common/test/test_session_state_delegate.h" 16 #include "ash/common/test/test_session_state_delegate.h"
17 #include "ash/common/wm/fullscreen_window_finder.h" 17 #include "ash/common/wm/fullscreen_window_finder.h"
18 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h" 18 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h"
19 #include "ash/common/wm/window_state.h" 19 #include "ash/common/wm/window_state.h"
20 #include "ash/common/wm/wm_event.h" 20 #include "ash/common/wm/wm_event.h"
21 #include "ash/common/wm/wm_screen_util.h" 21 #include "ash/common/wm/wm_screen_util.h"
22 #include "ash/common/wm/workspace/workspace_window_resizer.h" 22 #include "ash/common/wm/workspace/workspace_window_resizer.h"
23 #include "ash/common/wm_lookup.h"
24 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
25 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
26 #include "ash/public/cpp/shell_window_ids.h" 25 #include "ash/public/cpp/shell_window_ids.h"
27 #include "ash/root_window_controller.h" 26 #include "ash/root_window_controller.h"
28 #include "ash/wm/window_state_aura.h" 27 #include "ash/wm/window_state_aura.h"
29 #include "base/command_line.h" 28 #include "base/command_line.h"
30 #include "base/run_loop.h" 29 #include "base/run_loop.h"
31 #include "ui/aura/env.h" 30 #include "ui/aura/env.h"
32 #include "ui/base/ui_base_switches.h" 31 #include "ui/base/ui_base_switches.h"
33 #include "ui/base/ui_base_types.h" 32 #include "ui/base/ui_base_types.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 236 EXPECT_EQ(root_windows[1], window->GetRootWindow());
238 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString()); 237 EXPECT_EQ("295,0 30x40", window->GetBoundsInScreen().ToString());
239 238
240 // Restoring widget state. 239 // Restoring widget state.
241 std::unique_ptr<views::Widget> w1(new views::Widget); 240 std::unique_ptr<views::Widget> w1(new views::Widget);
242 views::Widget::InitParams params; 241 views::Widget::InitParams params;
243 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 242 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
244 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); 243 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40));
245 ConfigureWidgetInitParamsForDisplay(root_windows[0], &params); 244 ConfigureWidgetInitParamsForDisplay(root_windows[0], &params);
246 w1->Init(params); 245 w1->Init(params);
247 WmLookup* wm_lookup = WmLookup::Get();
248 EXPECT_EQ(root_windows[0], 246 EXPECT_EQ(root_windows[0],
249 wm_lookup->GetWindowForWidget(w1.get())->GetRootWindow()); 247 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
250 w1->Show(); 248 w1->Show();
251 EXPECT_TRUE(w1->IsMaximized()); 249 EXPECT_TRUE(w1->IsMaximized());
252 EXPECT_EQ(root_windows[1], 250 EXPECT_EQ(root_windows[1],
253 wm_lookup->GetWindowForWidget(w1.get())->GetRootWindow()); 251 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
254 EXPECT_EQ( 252 EXPECT_EQ(
255 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(), 253 gfx::Rect(300, 0, 400, 500 - GetShelfConstant(SHELF_SIZE)).ToString(),
256 w1->GetWindowBoundsInScreen().ToString()); 254 w1->GetWindowBoundsInScreen().ToString());
257 w1->Restore(); 255 w1->Restore();
258 EXPECT_EQ(root_windows[1], 256 EXPECT_EQ(root_windows[1],
259 wm_lookup->GetWindowForWidget(w1.get())->GetRootWindow()); 257 WmWindow::Get(w1->GetNativeWindow())->GetRootWindow());
260 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); 258 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString());
261 } 259 }
262 260
263 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { 261 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) {
264 UpdateDisplay("300x400,400x500"); 262 UpdateDisplay("300x400,400x500");
265 263
266 WmWindow::Windows root_windows = WmShell::Get()->GetAllRootWindows(); 264 WmWindow::Windows root_windows = WmShell::Get()->GetAllRootWindows();
267 265
268 std::unique_ptr<WindowOwner> window_owner( 266 std::unique_ptr<WindowOwner> window_owner(
269 CreateTestWindow(gfx::Rect(1, 2, 30, 40))); 267 CreateTestWindow(gfx::Rect(1, 2, 30, 40)));
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 window->SetBounds(keyboard_bounds()); 1259 window->SetBounds(keyboard_bounds());
1262 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); 1260 window->GetWindowState()->set_ignore_keyboard_bounds_change(true);
1263 window->Activate(); 1261 window->Activate();
1264 1262
1265 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1263 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1266 ShowKeyboard(); 1264 ShowKeyboard();
1267 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1265 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1268 } 1266 }
1269 1267
1270 } // namespace ash 1268 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/workspace/phantom_window_controller.cc ('k') | ash/common/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698