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

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

Issue 2629643002: chromeos: Renames WmWindowAura to WmWindow (Closed)
Patch Set: feedback Created 3 years, 11 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/aura/wm_window_aura.h"
9 #include "ash/common/accessibility_delegate.h" 8 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/accessibility_types.h" 9 #include "ash/common/accessibility_types.h"
11 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
12 #include "ash/common/shelf/shelf_widget.h" 11 #include "ash/common/shelf/shelf_widget.h"
13 #include "ash/common/shelf/wm_shelf.h" 12 #include "ash/common/shelf/wm_shelf.h"
14 #include "ash/common/system/tray/system_tray.h" 13 #include "ash/common/system/tray/system_tray.h"
15 #include "ash/common/test/test_shelf_delegate.h" 14 #include "ash/common/test/test_shelf_delegate.h"
16 #include "ash/common/wm/dock/docked_window_layout_manager.h" 15 #include "ash/common/wm/dock/docked_window_layout_manager.h"
17 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
18 #include "ash/common/wm/mru_window_tracker.h" 17 #include "ash/common/wm/mru_window_tracker.h"
19 #include "ash/common/wm/overview/scoped_transform_overview_window.h" 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
20 #include "ash/common/wm/overview/window_grid.h" 19 #include "ash/common/wm/overview/window_grid.h"
21 #include "ash/common/wm/overview/window_selector.h" 20 #include "ash/common/wm/overview/window_selector.h"
22 #include "ash/common/wm/overview/window_selector_controller.h" 21 #include "ash/common/wm/overview/window_selector_controller.h"
23 #include "ash/common/wm/overview/window_selector_item.h" 22 #include "ash/common/wm/overview/window_selector_item.h"
24 #include "ash/common/wm/panels/panel_layout_manager.h" 23 #include "ash/common/wm/panels/panel_layout_manager.h"
25 #include "ash/common/wm/window_state.h" 24 #include "ash/common/wm/window_state.h"
26 #include "ash/common/wm/wm_event.h" 25 #include "ash/common/wm/wm_event.h"
27 #include "ash/common/wm/workspace/workspace_window_resizer.h" 26 #include "ash/common/wm/workspace/workspace_window_resizer.h"
28 #include "ash/common/wm_lookup.h" 27 #include "ash/common/wm_lookup.h"
29 #include "ash/common/wm_shell.h" 28 #include "ash/common/wm_shell.h"
29 #include "ash/common/wm_window.h"
30 #include "ash/common/wm_window_property.h" 30 #include "ash/common/wm_window_property.h"
31 #include "ash/drag_drop/drag_drop_controller.h" 31 #include "ash/drag_drop/drag_drop_controller.h"
32 #include "ash/public/cpp/shell_window_ids.h" 32 #include "ash/public/cpp/shell_window_ids.h"
33 #include "ash/root_window_controller.h" 33 #include "ash/root_window_controller.h"
34 #include "ash/screen_util.h" 34 #include "ash/screen_util.h"
35 #include "ash/shell.h" 35 #include "ash/shell.h"
36 #include "ash/test/ash_test_base.h" 36 #include "ash/test/ash_test_base.h"
37 #include "ash/test/shelf_view_test_api.h" 37 #include "ash/test/shelf_view_test_api.h"
38 #include "ash/test/shell_test_api.h" 38 #include "ash/test/shell_test_api.h"
39 #include "ash/test/test_app_list_view_presenter_impl.h" 39 #include "ash/test/test_app_list_view_presenter_impl.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get()); 163 WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get());
164 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); 164 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight);
165 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); 165 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow());
166 return widget; 166 return widget;
167 } 167 }
168 168
169 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { 169 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
170 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( 170 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
171 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); 171 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds);
172 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); 172 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight);
173 test::TestShelfDelegate::instance()->AddShelfItem( 173 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window));
174 WmWindowAura::Get(window));
175 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); 174 shelf_view_test()->RunMessageLoopUntilAnimationsDone();
176 return window; 175 return window;
177 } 176 }
178 177
179 bool WindowsOverlapping(aura::Window* window1, aura::Window* window2) { 178 bool WindowsOverlapping(aura::Window* window1, aura::Window* window2) {
180 gfx::Rect window1_bounds = GetTransformedTargetBounds(window1); 179 gfx::Rect window1_bounds = GetTransformedTargetBounds(window1);
181 gfx::Rect window2_bounds = GetTransformedTargetBounds(window2); 180 gfx::Rect window2_bounds = GetTransformedTargetBounds(window2);
182 return window1_bounds.Intersects(window2_bounds); 181 return window1_bounds.Intersects(window2_bounds);
183 } 182 }
184 183
185 WindowSelectorController* window_selector_controller() { 184 WindowSelectorController* window_selector_controller() {
186 return WmShell::Get()->window_selector_controller(); 185 return WmShell::Get()->window_selector_controller();
187 } 186 }
188 187
189 WindowSelector* window_selector() { 188 WindowSelector* window_selector() {
190 return window_selector_controller()->window_selector_.get(); 189 return window_selector_controller()->window_selector_.get();
191 } 190 }
192 191
193 void ToggleOverview() { window_selector_controller()->ToggleOverview(); } 192 void ToggleOverview() { window_selector_controller()->ToggleOverview(); }
194 193
195 aura::Window* GetOverviewWindowForMinimizedState(int index, 194 aura::Window* GetOverviewWindowForMinimizedState(int index,
196 aura::Window* window) { 195 aura::Window* window) {
197 WindowSelectorItem* selector = GetWindowItemForWindow(index, window); 196 WindowSelectorItem* selector = GetWindowItemForWindow(index, window);
198 return WmWindowAura::GetAuraWindow( 197 return WmWindow::GetAuraWindow(
199 selector->GetOverviewWindowForMinimizedStateForTest()); 198 selector->GetOverviewWindowForMinimizedStateForTest());
200 } 199 }
201 200
202 gfx::Rect GetTransformedBounds(aura::Window* window) { 201 gfx::Rect GetTransformedBounds(aura::Window* window) {
203 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen( 202 gfx::RectF bounds(ScreenUtil::ConvertRectToScreen(
204 window->parent(), window->layer()->bounds())); 203 window->parent(), window->layer()->bounds()));
205 gfx::Transform transform(gfx::TransformAboutPivot( 204 gfx::Transform transform(gfx::TransformAboutPivot(
206 gfx::ToFlooredPoint(bounds.origin()), window->layer()->transform())); 205 gfx::ToFlooredPoint(bounds.origin()), window->layer()->transform()));
207 transform.TransformRect(&bounds); 206 transform.TransformRect(&bounds);
208 return gfx::ToEnclosingRect(bounds); 207 return gfx::ToEnclosingRect(bounds);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { 260 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) {
262 return window_selector()->grid_list_[index]->window_list_.get(); 261 return window_selector()->grid_list_[index]->window_list_.get();
263 } 262 }
264 263
265 WindowSelectorItem* GetWindowItemForWindow(int grid_index, 264 WindowSelectorItem* GetWindowItemForWindow(int grid_index,
266 aura::Window* window) { 265 aura::Window* window) {
267 const std::vector<WindowSelectorItem*>& windows = 266 const std::vector<WindowSelectorItem*>& windows =
268 GetWindowItemsForRoot(grid_index); 267 GetWindowItemsForRoot(grid_index);
269 auto iter = std::find_if(windows.cbegin(), windows.cend(), 268 auto iter = std::find_if(windows.cbegin(), windows.cend(),
270 [window](const WindowSelectorItem* item) { 269 [window](const WindowSelectorItem* item) {
271 return item->Contains(WmWindowAura::Get(window)); 270 return item->Contains(WmWindow::Get(window));
272 }); 271 });
273 if (iter == windows.end()) 272 if (iter == windows.end())
274 return nullptr; 273 return nullptr;
275 return *iter; 274 return *iter;
276 } 275 }
277 276
278 gfx::SlideAnimation* GetBackgroundViewAnimationForWindow( 277 gfx::SlideAnimation* GetBackgroundViewAnimationForWindow(
279 int grid_index, 278 int grid_index,
280 aura::Window* window) { 279 aura::Window* window) {
281 return GetWindowItemForWindow(grid_index, window) 280 return GetWindowItemForWindow(grid_index, window)
(...skipping 15 matching lines...) Expand all
297 GetSelectedWindow() != start_window); 296 GetSelectedWindow() != start_window);
298 return GetSelectedWindow() == window; 297 return GetSelectedWindow() == window;
299 } 298 }
300 299
301 const aura::Window* GetSelectedWindow() { 300 const aura::Window* GetSelectedWindow() {
302 WindowSelector* ws = window_selector(); 301 WindowSelector* ws = window_selector();
303 WindowSelectorItem* item = 302 WindowSelectorItem* item =
304 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow(); 303 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow();
305 if (!item) 304 if (!item)
306 return nullptr; 305 return nullptr;
307 return WmWindowAura::GetAuraWindow(item->GetWindow()); 306 return WmWindow::GetAuraWindow(item->GetWindow());
308 } 307 }
309 308
310 bool selection_widget_active() { 309 bool selection_widget_active() {
311 WindowSelector* ws = window_selector(); 310 WindowSelector* ws = window_selector();
312 return ws->grid_list_[ws->selected_grid_index_]->is_selecting(); 311 return ws->grid_list_[ws->selected_grid_index_]->is_selecting();
313 } 312 }
314 313
315 bool showing_filter_widget() { 314 bool showing_filter_widget() {
316 return window_selector() 315 return window_selector()
317 ->text_filter_widget_->GetNativeWindow() 316 ->text_filter_widget_->GetNativeWindow()
318 ->layer() 317 ->layer()
319 ->GetTargetTransform() 318 ->GetTargetTransform()
320 .IsIdentity(); 319 .IsIdentity();
321 } 320 }
322 321
323 views::Widget* GetCloseButton(WindowSelectorItem* window) { 322 views::Widget* GetCloseButton(WindowSelectorItem* window) {
324 return window->close_button_->GetWidget(); 323 return window->close_button_->GetWidget();
325 } 324 }
326 325
327 views::LabelButton* GetLabelButtonView(WindowSelectorItem* window) { 326 views::LabelButton* GetLabelButtonView(WindowSelectorItem* window) {
328 return window->window_label_button_view_; 327 return window->window_label_button_view_;
329 } 328 }
330 329
331 // Tests that a window is contained within a given WindowSelectorItem, and 330 // Tests that a window is contained within a given WindowSelectorItem, and
332 // that both the window and its matching close button are within the same 331 // that both the window and its matching close button are within the same
333 // screen. 332 // screen.
334 void IsWindowAndCloseButtonInScreen(aura::Window* window, 333 void IsWindowAndCloseButtonInScreen(aura::Window* window,
335 WindowSelectorItem* window_item) { 334 WindowSelectorItem* window_item) {
336 aura::Window* root_window = 335 aura::Window* root_window =
337 WmWindowAura::GetAuraWindow(window_item->root_window()); 336 WmWindow::GetAuraWindow(window_item->root_window());
338 EXPECT_TRUE(window_item->Contains(WmWindowAura::Get(window))); 337 EXPECT_TRUE(window_item->Contains(WmWindow::Get(window)));
339 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( 338 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains(
340 GetTransformedTargetBounds(window))); 339 GetTransformedTargetBounds(window)));
341 EXPECT_TRUE( 340 EXPECT_TRUE(
342 root_window->GetBoundsInScreen().Contains(GetTransformedTargetBounds( 341 root_window->GetBoundsInScreen().Contains(GetTransformedTargetBounds(
343 GetCloseButton(window_item)->GetNativeView()))); 342 GetCloseButton(window_item)->GetNativeView())));
344 } 343 }
345 344
346 void FilterItems(const base::StringPiece& pattern) { 345 void FilterItems(const base::StringPiece& pattern) {
347 window_selector()->ContentsChanged(nullptr, base::UTF8ToUTF16(pattern)); 346 window_selector()->ContentsChanged(nullptr, base::UTF8ToUTF16(pattern));
348 } 347 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED, 588 EXPECT_EQ(wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED,
590 wm::GetWindowState(docked2.get())->GetStateType()); 589 wm::GetWindowState(docked2.get())->GetStateType());
591 590
592 ToggleOverview(); 591 ToggleOverview();
593 592
594 EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get())); 593 EXPECT_FALSE(WindowsOverlapping(window1.get(), window2.get()));
595 594
596 gfx::Rect container_bounds = docked1->parent()->bounds(); 595 gfx::Rect container_bounds = docked1->parent()->bounds();
597 ShelfWidget* shelf = GetPrimaryShelf()->shelf_widget(); 596 ShelfWidget* shelf = GetPrimaryShelf()->shelf_widget();
598 DockedWindowLayoutManager* manager = 597 DockedWindowLayoutManager* manager =
599 DockedWindowLayoutManager::Get(WmWindowAura::Get(docked1.get())); 598 DockedWindowLayoutManager::Get(WmWindow::Get(docked1.get()));
600 599
601 // Minimized docked windows stays invisible. 600 // Minimized docked windows stays invisible.
602 EXPECT_FALSE(docked2->IsVisible()); 601 EXPECT_FALSE(docked2->IsVisible());
603 EXPECT_TRUE(GetOverviewWindowForMinimizedState(0, docked2.get())); 602 EXPECT_TRUE(GetOverviewWindowForMinimizedState(0, docked2.get()));
604 603
605 // Docked area shrinks. 604 // Docked area shrinks.
606 EXPECT_EQ(0, manager->docked_bounds().width()); 605 EXPECT_EQ(0, manager->docked_bounds().width());
607 606
608 // Work area takes the whole screen minus the shelf. 607 // Work area takes the whole screen minus the shelf.
609 gfx::Rect work_area = display::Screen::GetScreen() 608 gfx::Rect work_area = display::Screen::GetScreen()
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) { 1622 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) {
1624 gfx::Rect bounds(0, 0, 100, 100); 1623 gfx::Rect bounds(0, 0, 100, 100);
1625 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 1624 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
1626 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 1625 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
1627 ToggleOverview(); 1626 ToggleOverview();
1628 1627
1629 const std::vector<WindowSelectorItem*>& overview_windows = 1628 const std::vector<WindowSelectorItem*>& overview_windows =
1630 GetWindowItemsForRoot(0); 1629 GetWindowItemsForRoot(0);
1631 SendKey(ui::VKEY_TAB); 1630 SendKey(ui::VKEY_TAB);
1632 EXPECT_EQ(GetSelectedWindow(), 1631 EXPECT_EQ(GetSelectedWindow(),
1633 WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); 1632 WmWindow::GetAuraWindow(overview_windows[0]->GetWindow()));
1634 SendKey(ui::VKEY_TAB); 1633 SendKey(ui::VKEY_TAB);
1635 EXPECT_EQ(GetSelectedWindow(), 1634 EXPECT_EQ(GetSelectedWindow(),
1636 WmWindowAura::GetAuraWindow(overview_windows[1]->GetWindow())); 1635 WmWindow::GetAuraWindow(overview_windows[1]->GetWindow()));
1637 SendKey(ui::VKEY_TAB); 1636 SendKey(ui::VKEY_TAB);
1638 EXPECT_EQ(GetSelectedWindow(), 1637 EXPECT_EQ(GetSelectedWindow(),
1639 WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); 1638 WmWindow::GetAuraWindow(overview_windows[0]->GetWindow()));
1640 } 1639 }
1641 1640
1642 // Tests that pressing Ctrl+W while a window is selected in overview closes it. 1641 // Tests that pressing Ctrl+W while a window is selected in overview closes it.
1643 TEST_F(WindowSelectorTest, CloseWindowWithKey) { 1642 TEST_F(WindowSelectorTest, CloseWindowWithKey) {
1644 gfx::Rect bounds(0, 0, 100, 100); 1643 gfx::Rect bounds(0, 0, 100, 100);
1645 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 1644 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
1646 std::unique_ptr<views::Widget> widget = 1645 std::unique_ptr<views::Widget> widget =
1647 CreateWindowWidget(gfx::Rect(0, 0, 400, 400)); 1646 CreateWindowWidget(gfx::Rect(0, 0, 400, 400));
1648 aura::Window* window1 = widget->GetNativeWindow(); 1647 aura::Window* window1 = widget->GetNativeWindow();
1649 ToggleOverview(); 1648 ToggleOverview();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1)); 1703 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1));
1705 1704
1706 ToggleOverview(); 1705 ToggleOverview();
1707 1706
1708 const std::vector<WindowSelectorItem*>& overview_root1 = 1707 const std::vector<WindowSelectorItem*>& overview_root1 =
1709 GetWindowItemsForRoot(0); 1708 GetWindowItemsForRoot(0);
1710 const std::vector<WindowSelectorItem*>& overview_root2 = 1709 const std::vector<WindowSelectorItem*>& overview_root2 =
1711 GetWindowItemsForRoot(1); 1710 GetWindowItemsForRoot(1);
1712 SendKey(ui::VKEY_RIGHT); 1711 SendKey(ui::VKEY_RIGHT);
1713 EXPECT_EQ(GetSelectedWindow(), 1712 EXPECT_EQ(GetSelectedWindow(),
1714 WmWindowAura::GetAuraWindow(overview_root1[0]->GetWindow())); 1713 WmWindow::GetAuraWindow(overview_root1[0]->GetWindow()));
1715 SendKey(ui::VKEY_RIGHT); 1714 SendKey(ui::VKEY_RIGHT);
1716 EXPECT_EQ(GetSelectedWindow(), 1715 EXPECT_EQ(GetSelectedWindow(),
1717 WmWindowAura::GetAuraWindow(overview_root1[1]->GetWindow())); 1716 WmWindow::GetAuraWindow(overview_root1[1]->GetWindow()));
1718 SendKey(ui::VKEY_RIGHT); 1717 SendKey(ui::VKEY_RIGHT);
1719 EXPECT_EQ(GetSelectedWindow(), 1718 EXPECT_EQ(GetSelectedWindow(),
1720 WmWindowAura::GetAuraWindow(overview_root2[0]->GetWindow())); 1719 WmWindow::GetAuraWindow(overview_root2[0]->GetWindow()));
1721 SendKey(ui::VKEY_RIGHT); 1720 SendKey(ui::VKEY_RIGHT);
1722 EXPECT_EQ(GetSelectedWindow(), 1721 EXPECT_EQ(GetSelectedWindow(),
1723 WmWindowAura::GetAuraWindow(overview_root2[1]->GetWindow())); 1722 WmWindow::GetAuraWindow(overview_root2[1]->GetWindow()));
1724 } 1723 }
1725 1724
1726 // Tests first monitor when display order doesn't match left to right screen 1725 // Tests first monitor when display order doesn't match left to right screen
1727 // positions. 1726 // positions.
1728 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) { 1727 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) {
1729 if (!SupportsMultipleDisplays()) 1728 if (!SupportsMultipleDisplays())
1730 return; 1729 return;
1731 1730
1732 UpdateDisplay("400x400,400x400"); 1731 UpdateDisplay("400x400,400x400");
1733 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( 1732 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 ASSERT_TRUE(SelectWindow(window2.get())); 1821 ASSERT_TRUE(SelectWindow(window2.get()));
1823 SendKey(ui::VKEY_RETURN); 1822 SendKey(ui::VKEY_RETURN);
1824 EXPECT_FALSE(IsSelecting()); 1823 EXPECT_FALSE(IsSelecting());
1825 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); 1824 EXPECT_TRUE(wm::IsActiveWindow(window2.get()));
1826 } 1825 }
1827 1826
1828 // Tests that overview mode hides the callout widget. 1827 // Tests that overview mode hides the callout widget.
1829 TEST_F(WindowSelectorTest, WindowOverviewHidesCalloutWidgets) { 1828 TEST_F(WindowSelectorTest, WindowOverviewHidesCalloutWidgets) {
1830 std::unique_ptr<aura::Window> panel1( 1829 std::unique_ptr<aura::Window> panel1(
1831 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); 1830 CreatePanelWindow(gfx::Rect(0, 0, 100, 100)));
1832 WmWindow* wm_panel1 = WmWindowAura::Get(panel1.get()); 1831 WmWindow* wm_panel1 = WmWindow::Get(panel1.get());
1833 std::unique_ptr<aura::Window> panel2( 1832 std::unique_ptr<aura::Window> panel2(
1834 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); 1833 CreatePanelWindow(gfx::Rect(0, 0, 100, 100)));
1835 WmWindow* wm_panel2 = WmWindowAura::Get(panel2.get()); 1834 WmWindow* wm_panel2 = WmWindow::Get(panel2.get());
1836 PanelLayoutManager* panel_manager = PanelLayoutManager::Get(wm_panel1); 1835 PanelLayoutManager* panel_manager = PanelLayoutManager::Get(wm_panel1);
1837 1836
1838 // By default, panel callout widgets are visible. 1837 // By default, panel callout widgets are visible.
1839 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); 1838 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible());
1840 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); 1839 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible());
1841 1840
1842 // Toggling the overview should hide the callout widgets. 1841 // Toggling the overview should hide the callout widgets.
1843 ToggleOverview(); 1842 ToggleOverview();
1844 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); 1843 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible());
1845 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); 1844 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible());
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), 2129 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(),
2131 bounds.bottom() - transformed_rect.bottom(), 1); 2130 bounds.bottom() - transformed_rect.bottom(), 1);
2132 } 2131 }
2133 2132
2134 // Start dragging a window and activate overview mode. This test should not 2133 // Start dragging a window and activate overview mode. This test should not
2135 // crash or DCHECK inside aura::Window::StackChildRelativeTo(). 2134 // crash or DCHECK inside aura::Window::StackChildRelativeTo().
2136 TEST_F(WindowSelectorTest, OverviewWhileDragging) { 2135 TEST_F(WindowSelectorTest, OverviewWhileDragging) {
2137 const gfx::Rect bounds(10, 10, 100, 100); 2136 const gfx::Rect bounds(10, 10, 100, 100);
2138 std::unique_ptr<aura::Window> window(CreateWindow(bounds)); 2137 std::unique_ptr<aura::Window> window(CreateWindow(bounds));
2139 std::unique_ptr<WindowResizer> resizer( 2138 std::unique_ptr<WindowResizer> resizer(
2140 CreateWindowResizer(WmWindowAura::Get(window.get()), gfx::Point(), 2139 CreateWindowResizer(WmWindow::Get(window.get()), gfx::Point(), HTCAPTION,
2141 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 2140 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
2142 ASSERT_TRUE(resizer.get()); 2141 ASSERT_TRUE(resizer.get());
2143 gfx::Point location = resizer->GetInitialLocation(); 2142 gfx::Point location = resizer->GetInitialLocation();
2144 location.Offset(20, 20); 2143 location.Offset(20, 20);
2145 resizer->Drag(location, 0); 2144 resizer->Drag(location, 0);
2146 ToggleOverview(); 2145 ToggleOverview();
2147 resizer->RevertDrag(); 2146 resizer->RevertDrag();
2148 } 2147 }
2149 2148
2150 } // namespace ash 2149 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/scoped_overview_animation_settings_factory_aura.cc ('k') | ash/wm/panels/attached_panel_window_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698