| 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/common/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/common/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void SetUp() override { | 76 void SetUp() override { |
| 77 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 77 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 78 switches::kAshEnableTouchView); | 78 switches::kAshEnableTouchView); |
| 79 test::AshTestBase::SetUp(); | 79 test::AshTestBase::SetUp(); |
| 80 chromeos::AccelerometerReader::GetInstance()->RemoveObserver( | 80 chromeos::AccelerometerReader::GetInstance()->RemoveObserver( |
| 81 maximize_mode_controller()); | 81 maximize_mode_controller()); |
| 82 | 82 |
| 83 // Set the first display to be the internal display for the accelerometer | 83 // Set the first display to be the internal display for the accelerometer |
| 84 // screen rotation tests. | 84 // screen rotation tests. |
| 85 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); | 85 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) |
| 86 .SetFirstDisplayAsInternalDisplay(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void TearDown() override { | 89 void TearDown() override { |
| 89 chromeos::AccelerometerReader::GetInstance()->AddObserver( | 90 chromeos::AccelerometerReader::GetInstance()->AddObserver( |
| 90 maximize_mode_controller()); | 91 maximize_mode_controller()); |
| 91 test::AshTestBase::TearDown(); | 92 test::AshTestBase::TearDown(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 MaximizeModeController* maximize_mode_controller() { | 95 MaximizeModeController* maximize_mode_controller() { |
| 95 return WmShell::Get()->maximize_mode_controller(); | 96 return WmShell::Get()->maximize_mode_controller(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 EXPECT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); | 483 EXPECT_FALSE(WmShell::Get()->window_selector_controller()->IsSelecting()); |
| 483 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); | 484 EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow()); |
| 484 } | 485 } |
| 485 | 486 |
| 486 // Test that the disabling of the internal display exits maximize mode, and that | 487 // Test that the disabling of the internal display exits maximize mode, and that |
| 487 // while disabled we do not re-enter maximize mode. | 488 // while disabled we do not re-enter maximize mode. |
| 488 TEST_F(MaximizeModeControllerTest, NoMaximizeModeWithDisabledInternalDisplay) { | 489 TEST_F(MaximizeModeControllerTest, NoMaximizeModeWithDisabledInternalDisplay) { |
| 489 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 490 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 490 UpdateDisplay("200x200, 200x200"); | 491 UpdateDisplay("200x200, 200x200"); |
| 491 const int64_t internal_display_id = | 492 const int64_t internal_display_id = |
| 492 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); | 493 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) |
| 494 .SetFirstDisplayAsInternalDisplay(); |
| 493 ASSERT_FALSE(IsMaximizeModeStarted()); | 495 ASSERT_FALSE(IsMaximizeModeStarted()); |
| 494 | 496 |
| 495 OpenLidToAngle(270.0f); | 497 OpenLidToAngle(270.0f); |
| 496 EXPECT_TRUE(IsMaximizeModeStarted()); | 498 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 497 EXPECT_TRUE(AreEventsBlocked()); | 499 EXPECT_TRUE(AreEventsBlocked()); |
| 498 | 500 |
| 499 // Deactivate internal display to simulate Docked Mode. | 501 // Deactivate internal display to simulate Docked Mode. |
| 500 std::vector<display::ManagedDisplayInfo> secondary_only; | 502 std::vector<display::ManagedDisplayInfo> secondary_only; |
| 501 secondary_only.push_back( | 503 secondary_only.push_back( |
| 502 display_manager->GetDisplayInfo(display_manager->GetDisplayAt(1).id())); | 504 display_manager->GetDisplayInfo(display_manager->GetDisplayAt(1).id())); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // accelerometer updates which would normally cause it to exit do not. | 561 // accelerometer updates which would normally cause it to exit do not. |
| 560 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 562 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
| 561 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 563 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
| 562 | 564 |
| 563 // Would normally trigger an exit from maximize mode. | 565 // Would normally trigger an exit from maximize mode. |
| 564 OpenLidToAngle(90.0f); | 566 OpenLidToAngle(90.0f); |
| 565 EXPECT_TRUE(IsMaximizeModeStarted()); | 567 EXPECT_TRUE(IsMaximizeModeStarted()); |
| 566 } | 568 } |
| 567 | 569 |
| 568 } // namespace ash | 570 } // namespace ash |
| OLD | NEW |