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

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

Issue 557693002: [Ash] Only snap windows that can maximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up other tests. Created 6 years, 3 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) 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/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 const ui::Accelerator accelerator_shift_a(ui::VKEY_A, ui::EF_SHIFT_DOWN); 416 const ui::Accelerator accelerator_shift_a(ui::VKEY_A, ui::EF_SHIFT_DOWN);
417 TestTarget target; 417 TestTarget target;
418 GetController()->Register(accelerator_a, &target); 418 GetController()->Register(accelerator_a, &target);
419 EXPECT_TRUE(GetController()->IsRegistered(accelerator_a)); 419 EXPECT_TRUE(GetController()->IsRegistered(accelerator_a));
420 EXPECT_FALSE(GetController()->IsRegistered(accelerator_shift_a)); 420 EXPECT_FALSE(GetController()->IsRegistered(accelerator_shift_a));
421 GetController()->UnregisterAll(&target); 421 GetController()->UnregisterAll(&target);
422 EXPECT_FALSE(GetController()->IsRegistered(accelerator_a)); 422 EXPECT_FALSE(GetController()->IsRegistered(accelerator_a));
423 } 423 }
424 424
425 TEST_F(AcceleratorControllerTest, WindowSnap) { 425 TEST_F(AcceleratorControllerTest, WindowSnap) {
426 scoped_ptr<aura::Window> window( 426 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
427 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 427 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(),
428 0,
429 gfx::Rect(5, 5, 20, 20)));
428 const ui::Accelerator dummy; 430 const ui::Accelerator dummy;
429 431
430 wm::WindowState* window_state = wm::GetWindowState(window.get()); 432 wm::WindowState* window_state = wm::GetWindowState(window.get());
431 433
432 window_state->Activate(); 434 window_state->Activate();
433 435
434 { 436 {
435 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy); 437 GetController()->PerformAction(WINDOW_SNAP_LEFT, dummy);
436 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 438 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
437 window.get()); 439 window.get());
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 1246 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
1245 wm::ActivateWindow(window.get()); 1247 wm::ActivateWindow(window.get());
1246 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); 1248 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1247 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1249 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1248 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1250 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1249 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); 1251 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
1250 } 1252 }
1251 } 1253 }
1252 1254
1253 } // namespace ash 1255 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_controller_unittest.cc » ('j') | ash/display/display_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698