Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) { | |
|
afakhry
2017/02/28 02:51:53
You probably need to disable this test on mash_uni
wutao
2017/02/28 20:29:09
Done.
| |
| 531 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 532 // Will it alway return a valid primary display? | |
|
bruthig
2017/02/28 19:11:46
I believe you can assume GetPrimaryDisplay() will
wutao
2017/02/28 20:29:09
Removed the check.
| |
| 533 if (!display.is_valid()) | |
| 534 return; | |
| 535 | |
| 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 depends on the implementation of GetNextRotation in | |
|
bruthig
2017/02/28 19:11:47
nit: replace 'new_rotation' with '|new_rotation|'
wutao
2017/02/28 20:29:09
Done.
| |
| 546 // accelerator_controller_delegate_aura.cc and the initial rotation | |
|
bruthig
2017/02/28 19:11:47
nit:
- You don't need to specifically call out the
wutao
2017/02/28 20:29:09
Done.
| |
| 547 // The best test here is to check they are not equal. | |
|
bruthig
2017/02/28 19:11:47
nit: This comment isn't necessary.
wutao
2017/02/28 20:29:09
Done.
| |
| 548 EXPECT_NE(initial_rotation, new_rotation); | |
| 549 } | |
| 550 | |
| 530 // Test class used for testing docked windows. | 551 // Test class used for testing docked windows. |
| 531 class EnabledDockedWindowsAcceleratorControllerTest | 552 class EnabledDockedWindowsAcceleratorControllerTest |
| 532 : public AcceleratorControllerTest { | 553 : public AcceleratorControllerTest { |
| 533 public: | 554 public: |
| 534 EnabledDockedWindowsAcceleratorControllerTest() = default; | 555 EnabledDockedWindowsAcceleratorControllerTest() = default; |
| 535 ~EnabledDockedWindowsAcceleratorControllerTest() override = default; | 556 ~EnabledDockedWindowsAcceleratorControllerTest() override = default; |
| 536 | 557 |
| 537 void SetUp() override { | 558 void SetUp() override { |
| 538 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 559 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 539 ash::switches::kAshEnableDockedWindows); | 560 ash::switches::kAshEnableDockedWindows); |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1547 // Expect no notifications from the new accelerators. | 1568 // Expect no notifications from the new accelerators. |
| 1548 EXPECT_TRUE(IsMessageCenterEmpty()); | 1569 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1549 | 1570 |
| 1550 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1571 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1551 // screen before we proceed testing the rest of accelerators. | 1572 // screen before we proceed testing the rest of accelerators. |
| 1552 ResetStateIfNeeded(); | 1573 ResetStateIfNeeded(); |
| 1553 } | 1574 } |
| 1554 } | 1575 } |
| 1555 | 1576 |
| 1556 } // namespace ash | 1577 } // namespace ash |
| OLD | NEW |