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

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

Issue 2732573002: chromeos: moves more ash tests to run on mash (Closed)
Patch Set: fix bug ref 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) 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/common/wm/dock/docked_window_resizer.h" 5 #include "ash/common/wm/dock/docked_window_resizer.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/shelf_widget.h" 8 #include "ash/common/shelf/shelf_widget.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/test/test_shelf_delegate.h" 10 #include "ash/common/test/test_shelf_delegate.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); 88 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM);
89 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 89 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
90 window->Init(ui::LAYER_TEXTURED); 90 window->Init(ui::LAYER_TEXTURED);
91 window->Show(); 91 window->Show();
92 92
93 if (bounds.IsEmpty()) { 93 if (bounds.IsEmpty()) {
94 ParentWindowInPrimaryRootWindow(window); 94 ParentWindowInPrimaryRootWindow(window);
95 } else { 95 } else {
96 display::Display display = 96 display::Display display =
97 display::Screen::GetScreen()->GetDisplayMatching(bounds); 97 display::Screen::GetScreen()->GetDisplayMatching(bounds);
98 aura::Window* root = ash::Shell::GetInstance() 98 WmWindow* root = WmShell::Get()->GetRootWindowForDisplayId(display.id());
99 ->window_tree_host_manager()
100 ->GetRootWindowForDisplayId(display.id());
101 gfx::Point origin = bounds.origin(); 99 gfx::Point origin = bounds.origin();
102 ::wm::ConvertPointFromScreen(root, &origin); 100 ::wm::ConvertPointFromScreen(root->aura_window(), &origin);
103 window->SetBounds(gfx::Rect(origin, bounds.size())); 101 window->SetBounds(gfx::Rect(origin, bounds.size()));
104 aura::client::ParentWindowWithContext(window, root, bounds); 102 aura::client::ParentWindowWithContext(window, root->aura_window(),
103 bounds);
105 } 104 }
106 return window; 105 return window;
107 } 106 }
108 107
109 static WindowResizer* CreateSomeWindowResizer( 108 static WindowResizer* CreateSomeWindowResizer(
110 aura::Window* window, 109 aura::Window* window,
111 const gfx::Point& point_in_parent, 110 const gfx::Point& point_in_parent,
112 int window_component) { 111 int window_component) {
113 return CreateWindowResizer(WmWindow::Get(window), point_in_parent, 112 return CreateWindowResizer(WmWindow::Get(window), point_in_parent,
114 window_component, 113 window_component,
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 DragMove(-10, 10); 645 DragMove(-10, 10);
647 DragRevert(); 646 DragRevert();
648 // The window should be in default container and not docked. 647 // The window should be in default container and not docked.
649 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); 648 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
650 // Docked area alignment should be cleared. 649 // Docked area alignment should be cleared.
651 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager)); 650 EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager));
652 } 651 }
653 652
654 // Move a docked window to the second display 653 // Move a docked window to the second display
655 TEST_P(DockedWindowResizerTest, DragAcrossDisplays) { 654 TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
655 // TODO: investigate failure in mash. http://crbug.com/698060.
656 if (WmShell::Get()->IsRunningInMash())
657 return;
658
656 UpdateDisplay("800x800,800x800"); 659 UpdateDisplay("800x800,800x800");
657 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 660 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
658 EXPECT_EQ(2, static_cast<int>(root_windows.size())); 661 EXPECT_EQ(2, static_cast<int>(root_windows.size()));
659 std::unique_ptr<aura::Window> window( 662 std::unique_ptr<aura::Window> window(
660 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 663 CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
661 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 664 EXPECT_EQ(root_windows[0], window->GetRootWindow());
662 665
663 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); 666 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0);
664 // The window should be docked at the right edge. 667 // The window should be docked at the right edge.
665 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), 668 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(),
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 EXPECT_TRUE(w1->GetProperty(kPanelAttachedKey)); 1314 EXPECT_TRUE(w1->GetProperty(kPanelAttachedKey));
1312 } else { 1315 } else {
1313 // The window should not be touching the shelf. 1316 // The window should not be touching the shelf.
1314 EXPECT_EQ(shelf_y - kDistanceFromShelf, w1->bounds().bottom()); 1317 EXPECT_EQ(shelf_y - kDistanceFromShelf, w1->bounds().bottom());
1315 } 1318 }
1316 } 1319 }
1317 1320
1318 // Tests that docking and undocking a |window| with a transient child properly 1321 // Tests that docking and undocking a |window| with a transient child properly
1319 // maintains the parent of that transient child to be the same as the |window|. 1322 // maintains the parent of that transient child to be the same as the |window|.
1320 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) { 1323 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) {
1324 // TODO: investigate failure in mash. http://crbug.com/698060.
1325 if (WmShell::Get()->IsRunningInMash())
1326 return;
1327
1321 // Create a window with a transient child. 1328 // Create a window with a transient child.
1322 std::unique_ptr<aura::Window> window( 1329 std::unique_ptr<aura::Window> window(
1323 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 1330 CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
1324 std::unique_ptr<aura::Window> child( 1331 std::unique_ptr<aura::Window> child(
1325 CreateTestWindowInShellWithDelegateAndType( 1332 CreateTestWindowInShellWithDelegateAndType(
1326 NULL, ui::wm::WINDOW_TYPE_NORMAL, 0, gfx::Rect(20, 20, 150, 20))); 1333 NULL, ui::wm::WINDOW_TYPE_NORMAL, 0, gfx::Rect(20, 20, 150, 20)));
1327 ::wm::AddTransientChild(window.get(), child.get()); 1334 ::wm::AddTransientChild(window.get(), child.get());
1328 if (window->parent() != child->parent()) 1335 if (window->parent() != child->parent())
1329 window->parent()->AddChild(child.get()); 1336 window->parent()->AddChild(child.get());
1330 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get())); 1337 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 EXPECT_TRUE(window_state->IsMaximized()); 1499 EXPECT_TRUE(window_state->IsMaximized());
1493 } 1500 }
1494 1501
1495 // Tests run twice - on both panels and normal windows 1502 // Tests run twice - on both panels and normal windows
1496 INSTANTIATE_TEST_CASE_P(NormalOrPanel, 1503 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
1497 DockedWindowResizerTest, 1504 DockedWindowResizerTest,
1498 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 1505 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
1499 ui::wm::WINDOW_TYPE_PANEL)); 1506 ui::wm::WINDOW_TYPE_PANEL));
1500 1507
1501 } // namespace ash 1508 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/immersive_fullscreen_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698