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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager_unittest.cc

Issue 1907863002: Converts DockedWindowLayoutManager to common ash/wm types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/dock/docked_window_resizer.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" 5 #include "ash/wm/dock/docked_window_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 gfx::Rect bounds(0, 0, 201, 201); 264 gfx::Rect bounds(0, 0, 201, 201);
265 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds)); 265 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds));
266 DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 0); 266 DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 0);
267 267
268 // The window should be attached and snapped to the right side of the screen. 268 // The window should be attached and snapped to the right side of the screen.
269 EXPECT_EQ(window->GetRootWindow()->bounds().x(), 269 EXPECT_EQ(window->GetRootWindow()->bounds().x(),
270 window->GetBoundsInScreen().x()); 270 window->GetBoundsInScreen().x());
271 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); 271 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id());
272 272
273 DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>( 273 DockedWindowLayoutManager* manager =
274 window->parent()->layout_manager()); 274 DockedWindowLayoutManager::Get(wm::WmWindowAura::Get(window.get()));
275 275
276 // Create two additional windows and test their auto-placement 276 // Create two additional windows and test their auto-placement
277 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 277 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
278 gfx::Rect desktop_area = window1->parent()->bounds(); 278 gfx::Rect desktop_area = window1->parent()->bounds();
279 wm::GetWindowState(window1.get())->set_window_position_managed(true); 279 wm::GetWindowState(window1.get())->set_window_position_managed(true);
280 window1->Hide(); 280 window1->Hide();
281 window1->SetBounds(gfx::Rect(250, 32, 231, 320)); 281 window1->SetBounds(gfx::Rect(250, 32, 231, 320));
282 window1->Show(); 282 window1->Show();
283 // |window1| should be centered in work area. 283 // |window1| should be centered in work area.
284 EXPECT_EQ(base::IntToString( 284 EXPECT_EQ(base::IntToString(
(...skipping 28 matching lines...) Expand all
313 313
314 gfx::Rect bounds(0, 0, 201, 201); 314 gfx::Rect bounds(0, 0, 201, 201);
315 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds)); 315 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds));
316 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); 316 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0);
317 317
318 // The window should be attached and snapped to the right side of the screen. 318 // The window should be attached and snapped to the right side of the screen.
319 EXPECT_EQ(window->GetRootWindow()->bounds().right(), 319 EXPECT_EQ(window->GetRootWindow()->bounds().right(),
320 window->GetBoundsInScreen().right()); 320 window->GetBoundsInScreen().right());
321 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); 321 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id());
322 322
323 DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>( 323 DockedWindowLayoutManager* manager =
324 window->parent()->layout_manager()); 324 DockedWindowLayoutManager::Get(wm::WmWindowAura::Get(window.get()));
325 325
326 // Create two additional windows and test their auto-placement 326 // Create two additional windows and test their auto-placement
327 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 327 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
328 gfx::Rect desktop_area = window1->parent()->bounds(); 328 gfx::Rect desktop_area = window1->parent()->bounds();
329 wm::GetWindowState(window1.get())->set_window_position_managed(true); 329 wm::GetWindowState(window1.get())->set_window_position_managed(true);
330 window1->Hide(); 330 window1->Hide();
331 window1->SetBounds(gfx::Rect(16, 32, 231, 320)); 331 window1->SetBounds(gfx::Rect(16, 32, 231, 320));
332 window1->Show(); 332 window1->Show();
333 333
334 // |window1| should be centered in work area. 334 // |window1| should be centered in work area.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 gfx::Rect bounds(600, 0, 201, 201); 367 gfx::Rect bounds(600, 0, 201, 201);
368 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds)); 368 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds));
369 // Drag pointer to the right edge of the second screen. 369 // Drag pointer to the right edge of the second screen.
370 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); 370 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0);
371 371
372 // The window should be attached and snapped to the right side of the screen. 372 // The window should be attached and snapped to the right side of the screen.
373 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), 373 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(),
374 window->GetBoundsInScreen().right()); 374 window->GetBoundsInScreen().right());
375 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); 375 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id());
376 376
377 DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>( 377 DockedWindowLayoutManager* manager =
378 window->parent()->layout_manager()); 378 DockedWindowLayoutManager::Get(wm::WmWindowAura::Get(window.get()));
379 379
380 // Create two additional windows and test their auto-placement 380 // Create two additional windows and test their auto-placement
381 bounds = gfx::Rect(616, 32, 231, 320); 381 bounds = gfx::Rect(616, 32, 231, 320);
382 std::unique_ptr<aura::Window> window1( 382 std::unique_ptr<aura::Window> window1(
383 CreateTestWindowInShellWithDelegate(nullptr, 1, bounds)); 383 CreateTestWindowInShellWithDelegate(nullptr, 1, bounds));
384 gfx::Rect desktop_area = window1->parent()->bounds(); 384 gfx::Rect desktop_area = window1->parent()->bounds();
385 wm::GetWindowState(window1.get())->set_window_position_managed(true); 385 wm::GetWindowState(window1.get())->set_window_position_managed(true);
386 window1->Hide(); 386 window1->Hide();
387 window1->Show(); 387 window1->Show();
388 388
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); 861 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height());
862 } 862 }
863 863
864 // Tests run twice - on both panels and normal windows 864 // Tests run twice - on both panels and normal windows
865 INSTANTIATE_TEST_CASE_P(NormalOrPanel, 865 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
866 DockedWindowLayoutManagerTest, 866 DockedWindowLayoutManagerTest,
867 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 867 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
868 ui::wm::WINDOW_TYPE_PANEL)); 868 ui::wm::WINDOW_TYPE_PANEL));
869 869
870 } // namespace ash 870 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.cc ('k') | ash/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698