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 <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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | 289 gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
290 EXPECT_TRUE(IsMaximizeModeStarted()); | 290 EXPECT_TRUE(IsMaximizeModeStarted()); |
291 | 291 |
292 // Normal 90 degree orientation but near vertical should stay in maximize | 292 // Normal 90 degree orientation but near vertical should stay in maximize |
293 // mode. | 293 // mode. |
294 TriggerBaseAndLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, -0.1f), | 294 TriggerBaseAndLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, -0.1f), |
295 gfx::Vector3dF(kMeanGravity, -0.1f, 0.0f)); | 295 gfx::Vector3dF(kMeanGravity, -0.1f, 0.0f)); |
296 EXPECT_TRUE(IsMaximizeModeStarted()); | 296 EXPECT_TRUE(IsMaximizeModeStarted()); |
297 } | 297 } |
298 | 298 |
299 // Tests that only getting a lid accelerometer update will enter maximize | |
300 // mode and rotate the screen. | |
301 TEST_F(MaximizeModeControllerTest, LidOnlyDisplayRotation) { | |
302 ASSERT_FALSE(IsMaximizeModeStarted()); | |
303 // Test rotating in all directions. | |
304 TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); | |
305 // The first update should have entered maximize mode. | |
306 ASSERT_TRUE(IsMaximizeModeStarted()); | |
307 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
308 TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | |
309 EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); | |
310 TriggerLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); | |
311 EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); | |
312 TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
313 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
314 } | |
315 | |
316 // Tests that accelerometer readings in each of the screen angles will trigger a | |
317 // rotation of the internal display. | |
318 TEST_F(MaximizeModeControllerTest, DisplayRotation) { | |
319 // Trigger maximize mode by opening to 270. | |
320 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
321 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
322 ASSERT_TRUE(IsMaximizeModeStarted()); | |
323 | |
324 // Now test rotating in all directions. | |
325 TriggerBaseAndLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f), | |
326 gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); | |
327 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
328 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f), | |
329 gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | |
330 EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); | |
331 TriggerBaseAndLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f), | |
332 gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); | |
333 EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); | |
334 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f), | |
335 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
336 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
337 } | |
338 | |
339 // Tests that low angles are ignored by the accelerometer (i.e. when the device | |
340 // is almost laying flat). | |
341 TEST_F(MaximizeModeControllerTest, RotationIgnoresLowAngles) { | |
342 // Trigger maximize mode by opening to 270. | |
343 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
344 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
345 ASSERT_TRUE(IsMaximizeModeStarted()); | |
346 | |
347 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, kMeanGravity), | |
348 gfx::Vector3dF(0.0f, -kMeanGravity, -kMeanGravity)); | |
349 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
350 TriggerBaseAndLidUpdate(gfx::Vector3dF(-2.0f, 0.0f, kMeanGravity), | |
351 gfx::Vector3dF(-2.0f, 0.0f, -kMeanGravity)); | |
352 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
353 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, -2.0f, kMeanGravity), | |
354 gfx::Vector3dF(0.0f, 2.0f, -kMeanGravity)); | |
355 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
356 TriggerBaseAndLidUpdate(gfx::Vector3dF(2.0f, 0.0f, kMeanGravity), | |
357 gfx::Vector3dF(2.0f, 0.0f, -kMeanGravity)); | |
358 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
359 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 2.0f, kMeanGravity), | |
360 gfx::Vector3dF(0.0f, -2.0f, -kMeanGravity)); | |
361 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
362 } | |
363 | |
364 // Tests that the display will stick to the current orientation beyond the | |
365 // halfway point, preventing frequent updates back and forth. | |
366 TEST_F(MaximizeModeControllerTest, RotationSticky) { | |
367 // Trigger maximize mode by opening to 270. | |
368 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
369 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
370 ASSERT_TRUE(IsMaximizeModeStarted()); | |
371 | |
372 gfx::Vector3dF gravity(0.0f, -kMeanGravity, 0.0f); | |
373 TriggerBaseAndLidUpdate(gravity, gravity); | |
374 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
375 | |
376 // Turn past half-way point to next direction and rotation should remain | |
377 // the same. | |
378 float degrees = 50.0; | |
379 gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); | |
380 gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); | |
381 TriggerBaseAndLidUpdate(gravity, gravity); | |
382 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
383 | |
384 // Turn more and the screen should rotate. | |
385 degrees = 70.0; | |
386 gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); | |
387 gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); | |
388 TriggerBaseAndLidUpdate(gravity, gravity); | |
389 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
390 | |
391 // Turn back just beyond the half-way point and the new rotation should | |
392 // still be in effect. | |
393 degrees = 40.0; | |
394 gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); | |
395 gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); | |
396 TriggerBaseAndLidUpdate(gravity, gravity); | |
397 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
398 } | |
399 | |
400 // Tests that the screen only rotates when maximize mode is engaged, and will | |
401 // return to the standard orientation on exiting maximize mode. | |
402 TEST_F(MaximizeModeControllerTest, RotationOnlyInMaximizeMode) { | |
403 // Rotate on side with lid only open 90 degrees. | |
404 TriggerBaseAndLidUpdate(gfx::Vector3dF(-9.5f, 0.0f, -3.5f), | |
405 gfx::Vector3dF(-9.5f, -3.5f, 0.0f)); | |
406 ASSERT_FALSE(IsMaximizeModeStarted()); | |
407 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
408 | |
409 // Open lid, screen should now rotate to match orientation. | |
410 TriggerBaseAndLidUpdate(gfx::Vector3dF(-9.5f, 0.0f, 3.5f), | |
411 gfx::Vector3dF(-9.5f, -3.5f, 0.0f)); | |
412 ASSERT_TRUE(IsMaximizeModeStarted()); | |
413 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
414 | |
415 // Close lid back to 90, screen should rotate back. | |
416 TriggerBaseAndLidUpdate(gfx::Vector3dF(-9.5f, 0.0f, -3.5f), | |
417 gfx::Vector3dF(-9.5f, -3.5f, 0.0f)); | |
418 ASSERT_FALSE(IsMaximizeModeStarted()); | |
419 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
420 } | |
421 | |
422 | |
423 TEST_F(MaximizeModeControllerTest, LaptopTest) { | 299 TEST_F(MaximizeModeControllerTest, LaptopTest) { |
424 // Feeds in sample accelerometer data and verifies that there are no | 300 // Feeds in sample accelerometer data and verifies that there are no |
425 // transitions into touchview / maximize mode while shaking the device around | 301 // transitions into touchview / maximize mode while shaking the device around |
426 // with the hinge at less than 180 degrees. Note the conversion from device | 302 // with the hinge at less than 180 degrees. Note the conversion from device |
427 // data to accelerometer updates consistent with accelerometer_reader.cc. | 303 // data to accelerometer updates consistent with accelerometer_reader.cc. |
428 ASSERT_EQ(0u, kAccelerometerLaptopModeTestDataLength % 6); | 304 ASSERT_EQ(0u, kAccelerometerLaptopModeTestDataLength % 6); |
429 for (size_t i = 0; i < kAccelerometerLaptopModeTestDataLength / 6; ++i) { | 305 for (size_t i = 0; i < kAccelerometerLaptopModeTestDataLength / 6; ++i) { |
430 gfx::Vector3dF base(-kAccelerometerLaptopModeTestData[i * 6 + 1], | 306 gfx::Vector3dF base(-kAccelerometerLaptopModeTestData[i * 6 + 1], |
431 -kAccelerometerLaptopModeTestData[i * 6], | 307 -kAccelerometerLaptopModeTestData[i * 6], |
432 -kAccelerometerLaptopModeTestData[i * 6 + 2]); | 308 -kAccelerometerLaptopModeTestData[i * 6 + 2]); |
(...skipping 29 matching lines...) Expand all Loading... |
462 kAccelerometerFullyOpenTestData[i * 6 + 3], | 338 kAccelerometerFullyOpenTestData[i * 6 + 3], |
463 kAccelerometerFullyOpenTestData[i * 6 + 5]); | 339 kAccelerometerFullyOpenTestData[i * 6 + 5]); |
464 lid.Scale(kMeanGravity); | 340 lid.Scale(kMeanGravity); |
465 TriggerBaseAndLidUpdate(base, lid); | 341 TriggerBaseAndLidUpdate(base, lid); |
466 // There are a lot of samples, so ASSERT rather than EXPECT to only generate | 342 // There are a lot of samples, so ASSERT rather than EXPECT to only generate |
467 // one failure rather than potentially hundreds. | 343 // one failure rather than potentially hundreds. |
468 ASSERT_TRUE(IsMaximizeModeStarted()); | 344 ASSERT_TRUE(IsMaximizeModeStarted()); |
469 } | 345 } |
470 } | 346 } |
471 | 347 |
472 // Tests that the display will stick to its current orientation when the | |
473 // rotation lock has been set. | |
474 TEST_F(MaximizeModeControllerTest, RotationLockPreventsRotation) { | |
475 // Trigger maximize mode by opening to 270. | |
476 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
477 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
478 ASSERT_TRUE(IsMaximizeModeStarted()); | |
479 | |
480 gfx::Vector3dF gravity(-kMeanGravity, 0.0f, 0.0f); | |
481 | |
482 maximize_mode_controller()->SetRotationLocked(true); | |
483 | |
484 // Turn past the threshold for rotation. | |
485 float degrees = 90.0; | |
486 gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); | |
487 gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); | |
488 TriggerBaseAndLidUpdate(gravity, gravity); | |
489 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
490 | |
491 maximize_mode_controller()->SetRotationLocked(false); | |
492 TriggerBaseAndLidUpdate(gravity, gravity); | |
493 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
494 } | |
495 | |
496 // Tests that when MaximizeModeController turns off MaximizeMode that on the | |
497 // next accelerometer update the rotation lock is cleared. | |
498 TEST_F(MaximizeModeControllerTest, ExitingMaximizeModeClearRotationLock) { | |
499 // Trigger maximize mode by opening to 270. | |
500 OpenLidToAngle(270.0f); | |
501 ASSERT_TRUE(IsMaximizeModeStarted()); | |
502 | |
503 maximize_mode_controller()->SetRotationLocked(true); | |
504 | |
505 OpenLidToAngle(90.0f); | |
506 EXPECT_FALSE(IsMaximizeModeStarted()); | |
507 | |
508 // Send an update that would not relaunch MaximizeMode. | |
509 OpenLidToAngle(90.0f); | |
510 EXPECT_FALSE(maximize_mode_controller()->rotation_locked()); | |
511 } | |
512 | |
513 // The TrayDisplay class that is responsible for adding/updating MessageCenter | |
514 // notifications is only added to the SystemTray on ChromeOS. | |
515 // Tests that the screen rotation notifications are suppressed when | |
516 // triggered by the accelerometer. | |
517 TEST_F(MaximizeModeControllerTest, BlockRotationNotifications) { | |
518 test::TestSystemTrayDelegate* tray_delegate = | |
519 static_cast<test::TestSystemTrayDelegate*>( | |
520 Shell::GetInstance()->system_tray_delegate()); | |
521 tray_delegate->set_should_show_display_notification(true); | |
522 | |
523 message_center::MessageCenter* message_center = | |
524 message_center::MessageCenter::Get(); | |
525 | |
526 // Make sure notifications are still displayed when | |
527 // adjusting the screen rotation directly when not in maximize mode | |
528 ASSERT_FALSE(IsMaximizeModeStarted()); | |
529 ASSERT_NE(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); | |
530 ASSERT_EQ(0u, message_center->NotificationCount()); | |
531 ASSERT_FALSE(message_center->HasPopupNotifications()); | |
532 SetInternalDisplayRotation(gfx::Display::ROTATE_180); | |
533 EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); | |
534 EXPECT_EQ(1u, message_center->NotificationCount()); | |
535 EXPECT_TRUE(message_center->HasPopupNotifications()); | |
536 | |
537 // Reset the screen rotation. | |
538 SetInternalDisplayRotation(gfx::Display::ROTATE_0); | |
539 // Clear all notifications | |
540 message_center->RemoveAllNotifications(false); | |
541 // Trigger maximize mode by opening to 270. | |
542 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
543 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
544 EXPECT_TRUE(IsMaximizeModeStarted()); | |
545 EXPECT_EQ(0u, message_center->NotificationCount()); | |
546 EXPECT_FALSE(message_center->HasPopupNotifications()); | |
547 | |
548 // Make sure notifications are still displayed when | |
549 // adjusting the screen rotation directly when in maximize mode | |
550 ASSERT_NE(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); | |
551 SetInternalDisplayRotation(gfx::Display::ROTATE_270); | |
552 maximize_mode_controller()->SetRotationLocked(false); | |
553 EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); | |
554 EXPECT_EQ(1u, message_center->NotificationCount()); | |
555 EXPECT_TRUE(message_center->HasPopupNotifications()); | |
556 | |
557 // Clear all notifications | |
558 message_center->RemoveAllNotifications(false); | |
559 EXPECT_EQ(0u, message_center->NotificationCount()); | |
560 EXPECT_FALSE(message_center->HasPopupNotifications()); | |
561 | |
562 // Make sure notifications are blocked when adjusting the screen rotation | |
563 // via the accelerometer while in maximize mode | |
564 // Rotate the screen 90 degrees | |
565 ASSERT_NE(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
566 TriggerBaseAndLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f), | |
567 gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); | |
568 ASSERT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
569 EXPECT_EQ(0u, message_center->NotificationCount()); | |
570 EXPECT_FALSE(message_center->HasPopupNotifications()); | |
571 } | |
572 | |
573 // Tests that if a user has set a display rotation that it is restored upon | |
574 // exiting maximize mode. | |
575 TEST_F(MaximizeModeControllerTest, ResetUserRotationUponExit) { | |
576 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | |
577 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | |
578 gfx::Display::ROTATE_90); | |
579 | |
580 // Trigger maximize mode | |
581 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
582 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
583 ASSERT_TRUE(IsMaximizeModeStarted()); | |
584 | |
585 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f), | |
586 gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); | |
587 EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); | |
588 | |
589 // Exit maximize mode | |
590 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity), | |
591 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
592 EXPECT_FALSE(IsMaximizeModeStarted()); | |
593 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
594 } | |
595 | |
596 // Tests that if a user sets a display rotation that accelerometer rotation | |
597 // becomes locked. | |
598 TEST_F(MaximizeModeControllerTest, | |
599 NonAccelerometerRotationChangesLockRotation) { | |
600 // Trigger maximize mode by opening to 270. | |
601 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
602 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
603 ASSERT_FALSE(maximize_mode_controller()->rotation_locked()); | |
604 SetInternalDisplayRotation(gfx::Display::ROTATE_270); | |
605 EXPECT_TRUE(maximize_mode_controller()->rotation_locked()); | |
606 } | |
607 | |
608 // Tests that if a user changes the display rotation, while rotation is locked, | |
609 // that the updates are recorded. Upon exiting maximize mode the latest user | |
610 // rotation should be applied. | |
611 TEST_F(MaximizeModeControllerTest, UpdateUserRotationWhileRotationLocked) { | |
612 // Trigger maximize mode by opening to 270. | |
613 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, kMeanGravity), | |
614 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
615 SetInternalDisplayRotation(gfx::Display::ROTATE_270); | |
616 // User sets rotation to the same rotation that the display was at when | |
617 // maximize mode was activated. | |
618 SetInternalDisplayRotation(gfx::Display::ROTATE_0); | |
619 // Exit maximize mode | |
620 TriggerBaseAndLidUpdate(gfx::Vector3dF(0.0f, 0.0f, -kMeanGravity), | |
621 gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); | |
622 EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); | |
623 } | |
624 | |
625 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest { | 348 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest { |
626 public: | 349 public: |
627 MaximizeModeControllerSwitchesTest() {} | 350 MaximizeModeControllerSwitchesTest() {} |
628 ~MaximizeModeControllerSwitchesTest() override {} | 351 ~MaximizeModeControllerSwitchesTest() override {} |
629 | 352 |
630 void SetUp() override { | 353 void SetUp() override { |
631 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 354 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
632 switches::kAshEnableTouchViewTesting); | 355 switches::kAshEnableTouchViewTesting); |
633 MaximizeModeControllerTest::SetUp(); | 356 MaximizeModeControllerTest::SetUp(); |
634 } | 357 } |
635 private: | 358 private: |
636 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest); | 359 DISALLOW_COPY_AND_ASSIGN(MaximizeModeControllerSwitchesTest); |
637 }; | 360 }; |
638 | 361 |
639 // Tests that when the command line switch for testing maximize mode is on, that | 362 // Tests that when the command line switch for testing maximize mode is on, that |
640 // accelerometer updates which would normally cause it to exit do not, and that | 363 // accelerometer updates which would normally cause it to exit do not. |
641 // screen rotations still occur. | |
642 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { | 364 TEST_F(MaximizeModeControllerSwitchesTest, IgnoreHingeAngles) { |
643 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); | 365 maximize_mode_controller()->EnableMaximizeModeWindowManager(true); |
644 | 366 |
645 // Would normally trigger an exit from maximize mode. | 367 // Would normally trigger an exit from maximize mode. |
646 OpenLidToAngle(90.0f); | 368 OpenLidToAngle(90.0f); |
647 EXPECT_TRUE(IsMaximizeModeStarted()); | 369 EXPECT_TRUE(IsMaximizeModeStarted()); |
648 | |
649 TriggerBaseAndLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f), | |
650 gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); | |
651 EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); | |
652 } | 370 } |
653 | 371 |
654 } // namespace ash | 372 } // namespace ash |
OLD | NEW |