| OLD | NEW |
| 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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 11 #include "ash/common/wm/panels/panel_layout_manager.h" | 12 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 12 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
| 14 #include "ash/drag_drop/drag_drop_controller.h" | 15 #include "ash/drag_drop/drag_drop_controller.h" |
| 15 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| 16 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
| 17 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
| 18 #include "ash/shelf/shelf_widget.h" | 19 #include "ash/shelf/shelf_widget.h" |
| 19 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 20 #include "ash/test/ash_test_base.h" | 21 #include "ash/test/ash_test_base.h" |
| 21 #include "ash/test/display_manager_test_api.h" | 22 #include "ash/test/display_manager_test_api.h" |
| 22 #include "ash/test/shelf_test_api.h" | 23 #include "ash/test/shelf_test_api.h" |
| 23 #include "ash/test/shelf_view_test_api.h" | 24 #include "ash/test/shelf_view_test_api.h" |
| 24 #include "ash/test/shell_test_api.h" | 25 #include "ash/test/shell_test_api.h" |
| 25 #include "ash/test/test_shelf_delegate.h" | 26 #include "ash/test/test_shelf_delegate.h" |
| 26 #include "ash/wm/aura/wm_window_aura.h" | |
| 27 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 27 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 28 #include "ash/wm/mru_window_tracker.h" | 28 #include "ash/wm/mru_window_tracker.h" |
| 29 #include "ash/wm/overview/window_grid.h" | 29 #include "ash/wm/overview/window_grid.h" |
| 30 #include "ash/wm/overview/window_selector.h" | 30 #include "ash/wm/overview/window_selector.h" |
| 31 #include "ash/wm/overview/window_selector_controller.h" | 31 #include "ash/wm/overview/window_selector_controller.h" |
| 32 #include "ash/wm/overview/window_selector_item.h" | 32 #include "ash/wm/overview/window_selector_item.h" |
| 33 #include "ash/wm/window_state_aura.h" | 33 #include "ash/wm/window_state_aura.h" |
| 34 #include "ash/wm/window_util.h" | 34 #include "ash/wm/window_util.h" |
| 35 #include "base/command_line.h" | 35 #include "base/command_line.h" |
| 36 #include "base/compiler_specific.h" | 36 #include "base/compiler_specific.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { | 208 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { |
| 209 return ash::Shell::GetInstance()->window_selector_controller()-> | 209 return ash::Shell::GetInstance()->window_selector_controller()-> |
| 210 window_selector_->grid_list_[index]->window_list_.get(); | 210 window_selector_->grid_list_[index]->window_list_.get(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 WindowSelectorItem* GetWindowItemForWindow(int grid_index, | 213 WindowSelectorItem* GetWindowItemForWindow(int grid_index, |
| 214 aura::Window* window) { | 214 aura::Window* window) { |
| 215 const std::vector<WindowSelectorItem*>& windows = | 215 const std::vector<WindowSelectorItem*>& windows = |
| 216 GetWindowItemsForRoot(grid_index); | 216 GetWindowItemsForRoot(grid_index); |
| 217 auto iter = | 217 auto iter = std::find_if(windows.cbegin(), windows.cend(), |
| 218 std::find_if(windows.cbegin(), windows.cend(), | 218 [window](const WindowSelectorItem* item) { |
| 219 [window](const WindowSelectorItem* item) { | 219 return item->Contains(WmWindowAura::Get(window)); |
| 220 return item->Contains(wm::WmWindowAura::Get(window)); | 220 }); |
| 221 }); | |
| 222 if (iter == windows.end()) | 221 if (iter == windows.end()) |
| 223 return nullptr; | 222 return nullptr; |
| 224 return *iter; | 223 return *iter; |
| 225 } | 224 } |
| 226 | 225 |
| 227 // Selects |window| in the active overview session by cycling through all | 226 // Selects |window| in the active overview session by cycling through all |
| 228 // windows in overview until it is found. Returns true if |window| was found, | 227 // windows in overview until it is found. Returns true if |window| was found, |
| 229 // false otherwise. | 228 // false otherwise. |
| 230 bool SelectWindow(const aura::Window* window) { | 229 bool SelectWindow(const aura::Window* window) { |
| 231 if (GetSelectedWindow() == nullptr) | 230 if (GetSelectedWindow() == nullptr) |
| 232 SendKey(ui::VKEY_TAB); | 231 SendKey(ui::VKEY_TAB); |
| 233 const aura::Window* start_window = GetSelectedWindow(); | 232 const aura::Window* start_window = GetSelectedWindow(); |
| 234 if (start_window == window) | 233 if (start_window == window) |
| 235 return true; | 234 return true; |
| 236 do { | 235 do { |
| 237 SendKey(ui::VKEY_TAB); | 236 SendKey(ui::VKEY_TAB); |
| 238 } while (GetSelectedWindow() != window && | 237 } while (GetSelectedWindow() != window && |
| 239 GetSelectedWindow() != start_window); | 238 GetSelectedWindow() != start_window); |
| 240 return GetSelectedWindow() == window; | 239 return GetSelectedWindow() == window; |
| 241 } | 240 } |
| 242 | 241 |
| 243 const aura::Window* GetSelectedWindow() { | 242 const aura::Window* GetSelectedWindow() { |
| 244 WindowSelector* ws = ash::Shell::GetInstance()-> | 243 WindowSelector* ws = ash::Shell::GetInstance()-> |
| 245 window_selector_controller()->window_selector_.get(); | 244 window_selector_controller()->window_selector_.get(); |
| 246 WindowSelectorItem* item = | 245 WindowSelectorItem* item = |
| 247 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow(); | 246 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow(); |
| 248 if (!item) | 247 if (!item) |
| 249 return nullptr; | 248 return nullptr; |
| 250 return wm::WmWindowAura::GetAuraWindow(item->GetWindow()); | 249 return WmWindowAura::GetAuraWindow(item->GetWindow()); |
| 251 } | 250 } |
| 252 | 251 |
| 253 bool selection_widget_active() { | 252 bool selection_widget_active() { |
| 254 WindowSelector* ws = ash::Shell::GetInstance()-> | 253 WindowSelector* ws = ash::Shell::GetInstance()-> |
| 255 window_selector_controller()->window_selector_.get(); | 254 window_selector_controller()->window_selector_.get(); |
| 256 return ws->grid_list_[ws->selected_grid_index_]->is_selecting(); | 255 return ws->grid_list_[ws->selected_grid_index_]->is_selecting(); |
| 257 } | 256 } |
| 258 | 257 |
| 259 bool showing_filter_widget() { | 258 bool showing_filter_widget() { |
| 260 WindowSelector* ws = ash::Shell::GetInstance()-> | 259 WindowSelector* ws = ash::Shell::GetInstance()-> |
| 261 window_selector_controller()->window_selector_.get(); | 260 window_selector_controller()->window_selector_.get(); |
| 262 return ws->text_filter_widget_->GetNativeWindow()->layer()-> | 261 return ws->text_filter_widget_->GetNativeWindow()->layer()-> |
| 263 GetTargetTransform().IsIdentity(); | 262 GetTargetTransform().IsIdentity(); |
| 264 } | 263 } |
| 265 | 264 |
| 266 views::Widget* GetCloseButton(ash::WindowSelectorItem* window) { | 265 views::Widget* GetCloseButton(ash::WindowSelectorItem* window) { |
| 267 return &(window->close_button_widget_); | 266 return &(window->close_button_widget_); |
| 268 } | 267 } |
| 269 | 268 |
| 270 views::LabelButton* GetLabelButtonView(ash::WindowSelectorItem* window) { | 269 views::LabelButton* GetLabelButtonView(ash::WindowSelectorItem* window) { |
| 271 return window->window_label_button_view_; | 270 return window->window_label_button_view_; |
| 272 } | 271 } |
| 273 | 272 |
| 274 // Tests that a window is contained within a given WindowSelectorItem, and | 273 // Tests that a window is contained within a given WindowSelectorItem, and |
| 275 // that both the window and its matching close button are within the same | 274 // that both the window and its matching close button are within the same |
| 276 // screen. | 275 // screen. |
| 277 void IsWindowAndCloseButtonInScreen(aura::Window* window, | 276 void IsWindowAndCloseButtonInScreen(aura::Window* window, |
| 278 WindowSelectorItem* window_item) { | 277 WindowSelectorItem* window_item) { |
| 279 aura::Window* root_window = | 278 aura::Window* root_window = |
| 280 wm::WmWindowAura::GetAuraWindow(window_item->root_window()); | 279 WmWindowAura::GetAuraWindow(window_item->root_window()); |
| 281 EXPECT_TRUE(window_item->Contains(wm::WmWindowAura::Get(window))); | 280 EXPECT_TRUE(window_item->Contains(WmWindowAura::Get(window))); |
| 282 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( | 281 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( |
| 283 ToEnclosingRect(GetTransformedTargetBounds(window)))); | 282 ToEnclosingRect(GetTransformedTargetBounds(window)))); |
| 284 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( | 283 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( |
| 285 ToEnclosingRect(GetTransformedTargetBounds( | 284 ToEnclosingRect(GetTransformedTargetBounds( |
| 286 GetCloseButton(window_item)->GetNativeView())))); | 285 GetCloseButton(window_item)->GetNativeView())))); |
| 287 } | 286 } |
| 288 | 287 |
| 289 void FilterItems(const base::StringPiece& pattern) { | 288 void FilterItems(const base::StringPiece& pattern) { |
| 290 ash::Shell::GetInstance()-> | 289 ash::Shell::GetInstance()-> |
| 291 window_selector_controller()->window_selector_.get()-> | 290 window_selector_controller()->window_selector_.get()-> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 410 |
| 412 // Tests that the ordering of windows is near the windows' original positions. | 411 // Tests that the ordering of windows is near the windows' original positions. |
| 413 TEST_F(WindowSelectorTest, MinimizeMovement) { | 412 TEST_F(WindowSelectorTest, MinimizeMovement) { |
| 414 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 413 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 415 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2, | 414 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2, |
| 416 root_window->bounds().height()); | 415 root_window->bounds().height()); |
| 417 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0, | 416 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0, |
| 418 root_window->bounds().width() / 2, | 417 root_window->bounds().width() / 2, |
| 419 root_window->bounds().height()); | 418 root_window->bounds().height()); |
| 420 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); | 419 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); |
| 421 wm::WmWindow* left_window_wm = wm::WmWindowAura::Get(left_window.get()); | 420 WmWindow* left_window_wm = WmWindowAura::Get(left_window.get()); |
| 422 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); | 421 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); |
| 423 wm::WmWindow* right_window_wm = wm::WmWindowAura::Get(right_window.get()); | 422 WmWindow* right_window_wm = WmWindowAura::Get(right_window.get()); |
| 424 | 423 |
| 425 // The window should stay on the same side of the screen regardless of which | 424 // The window should stay on the same side of the screen regardless of which |
| 426 // one was active on entering overview mode. | 425 // one was active on entering overview mode. |
| 427 wm::GetWindowState(left_window.get())->Activate(); | 426 wm::GetWindowState(left_window.get())->Activate(); |
| 428 ToggleOverview(); | 427 ToggleOverview(); |
| 429 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); | 428 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); |
| 430 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm); | 429 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm); |
| 431 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm); | 430 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm); |
| 432 ToggleOverview(); | 431 ToggleOverview(); |
| 433 | 432 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 453 // on a second display. | 452 // on a second display. |
| 454 TEST_F(WindowSelectorTest, MinimizeMovementSecondDisplay) { | 453 TEST_F(WindowSelectorTest, MinimizeMovementSecondDisplay) { |
| 455 if (!SupportsMultipleDisplays()) | 454 if (!SupportsMultipleDisplays()) |
| 456 return; | 455 return; |
| 457 | 456 |
| 458 // Verify the same works on the second display | 457 // Verify the same works on the second display |
| 459 UpdateDisplay("400x400,400x400"); | 458 UpdateDisplay("400x400,400x400"); |
| 460 gfx::Rect left_bounds(400, 0, 200, 400); | 459 gfx::Rect left_bounds(400, 0, 200, 400); |
| 461 gfx::Rect right_bounds(600, 0, 200, 400); | 460 gfx::Rect right_bounds(600, 0, 200, 400); |
| 462 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); | 461 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); |
| 463 wm::WmWindow* left_window_wm = wm::WmWindowAura::Get(left_window.get()); | 462 WmWindow* left_window_wm = WmWindowAura::Get(left_window.get()); |
| 464 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); | 463 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); |
| 465 wm::WmWindow* right_window_wm = wm::WmWindowAura::Get(right_window.get()); | 464 WmWindow* right_window_wm = WmWindowAura::Get(right_window.get()); |
| 466 | 465 |
| 467 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 466 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 468 EXPECT_EQ(root_windows[1], left_window->GetRootWindow()); | 467 EXPECT_EQ(root_windows[1], left_window->GetRootWindow()); |
| 469 EXPECT_EQ(root_windows[1], right_window->GetRootWindow()); | 468 EXPECT_EQ(root_windows[1], right_window->GetRootWindow()); |
| 470 | 469 |
| 471 wm::GetWindowState(left_window.get())->Activate(); | 470 wm::GetWindowState(left_window.get())->Activate(); |
| 472 ToggleOverview(); | 471 ToggleOverview(); |
| 473 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); | 472 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); |
| 474 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm); | 473 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm); |
| 475 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm); | 474 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm); |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) { | 1290 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) { |
| 1292 gfx::Rect bounds(0, 0, 100, 100); | 1291 gfx::Rect bounds(0, 0, 100, 100); |
| 1293 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | 1292 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
| 1294 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 1293 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 1295 ToggleOverview(); | 1294 ToggleOverview(); |
| 1296 | 1295 |
| 1297 const std::vector<WindowSelectorItem*>& overview_windows = | 1296 const std::vector<WindowSelectorItem*>& overview_windows = |
| 1298 GetWindowItemsForRoot(0); | 1297 GetWindowItemsForRoot(0); |
| 1299 SendKey(ui::VKEY_TAB); | 1298 SendKey(ui::VKEY_TAB); |
| 1300 EXPECT_EQ(GetSelectedWindow(), | 1299 EXPECT_EQ(GetSelectedWindow(), |
| 1301 wm::WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); | 1300 WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); |
| 1302 SendKey(ui::VKEY_TAB); | 1301 SendKey(ui::VKEY_TAB); |
| 1303 EXPECT_EQ(GetSelectedWindow(), | 1302 EXPECT_EQ(GetSelectedWindow(), |
| 1304 wm::WmWindowAura::GetAuraWindow(overview_windows[1]->GetWindow())); | 1303 WmWindowAura::GetAuraWindow(overview_windows[1]->GetWindow())); |
| 1305 SendKey(ui::VKEY_TAB); | 1304 SendKey(ui::VKEY_TAB); |
| 1306 EXPECT_EQ(GetSelectedWindow(), | 1305 EXPECT_EQ(GetSelectedWindow(), |
| 1307 wm::WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); | 1306 WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow())); |
| 1308 } | 1307 } |
| 1309 | 1308 |
| 1310 // Tests traversing some windows in overview mode with the arrow keys in every | 1309 // Tests traversing some windows in overview mode with the arrow keys in every |
| 1311 // possible direction. | 1310 // possible direction. |
| 1312 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { | 1311 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { |
| 1313 if (!SupportsHostWindowResize()) | 1312 if (!SupportsHostWindowResize()) |
| 1314 return; | 1313 return; |
| 1315 const size_t test_windows = 9; | 1314 const size_t test_windows = 9; |
| 1316 UpdateDisplay("800x600"); | 1315 UpdateDisplay("800x600"); |
| 1317 ScopedVector<aura::Window> windows; | 1316 ScopedVector<aura::Window> windows; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1)); | 1374 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1)); |
| 1376 | 1375 |
| 1377 ToggleOverview(); | 1376 ToggleOverview(); |
| 1378 | 1377 |
| 1379 const std::vector<WindowSelectorItem*>& overview_root1 = | 1378 const std::vector<WindowSelectorItem*>& overview_root1 = |
| 1380 GetWindowItemsForRoot(0); | 1379 GetWindowItemsForRoot(0); |
| 1381 const std::vector<WindowSelectorItem*>& overview_root2 = | 1380 const std::vector<WindowSelectorItem*>& overview_root2 = |
| 1382 GetWindowItemsForRoot(1); | 1381 GetWindowItemsForRoot(1); |
| 1383 SendKey(ui::VKEY_RIGHT); | 1382 SendKey(ui::VKEY_RIGHT); |
| 1384 EXPECT_EQ(GetSelectedWindow(), | 1383 EXPECT_EQ(GetSelectedWindow(), |
| 1385 wm::WmWindowAura::GetAuraWindow(overview_root1[0]->GetWindow())); | 1384 WmWindowAura::GetAuraWindow(overview_root1[0]->GetWindow())); |
| 1386 SendKey(ui::VKEY_RIGHT); | 1385 SendKey(ui::VKEY_RIGHT); |
| 1387 EXPECT_EQ(GetSelectedWindow(), | 1386 EXPECT_EQ(GetSelectedWindow(), |
| 1388 wm::WmWindowAura::GetAuraWindow(overview_root1[1]->GetWindow())); | 1387 WmWindowAura::GetAuraWindow(overview_root1[1]->GetWindow())); |
| 1389 SendKey(ui::VKEY_RIGHT); | 1388 SendKey(ui::VKEY_RIGHT); |
| 1390 EXPECT_EQ(GetSelectedWindow(), | 1389 EXPECT_EQ(GetSelectedWindow(), |
| 1391 wm::WmWindowAura::GetAuraWindow(overview_root2[0]->GetWindow())); | 1390 WmWindowAura::GetAuraWindow(overview_root2[0]->GetWindow())); |
| 1392 SendKey(ui::VKEY_RIGHT); | 1391 SendKey(ui::VKEY_RIGHT); |
| 1393 EXPECT_EQ(GetSelectedWindow(), | 1392 EXPECT_EQ(GetSelectedWindow(), |
| 1394 wm::WmWindowAura::GetAuraWindow(overview_root2[1]->GetWindow())); | 1393 WmWindowAura::GetAuraWindow(overview_root2[1]->GetWindow())); |
| 1395 } | 1394 } |
| 1396 | 1395 |
| 1397 // Tests first monitor when display order doesn't match left to right screen | 1396 // Tests first monitor when display order doesn't match left to right screen |
| 1398 // positions. | 1397 // positions. |
| 1399 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) { | 1398 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) { |
| 1400 if (!SupportsMultipleDisplays()) | 1399 if (!SupportsMultipleDisplays()) |
| 1401 return; | 1400 return; |
| 1402 | 1401 |
| 1403 UpdateDisplay("400x400,400x400"); | 1402 UpdateDisplay("400x400,400x400"); |
| 1404 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 1403 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 ASSERT_TRUE(SelectWindow(window2.get())); | 1491 ASSERT_TRUE(SelectWindow(window2.get())); |
| 1493 SendKey(ui::VKEY_RETURN); | 1492 SendKey(ui::VKEY_RETURN); |
| 1494 EXPECT_FALSE(IsSelecting()); | 1493 EXPECT_FALSE(IsSelecting()); |
| 1495 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); | 1494 EXPECT_TRUE(wm::IsActiveWindow(window2.get())); |
| 1496 } | 1495 } |
| 1497 | 1496 |
| 1498 // Tests that overview mode hides the callout widget. | 1497 // Tests that overview mode hides the callout widget. |
| 1499 TEST_F(WindowSelectorTest, WindowOverviewHidesCalloutWidgets) { | 1498 TEST_F(WindowSelectorTest, WindowOverviewHidesCalloutWidgets) { |
| 1500 std::unique_ptr<aura::Window> panel1( | 1499 std::unique_ptr<aura::Window> panel1( |
| 1501 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); | 1500 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); |
| 1502 wm::WmWindow* wm_panel1 = wm::WmWindowAura::Get(panel1.get()); | 1501 WmWindow* wm_panel1 = WmWindowAura::Get(panel1.get()); |
| 1503 std::unique_ptr<aura::Window> panel2( | 1502 std::unique_ptr<aura::Window> panel2( |
| 1504 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); | 1503 CreatePanelWindow(gfx::Rect(0, 0, 100, 100))); |
| 1505 wm::WmWindow* wm_panel2 = wm::WmWindowAura::Get(panel2.get()); | 1504 WmWindow* wm_panel2 = WmWindowAura::Get(panel2.get()); |
| 1506 PanelLayoutManager* panel_manager = PanelLayoutManager::Get(wm_panel1); | 1505 PanelLayoutManager* panel_manager = PanelLayoutManager::Get(wm_panel1); |
| 1507 | 1506 |
| 1508 // By default, panel callout widgets are visible. | 1507 // By default, panel callout widgets are visible. |
| 1509 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); | 1508 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); |
| 1510 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); | 1509 EXPECT_TRUE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); |
| 1511 | 1510 |
| 1512 // Toggling the overview should hide the callout widgets. | 1511 // Toggling the overview should hide the callout widgets. |
| 1513 ToggleOverview(); | 1512 ToggleOverview(); |
| 1514 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); | 1513 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel1)->IsVisible()); |
| 1515 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); | 1514 EXPECT_FALSE(panel_manager->GetCalloutWidgetForPanel(wm_panel2)->IsVisible()); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 bounds.y()); | 1729 bounds.y()); |
| 1731 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 1730 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
| 1732 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 1731 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
| 1733 bounds.right() - transformed_rect.right(), 1); | 1732 bounds.right() - transformed_rect.right(), 1); |
| 1734 EXPECT_NEAR( | 1733 EXPECT_NEAR( |
| 1735 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 1734 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
| 1736 bounds.bottom() - transformed_rect.bottom(), 1); | 1735 bounds.bottom() - transformed_rect.bottom(), 1); |
| 1737 } | 1736 } |
| 1738 | 1737 |
| 1739 } // namespace ash | 1738 } // namespace ash |
| OLD | NEW |