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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 686593002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <math.h> 5 #include <math.h>
6 6
7 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 7 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
8 8
9 #include "ash/accelerometer/accelerometer_controller.h" 9 #include "ash/accelerometer/accelerometer_controller.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Test accelerometer data taken with the lid open 360 degrees while 46 // Test accelerometer data taken with the lid open 360 degrees while
47 // shaking the device around. The data is to be interpreted in groups of 6 where 47 // shaking the device around. The data is to be interpreted in groups of 6 where
48 // each 6 values corresponds to the X, Y, and Z readings from the base and lid 48 // each 6 values corresponds to the X, Y, and Z readings from the base and lid
49 // accelerometers in this order. 49 // accelerometers in this order.
50 extern const float kAccelerometerFullyOpenTestData[]; 50 extern const float kAccelerometerFullyOpenTestData[];
51 extern const size_t kAccelerometerFullyOpenTestDataLength; 51 extern const size_t kAccelerometerFullyOpenTestDataLength;
52 52
53 class MaximizeModeControllerTest : public test::AshTestBase { 53 class MaximizeModeControllerTest : public test::AshTestBase {
54 public: 54 public:
55 MaximizeModeControllerTest() {} 55 MaximizeModeControllerTest() {}
56 virtual ~MaximizeModeControllerTest() {} 56 ~MaximizeModeControllerTest() override {}
57 57
58 virtual void SetUp() override { 58 void SetUp() override {
59 test::AshTestBase::SetUp(); 59 test::AshTestBase::SetUp();
60 Shell::GetInstance()->accelerometer_controller()->RemoveObserver( 60 Shell::GetInstance()->accelerometer_controller()->RemoveObserver(
61 maximize_mode_controller()); 61 maximize_mode_controller());
62 62
63 // Set the first display to be the internal display for the accelerometer 63 // Set the first display to be the internal display for the accelerometer
64 // screen rotation tests. 64 // screen rotation tests.
65 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()). 65 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()).
66 SetFirstDisplayAsInternalDisplay(); 66 SetFirstDisplayAsInternalDisplay();
67 } 67 }
68 68
69 virtual void TearDown() override { 69 void TearDown() override {
70 Shell::GetInstance()->accelerometer_controller()->AddObserver( 70 Shell::GetInstance()->accelerometer_controller()->AddObserver(
71 maximize_mode_controller()); 71 maximize_mode_controller());
72 test::AshTestBase::TearDown(); 72 test::AshTestBase::TearDown();
73 } 73 }
74 74
75 MaximizeModeController* maximize_mode_controller() { 75 MaximizeModeController* maximize_mode_controller() {
76 return Shell::GetInstance()->maximize_mode_controller(); 76 return Shell::GetInstance()->maximize_mode_controller();
77 } 77 }
78 78
79 void TriggerAccelerometerUpdate(const gfx::Vector3dF& base, 79 void TriggerAccelerometerUpdate(const gfx::Vector3dF& base,
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 SetInternalDisplayRotation(gfx::Display::ROTATE_0); 612 SetInternalDisplayRotation(gfx::Display::ROTATE_0);
613 // Exit maximize mode 613 // Exit maximize mode
614 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity), 614 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity),
615 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); 615 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f));
616 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); 616 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation());
617 } 617 }
618 618
619 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest { 619 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest {
620 public: 620 public:
621 MaximizeModeControllerSwitchesTest() {} 621 MaximizeModeControllerSwitchesTest() {}
622 virtual ~MaximizeModeControllerSwitchesTest(){} 622 ~MaximizeModeControllerSwitchesTest() override {}
623 623
624 virtual void SetUp() override { 624 void SetUp() override {
625 CommandLine::ForCurrentProcess()->AppendSwitch( 625 CommandLine::ForCurrentProcess()->AppendSwitch(
626 switches::kAshEnableTouchViewTesting); 626 switches::kAshEnableTouchViewTesting);
627 MaximizeModeControllerTest::SetUp(); 627 MaximizeModeControllerTest::SetUp();
628 } 628 }
629 private: 629 private:
630 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest); 630 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest);
631 }; 631 };
632 632
633 // Tests that when the command line switch for testing maximize mode is on, that 633 // Tests that when the command line switch for testing maximize mode is on, that
634 // accelerometer updates which would normally cause it to exit do not, and that 634 // accelerometer updates which would normally cause it to exit do not, and that
635 // screen rotations still occur. 635 // screen rotations still occur.
636 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { 636 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) {
637 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); 637 maximize_mode_controller()->EnableMaximizeModeWindowManager(true);
638 638
639 // Would normally trigger an exit from maximize mode. 639 // Would normally trigger an exit from maximize mode.
640 OpenLidToAngle(90.0f); 640 OpenLidToAngle(90.0f);
641 EXPECT_TRUE(IsMaximizeModeStarted()); 641 EXPECT_TRUE(IsMaximizeModeStarted());
642 642
643 TriggerAccelerometerUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f), 643 TriggerAccelerometerUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f),
644 gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); 644 gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f));
645 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); 645 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation());
646 } 646 }
647 647
648 } // namespace ash 648 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.h ('k') | ash/wm/maximize_mode/maximize_mode_window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698