| 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" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 maximize_mode_controller()->OnAccelerometerUpdated(update); | 111 maximize_mode_controller()->OnAccelerometerUpdated(update); |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool IsMaximizeModeStarted() { | 114 bool IsMaximizeModeStarted() { |
| 115 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); | 115 return maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non | 118 // Attaches a SimpleTestTickClock to the MaximizeModeController with a non |
| 119 // null value initial value. | 119 // null value initial value. |
| 120 void AttachTickClockForTest() { | 120 void AttachTickClockForTest() { |
| 121 scoped_ptr<base::TickClock> tick_clock( | 121 std::unique_ptr<base::TickClock> tick_clock( |
| 122 test_tick_clock_ = new base::SimpleTestTickClock()); | 122 test_tick_clock_ = new base::SimpleTestTickClock()); |
| 123 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); | 123 test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1)); |
| 124 maximize_mode_controller()->SetTickClockForTest(std::move(tick_clock)); | 124 maximize_mode_controller()->SetTickClockForTest(std::move(tick_clock)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void AdvanceTickClock(const base::TimeDelta& delta) { | 127 void AdvanceTickClock(const base::TimeDelta& delta) { |
| 128 DCHECK(test_tick_clock_); | 128 DCHECK(test_tick_clock_); |
| 129 test_tick_clock_->Advance(delta); | 129 test_tick_clock_->Advance(delta); |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); | 425 TriggerLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity)); |
| 426 ASSERT_TRUE(IsMaximizeModeStarted()); | 426 ASSERT_TRUE(IsMaximizeModeStarted()); |
| 427 } | 427 } |
| 428 | 428 |
| 429 // Test if this case does not crash. See http://crbug.com/462806 | 429 // Test if this case does not crash. See http://crbug.com/462806 |
| 430 TEST_F(MaximizeModeControllerTest, DisplayDisconnectionDuringOverview) { | 430 TEST_F(MaximizeModeControllerTest, DisplayDisconnectionDuringOverview) { |
| 431 if (!SupportsMultipleDisplays()) | 431 if (!SupportsMultipleDisplays()) |
| 432 return; | 432 return; |
| 433 | 433 |
| 434 UpdateDisplay("800x600,800x600"); | 434 UpdateDisplay("800x600,800x600"); |
| 435 scoped_ptr<aura::Window> w1( | 435 std::unique_ptr<aura::Window> w1( |
| 436 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100))); | 436 CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 100, 100))); |
| 437 scoped_ptr<aura::Window> w2( | 437 std::unique_ptr<aura::Window> w2( |
| 438 CreateTestWindowInShellWithBounds(gfx::Rect(800, 0, 100, 100))); | 438 CreateTestWindowInShellWithBounds(gfx::Rect(800, 0, 100, 100))); |
| 439 ASSERT_NE(w1->GetRootWindow(), w2->GetRootWindow()); | 439 ASSERT_NE(w1->GetRootWindow(), w2->GetRootWindow()); |
| 440 | 440 |
| 441 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 441 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 442 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); | 442 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); |
| 443 | 443 |
| 444 UpdateDisplay("800x600"); | 444 UpdateDisplay("800x600"); |
| 445 EXPECT_FALSE( | 445 EXPECT_FALSE( |
| 446 Shell::GetInstance()->window_selector_controller()->IsSelecting()); | 446 Shell::GetInstance()->window_selector_controller()->IsSelecting()); |
| 447 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); | 447 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // accelerometer updates which would normally cause it to exit do not. | 492 // accelerometer updates which would normally cause it to exit do not. |
| 493 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 493 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
| 494 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 494 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 495 | 495 |
| 496 // Would normally trigger an exit from maximize mode. | 496 // Would normally trigger an exit from maximize mode. |
| 497 OpenLidToAngle(90.0f); | 497 OpenLidToAngle(90.0f); |
| 498 EXPECT_TRUE(IsMaximizeModeStarted()); | 498 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace ash | 501 } // namespace ash |
| OLD | NEW |