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

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

Issue 2649553004: Do not enter Maximize Mode while docked (Closed)
Patch Set: . Created 3 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
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 secondary_only.push_back(display_manager()->GetDisplayInfo( 499 secondary_only.push_back(display_manager()->GetDisplayInfo(
500 display_manager()->GetDisplayAt(1).id())); 500 display_manager()->GetDisplayAt(1).id()));
501 display_manager()->OnNativeDisplaysChanged(secondary_only); 501 display_manager()->OnNativeDisplaysChanged(secondary_only);
502 ASSERT_FALSE(display_manager()->IsActiveDisplayId(internal_display_id)); 502 ASSERT_FALSE(display_manager()->IsActiveDisplayId(internal_display_id));
503 EXPECT_FALSE(IsMaximizeModeStarted()); 503 EXPECT_FALSE(IsMaximizeModeStarted());
504 EXPECT_FALSE(AreEventsBlocked()); 504 EXPECT_FALSE(AreEventsBlocked());
505 505
506 OpenLidToAngle(270.0f); 506 OpenLidToAngle(270.0f);
507 EXPECT_FALSE(IsMaximizeModeStarted()); 507 EXPECT_FALSE(IsMaximizeModeStarted());
508 EXPECT_FALSE(AreEventsBlocked()); 508 EXPECT_FALSE(AreEventsBlocked());
509
510 // Tablet mode signal should also be ignored.
511 SetTabletMode(true);
512 EXPECT_FALSE(IsMaximizeModeStarted());
513 EXPECT_FALSE(AreEventsBlocked());
509 } 514 }
510 515
516 // Tests that is a tablet mode signal is received while docked, that maximize
517 // mode is enabled upon exiting docked mode.
518 TEST_F(MaximizeModeControllerTest, MaximizeModeAfterExitingDockedMode) {
519 UpdateDisplay("200x200, 200x200");
520 const int64_t internal_display_id =
521 display::test::DisplayManagerTestApi(display_manager())
522 .SetFirstDisplayAsInternalDisplay();
523 ASSERT_FALSE(IsMaximizeModeStarted());
524
525 // Deactivate internal display to simulate Docked Mode.
526 std::vector<display::ManagedDisplayInfo> all_displays;
527 all_displays.push_back(display_manager()->GetDisplayInfo(
528 display_manager()->GetDisplayAt(0).id()));
529 std::vector<display::ManagedDisplayInfo> secondary_only;
530 display::ManagedDisplayInfo secondary_display =
531 display_manager()->GetDisplayInfo(
532 display_manager()->GetDisplayAt(1).id());
533 all_displays.push_back(secondary_display);
534 secondary_only.push_back(secondary_display);
535 display_manager()->OnNativeDisplaysChanged(secondary_only);
536 ASSERT_FALSE(display_manager()->IsActiveDisplayId(internal_display_id));
537
538 // Tablet mode signal should also be ignored.
539 SetTabletMode(true);
540 EXPECT_FALSE(IsMaximizeModeStarted());
541 EXPECT_FALSE(AreEventsBlocked());
542
543 // Exiting docked state
544 display_manager()->OnNativeDisplaysChanged(all_displays);
545 display::test::DisplayManagerTestApi(display_manager())
546 .SetFirstDisplayAsInternalDisplay();
547 EXPECT_TRUE(IsMaximizeModeStarted());
548 }
549
511 // Verify that the device won't exit touchview / maximize mode for unstable 550 // Verify that the device won't exit touchview / maximize mode for unstable
512 // angles when hinge is nearly vertical 551 // angles when hinge is nearly vertical
513 TEST_F(MaximizeModeControllerTest, VerticalHingeUnstableAnglesTest) { 552 TEST_F(MaximizeModeControllerTest, VerticalHingeUnstableAnglesTest) {
514 // Trigger maximize mode by opening to 270 to begin the test in maximize mode. 553 // Trigger maximize mode by opening to 270 to begin the test in maximize mode.
515 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), 554 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity),
516 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); 555 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f));
517 ASSERT_TRUE(IsMaximizeModeStarted()); 556 ASSERT_TRUE(IsMaximizeModeStarted());
518 557
519 // Feeds in sample accelerometer data and verifies that there are no 558 // Feeds in sample accelerometer data and verifies that there are no
520 // transitions out of touchview / maximize mode while shaking the device 559 // transitions out of touchview / maximize mode while shaking the device
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // accelerometer updates which would normally cause it to exit do not. 596 // accelerometer updates which would normally cause it to exit do not.
558 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { 597 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) {
559 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); 598 maximize_mode_controller()->EnableMaximizeModeWindowManager(true);
560 599
561 // Would normally trigger an exit from maximize mode. 600 // Would normally trigger an exit from maximize mode.
562 OpenLidToAngle(90.0f); 601 OpenLidToAngle(90.0f);
563 EXPECT_TRUE(IsMaximizeModeStarted()); 602 EXPECT_TRUE(IsMaximizeModeStarted());
564 } 603 }
565 604
566 } // namespace ash 605 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698