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

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

Issue 2720913003: Calls display_configuration_controller to rotate screen in accelerator_controller_delegate_aura (Closed)
Patch Set: Calls display_configuration_controller to rotate screen in accelerator_controller_delegate_aura Created 3 years, 9 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/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/common/accelerators/accelerator_table.h" 7 #include "ash/common/accelerators/accelerator_table.h"
8 #include "ash/common/accessibility_delegate.h" 8 #include "ash/common/accessibility_delegate.h"
9 #include "ash/common/accessibility_types.h" 9 #include "ash/common/accessibility_types.h"
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 520 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
521 WmWindow::Get(window.get())); 521 WmWindow::Get(window.get()));
522 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); 522 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
523 // Snap left again ->> becomes normal. 523 // Snap left again ->> becomes normal.
524 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 524 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
525 EXPECT_TRUE(window_state->IsNormalStateType()); 525 EXPECT_TRUE(window_state->IsNormalStateType());
526 EXPECT_FALSE(window_state->IsDocked()); 526 EXPECT_FALSE(window_state->IsDocked());
527 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); 527 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString());
528 } 528 }
529 529
530 TEST_F(AcceleratorControllerTest, RotateScreen) {
bruthig 2017/02/28 22:49:22 Very nice test!
531 if (WmShell::Get()->IsRunningInMash())
532 return;
533
534 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
535 display::Display::Rotation initial_rotation =
536 GetActiveDisplayRotation(display.id());
537 ui::test::EventGenerator& generator = GetEventGenerator();
538 generator.PressKey(ui::VKEY_BROWSER_REFRESH,
539 ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
540 generator.ReleaseKey(ui::VKEY_BROWSER_REFRESH,
541 ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
542 display::Display::Rotation new_rotation =
543 GetActiveDisplayRotation(display.id());
544 // |new_rotation| is determined by the AcceleratorControllerDelegate.
545 EXPECT_NE(initial_rotation, new_rotation);
546 }
547
530 // Test class used for testing docked windows. 548 // Test class used for testing docked windows.
531 class EnabledDockedWindowsAcceleratorControllerTest 549 class EnabledDockedWindowsAcceleratorControllerTest
532 : public AcceleratorControllerTest { 550 : public AcceleratorControllerTest {
533 public: 551 public:
534 EnabledDockedWindowsAcceleratorControllerTest() = default; 552 EnabledDockedWindowsAcceleratorControllerTest() = default;
535 ~EnabledDockedWindowsAcceleratorControllerTest() override = default; 553 ~EnabledDockedWindowsAcceleratorControllerTest() override = default;
536 554
537 void SetUp() override { 555 void SetUp() override {
538 base::CommandLine::ForCurrentProcess()->AppendSwitch( 556 base::CommandLine::ForCurrentProcess()->AppendSwitch(
539 ash::switches::kAshEnableDockedWindows); 557 ash::switches::kAshEnableDockedWindows);
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 // Expect no notifications from the new accelerators. 1565 // Expect no notifications from the new accelerators.
1548 EXPECT_TRUE(IsMessageCenterEmpty()); 1566 EXPECT_TRUE(IsMessageCenterEmpty());
1549 1567
1550 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1568 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1551 // screen before we proceed testing the rest of accelerators. 1569 // screen before we proceed testing the rest of accelerators.
1552 ResetStateIfNeeded(); 1570 ResetStateIfNeeded();
1553 } 1571 }
1554 } 1572 }
1555 1573
1556 } // namespace ash 1574 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698