| 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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ~MaximizeModeControllerTest() override {} | 56 ~MaximizeModeControllerTest() override {} |
| 57 | 57 |
| 58 void SetUp() override { | 58 void SetUp() override { |
| 59 test::AshTestBase::SetUp(); | 59 test::AshTestBase::SetUp(); |
| 60 Shell::GetInstance()->accelerometer_reader()->RemoveObserver( | 60 chromeos::AccelerometerReader::GetInstance()->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 void TearDown() override { | 69 void TearDown() override { |
| 70 Shell::GetInstance()->accelerometer_reader()->AddObserver( | 70 chromeos::AccelerometerReader::GetInstance()->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 TriggerLidUpdate(const gfx::Vector3dF& lid) { | 79 void TriggerLidUpdate(const gfx::Vector3dF& lid) { |
| 80 ui::AccelerometerUpdate update; | 80 ui::AccelerometerUpdate update; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // accelerometer updates which would normally cause it to exit do not. | 363 // accelerometer updates which would normally cause it to exit do not. |
| 364 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 364 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
| 365 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 365 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 366 | 366 |
| 367 // Would normally trigger an exit from maximize mode. | 367 // Would normally trigger an exit from maximize mode. |
| 368 OpenLidToAngle(90.0f); | 368 OpenLidToAngle(90.0f); |
| 369 EXPECT_TRUE(IsMaximizeModeStarted()); | 369 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace ash | 372 } // namespace ash |
| OLD | NEW |