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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 2897993003: chromeos: converts WindowResizer to aura::Window (Closed)
Patch Set: remove include from exo Created 3 years, 7 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 | « no previous file | ash/frame/caption_buttons/frame_size_button.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
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/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 TEST_F(AcceleratorControllerTest, WindowSnap) { 427 TEST_F(AcceleratorControllerTest, WindowSnap) {
428 std::unique_ptr<aura::Window> window( 428 std::unique_ptr<aura::Window> window(
429 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 429 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
430 wm::WindowState* window_state = wm::GetWindowState(window.get()); 430 wm::WindowState* window_state = wm::GetWindowState(window.get());
431 431
432 window_state->Activate(); 432 window_state->Activate();
433 433
434 { 434 {
435 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT); 435 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT);
436 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 436 gfx::Rect expected_bounds =
437 WmWindow::Get(window.get())); 437 wm::GetDefaultLeftSnappedWindowBoundsInParent(window.get());
438 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); 438 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
439 } 439 }
440 { 440 {
441 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT); 441 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT);
442 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( 442 gfx::Rect expected_bounds =
443 WmWindow::Get(window.get())); 443 wm::GetDefaultRightSnappedWindowBoundsInParent(window.get());
444 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); 444 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
445 } 445 }
446 { 446 {
447 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); 447 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent();
448 448
449 GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); 449 GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED);
450 EXPECT_TRUE(window_state->IsMaximized()); 450 EXPECT_TRUE(window_state->IsMaximized());
451 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); 451 EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString());
452 452
453 GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); 453 GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED);
(...skipping 28 matching lines...) Expand all
482 TEST_F(AcceleratorControllerTest, TestRepeatedSnap) { 482 TEST_F(AcceleratorControllerTest, TestRepeatedSnap) {
483 std::unique_ptr<aura::Window> window( 483 std::unique_ptr<aura::Window> window(
484 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 484 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
485 485
486 wm::WindowState* window_state = wm::GetWindowState(window.get()); 486 wm::WindowState* window_state = wm::GetWindowState(window.get());
487 window_state->Activate(); 487 window_state->Activate();
488 488
489 // Snap right. 489 // Snap right.
490 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT); 490 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT);
491 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); 491 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent();
492 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( 492 gfx::Rect expected_bounds =
493 WmWindow::Get(window.get())); 493 wm::GetDefaultRightSnappedWindowBoundsInParent(window.get());
494 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); 494 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
495 EXPECT_TRUE(window_state->IsSnapped()); 495 EXPECT_TRUE(window_state->IsSnapped());
496 // Snap right again ->> becomes normal. 496 // Snap right again ->> becomes normal.
497 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT); 497 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT);
498 EXPECT_TRUE(window_state->IsNormalStateType()); 498 EXPECT_TRUE(window_state->IsNormalStateType());
499 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); 499 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString());
500 // Snap right. 500 // Snap right.
501 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT); 501 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_RIGHT);
502 EXPECT_TRUE(window_state->IsSnapped()); 502 EXPECT_TRUE(window_state->IsSnapped());
503 // Snap left. 503 // Snap left.
504 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT); 504 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT);
505 EXPECT_TRUE(window_state->IsSnapped()); 505 EXPECT_TRUE(window_state->IsSnapped());
506 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 506 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(window.get());
507 WmWindow::Get(window.get()));
508 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); 507 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
509 // Snap left again ->> becomes normal. 508 // Snap left again ->> becomes normal.
510 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT); 509 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_LEFT);
511 EXPECT_TRUE(window_state->IsNormalStateType()); 510 EXPECT_TRUE(window_state->IsNormalStateType());
512 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); 511 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString());
513 } 512 }
514 513
515 TEST_F(AcceleratorControllerTest, RotateScreen) { 514 TEST_F(AcceleratorControllerTest, RotateScreen) {
516 // TODO: needs GetDisplayInfo http://crbug.com/622480. 515 // TODO: needs GetDisplayInfo http://crbug.com/622480.
517 if (Shell::GetAshConfig() == Config::MASH) 516 if (Shell::GetAshConfig() == Config::MASH)
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 // Expect no notifications from the new accelerators. 1360 // Expect no notifications from the new accelerators.
1362 EXPECT_TRUE(IsMessageCenterEmpty()); 1361 EXPECT_TRUE(IsMessageCenterEmpty());
1363 1362
1364 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1363 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1365 // screen before we proceed testing the rest of accelerators. 1364 // screen before we proceed testing the rest of accelerators.
1366 ResetStateIfNeeded(); 1365 ResetStateIfNeeded();
1367 } 1366 }
1368 } 1367 }
1369 1368
1370 } // namespace ash 1369 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/frame/caption_buttons/frame_size_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698