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/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 822503003: Change AccelerometerReader to a Singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update new dependency Created 5 years, 11 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 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
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
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
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | athena/system/orientation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698