| 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 "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 6 |
| 5 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> |
| 6 #include <vector> | 9 #include <vector> |
| 7 | 10 |
| 8 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 9 | |
| 10 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 11 #include "ash/display/display_manager.h" | 12 #include "ash/display/display_manager.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 14 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
| 16 #include "ash/test/test_system_tray_delegate.h" | 17 #include "ash/test/test_system_tray_delegate.h" |
| 17 #include "ash/test/test_volume_control_delegate.h" | 18 #include "ash/test/test_volume_control_delegate.h" |
| 18 #include "ash/wm/overview/window_selector_controller.h" | 19 #include "ash/wm/overview/window_selector_controller.h" |
| 19 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool IsMaximizeModeStarted() { | 114 bool IsMaximizeModeStarted() { |
| 114 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); | 115 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); |
| 115 } | 116 } |
| 116 | 117 |
| 117 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non | 118 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non |
| 118 // null value initial value. | 119 // null value initial value. |
| 119 void AttachTickClockForTest() { | 120 void AttachTickClockForTest() { |
| 120 scoped_ptr<base::TickClock> tick_clock( | 121 scoped_ptr<base::TickClock> tick_clock( |
| 121 test_tick_clock_ = new base::SimpleTestTickClock()); | 122 test_tick_clock_ = new base::SimpleTestTickClock()); |
| 122 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); | 123 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); |
| 123 maximize_mode_controller()->SetTickClockForTest(tick_clock.Pass()); | 124 maximize_mode_controller()->SetTickClockForTest(std::move(tick_clock)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void AdvanceTickClock(const base::TimeDelta& delta) { | 127 void AdvanceTickClock(const base::TimeDelta& delta) { |
| 127 DCHECK(test_tick_clock_); | 128 DCHECK(test_tick_clock_); |
| 128 test_tick_clock_->Advance(delta); | 129 test_tick_clock_->Advance(delta); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void OpenLidToAngle(float degrees) { | 132 void OpenLidToAngle(float degrees) { |
| 132 DCHECK(degrees >= 0.0f); | 133 DCHECK(degrees >= 0.0f); |
| 133 DCHECK(degrees <= 360.0f); | 134 DCHECK(degrees <= 360.0f); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // accelerometer updates which would normally cause it to exit do not. | 485 // accelerometer updates which would normally cause it to exit do not. |
| 485 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 486 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
| 486 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 487 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 487 | 488 |
| 488 // Would normally trigger an exit from maximize mode. | 489 // Would normally trigger an exit from maximize mode. |
| 489 OpenLidToAngle(90.0f); | 490 OpenLidToAngle(90.0f); |
| 490 EXPECT_TRUE(IsMaximizeModeStarted()); | 491 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace ash | 494 } // namespace ash |
| OLD | NEW |