| OLD | NEW |
| 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/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // each 6 values corresponds to the X, Y, and Z readings from the base and lid | 46 // each 6 values corresponds to the X, Y, and Z readings from the base and lid |
| 47 // accelerometers in this order. | 47 // accelerometers in this order. |
| 48 extern const float kAccelerometerFullyOpenTestData[]; | 48 extern const float kAccelerometerFullyOpenTestData[]; |
| 49 extern const size_t kAccelerometerFullyOpenTestDataLength; | 49 extern const size_t kAccelerometerFullyOpenTestDataLength; |
| 50 | 50 |
| 51 class MaximizeModeControllerTest : public test::AshTestBase { | 51 class MaximizeModeControllerTest : public test::AshTestBase { |
| 52 public: | 52 public: |
| 53 MaximizeModeControllerTest() {} | 53 MaximizeModeControllerTest() {} |
| 54 virtual ~MaximizeModeControllerTest() {} | 54 virtual ~MaximizeModeControllerTest() {} |
| 55 | 55 |
| 56 virtual void SetUp() OVERRIDE { | 56 virtual void SetUp() override { |
| 57 test::AshTestBase::SetUp(); | 57 test::AshTestBase::SetUp(); |
| 58 Shell::GetInstance()->accelerometer_controller()->RemoveObserver( | 58 Shell::GetInstance()->accelerometer_controller()->RemoveObserver( |
| 59 maximize_mode_controller()); | 59 maximize_mode_controller()); |
| 60 | 60 |
| 61 // Set the first display to be the internal display for the accelerometer | 61 // Set the first display to be the internal display for the accelerometer |
| 62 // screen rotation tests. | 62 // screen rotation tests. |
| 63 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()). | 63 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()). |
| 64 SetFirstDisplayAsInternalDisplay(); | 64 SetFirstDisplayAsInternalDisplay(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() OVERRIDE { | 67 virtual void TearDown() override { |
| 68 Shell::GetInstance()->accelerometer_controller()->AddObserver( | 68 Shell::GetInstance()->accelerometer_controller()->AddObserver( |
| 69 maximize_mode_controller()); | 69 maximize_mode_controller()); |
| 70 test::AshTestBase::TearDown(); | 70 test::AshTestBase::TearDown(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 MaximizeModeController* maximize_mode_controller() { | 73 MaximizeModeController* maximize_mode_controller() { |
| 74 return Shell::GetInstance()->maximize_mode_controller(); | 74 return Shell::GetInstance()->maximize_mode_controller(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void TriggerAccelerometerUpdate(const gfx::Vector3dF& base, | 77 void TriggerAccelerometerUpdate(const gfx::Vector3dF& base, |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 // User sets rotation to the same rotation that the display was at when | 608 // User sets rotation to the same rotation that the display was at when |
| 609 // maximize mode was activated. | 609 // maximize mode was activated. |
| 610 SetInternalDisplayRotation(gfx::Display::ROTATE_0); | 610 SetInternalDisplayRotation(gfx::Display::ROTATE_0); |
| 611 // Exit maximize mode | 611 // Exit maximize mode |
| 612 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity), | 612 TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity), |
| 613 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | 613 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); |
| 614 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | 614 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
| 615 } | 615 } |
| 616 | 616 |
| 617 } // namespace ash | 617 } // namespace ash |
| OLD | NEW |