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

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: Last patch for commit 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) {
531 // TODO: needs GetDisplayInfo http://crbug.com/622480.
532 if (WmShell::Get()->IsRunningInMash())
533 return;
534
535 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
536 display::Display::Rotation initial_rotation =
537 GetActiveDisplayRotation(display.id());
538 ui::test::EventGenerator& generator = GetEventGenerator();
539 generator.PressKey(ui::VKEY_BROWSER_REFRESH,
540 ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
541 generator.ReleaseKey(ui::VKEY_BROWSER_REFRESH,
542 ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
543 display::Display::Rotation new_rotation =
544 GetActiveDisplayRotation(display.id());
545 // |new_rotation| is determined by the AcceleratorControllerDelegate.
546 EXPECT_NE(initial_rotation, new_rotation);
547 }
548
530 // Test class used for testing docked windows. 549 // Test class used for testing docked windows.
531 class EnabledDockedWindowsAcceleratorControllerTest 550 class EnabledDockedWindowsAcceleratorControllerTest
532 : public AcceleratorControllerTest { 551 : public AcceleratorControllerTest {
533 public: 552 public:
534 EnabledDockedWindowsAcceleratorControllerTest() = default; 553 EnabledDockedWindowsAcceleratorControllerTest() = default;
535 ~EnabledDockedWindowsAcceleratorControllerTest() override = default; 554 ~EnabledDockedWindowsAcceleratorControllerTest() override = default;
536 555
537 void SetUp() override { 556 void SetUp() override {
538 base::CommandLine::ForCurrentProcess()->AppendSwitch( 557 base::CommandLine::ForCurrentProcess()->AppendSwitch(
539 ash::switches::kAshEnableDockedWindows); 558 ash::switches::kAshEnableDockedWindows);
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 // Expect no notifications from the new accelerators. 1566 // Expect no notifications from the new accelerators.
1548 EXPECT_TRUE(IsMessageCenterEmpty()); 1567 EXPECT_TRUE(IsMessageCenterEmpty());
1549 1568
1550 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1569 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1551 // screen before we proceed testing the rest of accelerators. 1570 // screen before we proceed testing the rest of accelerators.
1552 ResetStateIfNeeded(); 1571 ResetStateIfNeeded();
1553 } 1572 }
1554 } 1573 }
1555 1574
1556 } // namespace ash 1575 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller_delegate_aura.cc ('k') | ash/display/display_configuration_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698