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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 2927693002: mash: Limit ShelfWindowWatcher to panels and dialogs. (Closed)
Patch Set: Disable WindowSelectorTest.MultipleDisplays in mash. Created 3 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/accessibility_types.h" 9 #include "ash/accessibility_types.h"
10 #include "ash/drag_drop/drag_drop_controller.h" 10 #include "ash/drag_drop/drag_drop_controller.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ParentWindowInPrimaryRootWindow(window); 138 ParentWindowInPrimaryRootWindow(window);
139 return widget; 139 return widget;
140 } 140 }
141 141
142 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { 142 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
143 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 143 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
144 nullptr, aura::client::WINDOW_TYPE_PANEL, 0, bounds); 144 nullptr, aura::client::WINDOW_TYPE_PANEL, 0, bounds);
145 static int id = 0; 145 static int id = 0;
146 std::string shelf_id(ShelfID(base::IntToString(id++)).Serialize()); 146 std::string shelf_id(ShelfID(base::IntToString(id++)).Serialize());
147 window->SetProperty(kShelfIDKey, new std::string(shelf_id)); 147 window->SetProperty(kShelfIDKey, new std::string(shelf_id));
148 window->SetProperty<int>(kShelfItemTypeKey, TYPE_APP_PANEL);
148 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); 149 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight);
149 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); 150 shelf_view_test()->RunMessageLoopUntilAnimationsDone();
150 return window; 151 return window;
151 } 152 }
152 153
153 bool WindowsOverlapping(aura::Window* window1, aura::Window* window2) { 154 bool WindowsOverlapping(aura::Window* window1, aura::Window* window2) {
154 gfx::Rect window1_bounds = GetTransformedTargetBounds(window1); 155 gfx::Rect window1_bounds = GetTransformedTargetBounds(window1);
155 gfx::Rect window2_bounds = GetTransformedTargetBounds(window2); 156 gfx::Rect window2_bounds = GetTransformedTargetBounds(window2);
156 return window1_bounds.Intersects(window2_bounds); 157 return window1_bounds.Intersects(window2_bounds);
157 } 158 }
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 ClickWindow(window1.get()); 1136 ClickWindow(window1.get());
1136 EXPECT_FALSE(IsSelecting()); 1137 EXPECT_FALSE(IsSelecting());
1137 1138
1138 // Clicking on window1 should activate child1. 1139 // Clicking on window1 should activate child1.
1139 EXPECT_TRUE(wm::IsActiveWindow(child1.get())); 1140 EXPECT_TRUE(wm::IsActiveWindow(child1.get()));
1140 } 1141 }
1141 1142
1142 // Tests that windows remain on the display they are currently on in overview 1143 // Tests that windows remain on the display they are currently on in overview
1143 // mode, and that the close buttons are on matching displays. 1144 // mode, and that the close buttons are on matching displays.
1144 TEST_F(WindowSelectorTest, MultipleDisplays) { 1145 TEST_F(WindowSelectorTest, MultipleDisplays) {
1146 // TODO: Crashes in bounds_animator.cc in mash: http://crbug.com/730759
1147 if (Shell::GetAshConfig() == Config::MASH)
1148 return;
1149
1145 UpdateDisplay("600x400,600x400"); 1150 UpdateDisplay("600x400,600x400");
1146 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 1151 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
1147 gfx::Rect bounds1(0, 0, 400, 400); 1152 gfx::Rect bounds1(0, 0, 400, 400);
1148 gfx::Rect bounds2(650, 0, 400, 400); 1153 gfx::Rect bounds2(650, 0, 400, 400);
1149 1154
1150 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1)); 1155 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1));
1151 std::unique_ptr<aura::Window> window2(CreateWindow(bounds1)); 1156 std::unique_ptr<aura::Window> window2(CreateWindow(bounds1));
1152 std::unique_ptr<aura::Window> window3(CreateWindow(bounds2)); 1157 std::unique_ptr<aura::Window> window3(CreateWindow(bounds2));
1153 std::unique_ptr<aura::Window> window4(CreateWindow(bounds2)); 1158 std::unique_ptr<aura::Window> window4(CreateWindow(bounds2));
1154 std::unique_ptr<aura::Window> panel1(CreatePanelWindow(bounds1)); 1159 std::unique_ptr<aura::Window> panel1(CreatePanelWindow(bounds1));
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 window.get(), gfx::Point(), HTCAPTION, ::wm::WINDOW_MOVE_SOURCE_MOUSE)); 1850 window.get(), gfx::Point(), HTCAPTION, ::wm::WINDOW_MOVE_SOURCE_MOUSE));
1846 ASSERT_TRUE(resizer.get()); 1851 ASSERT_TRUE(resizer.get());
1847 gfx::Point location = resizer->GetInitialLocation(); 1852 gfx::Point location = resizer->GetInitialLocation();
1848 location.Offset(20, 20); 1853 location.Offset(20, 20);
1849 resizer->Drag(location, 0); 1854 resizer->Drag(location, 0);
1850 ToggleOverview(); 1855 ToggleOverview();
1851 resizer->RevertDrag(); 1856 resizer->RevertDrag();
1852 } 1857 }
1853 1858
1854 } // namespace ash 1859 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698