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

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

Issue 1071353003: Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 base.y(), base.z()); 105 base.y(), base.z());
106 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(), 106 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, lid.x(), lid.y(),
107 lid.z()); 107 lid.z());
108 maximize_mode_controller()->OnAccelerometerUpdated(update); 108 maximize_mode_controller()->OnAccelerometerUpdated(update);
109 } 109 }
110 110
111 bool IsMaximizeModeStarted() { 111 bool IsMaximizeModeStarted() {
112 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); 112 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled();
113 } 113 }
114 114
115 gfx::Display::Rotation GetInternalDisplayRotation() const {
116 return Shell::GetInstance()->display_manager()->GetDisplayInfo(
117 gfx::Display::InternalDisplayId()).rotation();
118 }
119
120 void SetInternalDisplayRotation(gfx::Display::Rotation rotation) const {
121 Shell::GetInstance()->display_manager()->
122 SetDisplayRotation(gfx::Display::InternalDisplayId(), rotation);
123 }
124
125 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non 115 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non
126 // null value initial value. 116 // null value initial value.
127 void AttachTickClockForTest() { 117 void AttachTickClockForTest() {
128 scoped_ptr<base::TickClock> tick_clock( 118 scoped_ptr<base::TickClock> tick_clock(
129 test_tick_clock_ = new base::SimpleTestTickClock()); 119 test_tick_clock_ = new base::SimpleTestTickClock());
130 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); 120 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1));
131 maximize_mode_controller()->SetTickClockForTest(tick_clock.Pass()); 121 maximize_mode_controller()->SetTickClockForTest(tick_clock.Pass());
132 } 122 }
133 123
134 void AdvanceTickClock(const base::TimeDelta& delta) { 124 void AdvanceTickClock(const base::TimeDelta& delta) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // accelerometer updates which would normally cause it to exit do not. 458 // accelerometer updates which would normally cause it to exit do not.
469 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { 459 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) {
470 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); 460 maximize_mode_controller()->EnableMaximizeModeWindowManager(true);
471 461
472 // Would normally trigger an exit from maximize mode. 462 // Would normally trigger an exit from maximize mode.
473 OpenLidToAngle(90.0f); 463 OpenLidToAngle(90.0f);
474 EXPECT_TRUE(IsMaximizeModeStarted()); 464 EXPECT_TRUE(IsMaximizeModeStarted());
475 } 465 }
476 466
477 } // namespace ash 467 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager_unittest.cc ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698