| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shared/immersive_fullscreen_controller.h" | 5 #include "ash/shared/immersive_fullscreen_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_shell.h" |
| 9 #include "ash/display/mouse_cursor_event_filter.h" | 10 #include "ash/display/mouse_cursor_event_filter.h" |
| 10 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" |
| 11 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/shared/immersive_fullscreen_controller_delegate.h" | 13 #include "ash/shared/immersive_fullscreen_controller_delegate.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 15 #include "ash/test/immersive_fullscreen_controller_test_api.h" | 16 #include "ash/test/immersive_fullscreen_controller_test_api.h" |
| 16 #include "ash/wm/window_state_aura.h" | 17 #include "ash/wm/window_state_aura.h" |
| 17 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 18 #include "ui/aura/client/cursor_client.h" | 19 #include "ui/aura/client/cursor_client.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 views::Widget* widget_; // Owned by the native widget. | 254 views::Widget* widget_; // Owned by the native widget. |
| 254 views::View* top_container_; // Owned by |widget_|'s root-view. | 255 views::View* top_container_; // Owned by |widget_|'s root-view. |
| 255 views::NativeViewHost* content_view_; // Owned by |widget_|'s root-view. | 256 views::NativeViewHost* content_view_; // Owned by |widget_|'s root-view. |
| 256 | 257 |
| 257 DISALLOW_COPY_AND_ASSIGN(ImmersiveFullscreenControllerTest); | 258 DISALLOW_COPY_AND_ASSIGN(ImmersiveFullscreenControllerTest); |
| 258 }; | 259 }; |
| 259 | 260 |
| 260 // Test the initial state and that the delegate gets notified of the | 261 // Test the initial state and that the delegate gets notified of the |
| 261 // top-of-window views getting hidden and revealed. | 262 // top-of-window views getting hidden and revealed. |
| 262 TEST_F(ImmersiveFullscreenControllerTest, Delegate) { | 263 TEST_F(ImmersiveFullscreenControllerTest, Delegate) { |
| 264 // TODO: investigate failure. http://crbug.com/698085. |
| 265 if (WmShell::Get()->IsRunningInMash()) |
| 266 return; |
| 267 |
| 263 // Initial state. | 268 // Initial state. |
| 264 EXPECT_FALSE(controller()->IsEnabled()); | 269 EXPECT_FALSE(controller()->IsEnabled()); |
| 265 EXPECT_FALSE(controller()->IsRevealed()); | 270 EXPECT_FALSE(controller()->IsRevealed()); |
| 266 EXPECT_FALSE(delegate()->is_enabled()); | 271 EXPECT_FALSE(delegate()->is_enabled()); |
| 267 | 272 |
| 268 // Enabling initially hides the top views. | 273 // Enabling initially hides the top views. |
| 269 SetEnabled(true); | 274 SetEnabled(true); |
| 270 EXPECT_TRUE(controller()->IsEnabled()); | 275 EXPECT_TRUE(controller()->IsEnabled()); |
| 271 EXPECT_FALSE(controller()->IsRevealed()); | 276 EXPECT_FALSE(controller()->IsRevealed()); |
| 272 EXPECT_TRUE(delegate()->is_enabled()); | 277 EXPECT_TRUE(delegate()->is_enabled()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 ImmersiveFullscreenController::ANIMATE_REVEAL_NO)); | 338 ImmersiveFullscreenController::ANIMATE_REVEAL_NO)); |
| 334 lock1.reset(); | 339 lock1.reset(); |
| 335 EXPECT_TRUE(controller()->IsRevealed()); | 340 EXPECT_TRUE(controller()->IsRevealed()); |
| 336 | 341 |
| 337 lock2.reset(); | 342 lock2.reset(); |
| 338 EXPECT_FALSE(controller()->IsRevealed()); | 343 EXPECT_FALSE(controller()->IsRevealed()); |
| 339 } | 344 } |
| 340 | 345 |
| 341 // Test mouse event processing for top-of-screen reveal triggering. | 346 // Test mouse event processing for top-of-screen reveal triggering. |
| 342 TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) { | 347 TEST_F(ImmersiveFullscreenControllerTest, OnMouseEvent) { |
| 348 // TODO: investigate failure. http://crbug.com/698085. |
| 349 if (WmShell::Get()->IsRunningInMash()) |
| 350 return; |
| 351 |
| 343 // Set up initial state. | 352 // Set up initial state. |
| 344 SetEnabled(true); | 353 SetEnabled(true); |
| 345 ASSERT_TRUE(controller()->IsEnabled()); | 354 ASSERT_TRUE(controller()->IsEnabled()); |
| 346 ASSERT_FALSE(controller()->IsRevealed()); | 355 ASSERT_FALSE(controller()->IsRevealed()); |
| 347 | 356 |
| 348 ui::test::EventGenerator& event_generator(GetEventGenerator()); | 357 ui::test::EventGenerator& event_generator(GetEventGenerator()); |
| 349 | 358 |
| 350 gfx::Rect top_container_bounds_in_screen = | 359 gfx::Rect top_container_bounds_in_screen = |
| 351 top_container()->GetBoundsInScreen(); | 360 top_container()->GetBoundsInScreen(); |
| 352 // A position along the top edge of TopContainerView in screen coordinates. | 361 // A position along the top edge of TopContainerView in screen coordinates. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 EXPECT_TRUE(controller()->IsRevealed()); | 442 EXPECT_TRUE(controller()->IsRevealed()); |
| 434 | 443 |
| 435 // Releasing capture should end the reveal. | 444 // Releasing capture should end the reveal. |
| 436 widget->ReleaseCapture(); | 445 widget->ReleaseCapture(); |
| 437 EXPECT_FALSE(controller()->IsRevealed()); | 446 EXPECT_FALSE(controller()->IsRevealed()); |
| 438 } | 447 } |
| 439 | 448 |
| 440 // Test mouse event processing for top-of-screen reveal triggering when the | 449 // Test mouse event processing for top-of-screen reveal triggering when the |
| 441 // top container's widget is inactive. | 450 // top container's widget is inactive. |
| 442 TEST_F(ImmersiveFullscreenControllerTest, Inactive) { | 451 TEST_F(ImmersiveFullscreenControllerTest, Inactive) { |
| 452 // TODO: investigate failure. http://crbug.com/698085. |
| 453 if (WmShell::Get()->IsRunningInMash()) |
| 454 return; |
| 455 |
| 443 // Set up initial state. | 456 // Set up initial state. |
| 444 views::Widget* popup_widget = views::Widget::CreateWindowWithContextAndBounds( | 457 views::Widget* popup_widget = views::Widget::CreateWindowWithContextAndBounds( |
| 445 nullptr, CurrentContext(), gfx::Rect(0, 0, 200, 200)); | 458 nullptr, CurrentContext(), gfx::Rect(0, 0, 200, 200)); |
| 446 popup_widget->Show(); | 459 popup_widget->Show(); |
| 447 ASSERT_FALSE(top_container()->GetWidget()->IsActive()); | 460 ASSERT_FALSE(top_container()->GetWidget()->IsActive()); |
| 448 | 461 |
| 449 SetEnabled(true); | 462 SetEnabled(true); |
| 450 ASSERT_TRUE(controller()->IsEnabled()); | 463 ASSERT_TRUE(controller()->IsEnabled()); |
| 451 ASSERT_FALSE(controller()->IsRevealed()); | 464 ASSERT_FALSE(controller()->IsRevealed()); |
| 452 | 465 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 EXPECT_TRUE(controller()->IsRevealed()); | 502 EXPECT_TRUE(controller()->IsRevealed()); |
| 490 MoveMouse(top_container_bounds_in_screen.x(), | 503 MoveMouse(top_container_bounds_in_screen.x(), |
| 491 top_container_bounds_in_screen.bottom() + 50); | 504 top_container_bounds_in_screen.bottom() + 50); |
| 492 EXPECT_FALSE(controller()->IsRevealed()); | 505 EXPECT_FALSE(controller()->IsRevealed()); |
| 493 } | 506 } |
| 494 | 507 |
| 495 // Test mouse event processing for top-of-screen reveal triggering when the user | 508 // Test mouse event processing for top-of-screen reveal triggering when the user |
| 496 // has a vertical display layout (primary display above/below secondary display) | 509 // has a vertical display layout (primary display above/below secondary display) |
| 497 // and the immersive fullscreen window is on the bottom display. | 510 // and the immersive fullscreen window is on the bottom display. |
| 498 TEST_F(ImmersiveFullscreenControllerTest, MouseEventsVerticalDisplayLayout) { | 511 TEST_F(ImmersiveFullscreenControllerTest, MouseEventsVerticalDisplayLayout) { |
| 512 // TODO: SetLayoutForCurrentDisplays() needs to ported to mash. |
| 513 // http://crbug.com/698043. |
| 514 if (WmShell::Get()->IsRunningInMash()) |
| 515 return; |
| 516 |
| 499 // Set up initial state. | 517 // Set up initial state. |
| 500 UpdateDisplay("800x600,800x600"); | 518 UpdateDisplay("800x600,800x600"); |
| 501 ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 519 ash::Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 502 display::test::CreateDisplayLayout(display_manager(), | 520 display::test::CreateDisplayLayout(display_manager(), |
| 503 display::DisplayPlacement::TOP, 0)); | 521 display::DisplayPlacement::TOP, 0)); |
| 504 | 522 |
| 505 SetEnabled(true); | 523 SetEnabled(true); |
| 506 ASSERT_TRUE(controller()->IsEnabled()); | 524 ASSERT_TRUE(controller()->IsEnabled()); |
| 507 ASSERT_FALSE(controller()->IsRevealed()); | 525 ASSERT_FALSE(controller()->IsRevealed()); |
| 508 | 526 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 ASSERT_FALSE(top_container()->GetWidget()->IsActive()); | 589 ASSERT_FALSE(top_container()->GetWidget()->IsActive()); |
| 572 ASSERT_FALSE(top_container()->GetBoundsInScreen().Intersects( | 590 ASSERT_FALSE(top_container()->GetBoundsInScreen().Intersects( |
| 573 popup_widget->GetWindowBoundsInScreen())); | 591 popup_widget->GetWindowBoundsInScreen())); |
| 574 event_generator.MoveMouseTo(x, y_top_edge + 1); | 592 event_generator.MoveMouseTo(x, y_top_edge + 1); |
| 575 MoveMouse(x, y_top_edge - 2); | 593 MoveMouse(x, y_top_edge - 2); |
| 576 EXPECT_TRUE(controller()->IsRevealed()); | 594 EXPECT_TRUE(controller()->IsRevealed()); |
| 577 } | 595 } |
| 578 | 596 |
| 579 // Test behavior when the mouse becomes hovered without moving. | 597 // Test behavior when the mouse becomes hovered without moving. |
| 580 TEST_F(ImmersiveFullscreenControllerTest, MouseHoveredWithoutMoving) { | 598 TEST_F(ImmersiveFullscreenControllerTest, MouseHoveredWithoutMoving) { |
| 599 // TODO: investigate failure. http://crbug.com/698085. |
| 600 if (WmShell::Get()->IsRunningInMash()) |
| 601 return; |
| 602 |
| 581 SetEnabled(true); | 603 SetEnabled(true); |
| 582 std::unique_ptr<ImmersiveRevealedLock> lock; | 604 std::unique_ptr<ImmersiveRevealedLock> lock; |
| 583 | 605 |
| 584 // 1) Test that if the mouse becomes hovered without the mouse moving due to a | 606 // 1) Test that if the mouse becomes hovered without the mouse moving due to a |
| 585 // lock causing the top-of-window views to be revealed (and the mouse | 607 // lock causing the top-of-window views to be revealed (and the mouse |
| 586 // happening to be near the top of the screen), the top-of-window views do not | 608 // happening to be near the top of the screen), the top-of-window views do not |
| 587 // hide till the mouse moves off of the top-of-window views. | 609 // hide till the mouse moves off of the top-of-window views. |
| 588 SetHovered(true); | 610 SetHovered(true); |
| 589 EXPECT_FALSE(controller()->IsRevealed()); | 611 EXPECT_FALSE(controller()->IsRevealed()); |
| 590 lock.reset(controller()->GetRevealedLock( | 612 lock.reset(controller()->GetRevealedLock( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 620 EXPECT_TRUE(controller()->IsRevealed()); | 642 EXPECT_TRUE(controller()->IsRevealed()); |
| 621 SetHovered(false); | 643 SetHovered(false); |
| 622 EXPECT_FALSE(controller()->IsRevealed()); | 644 EXPECT_FALSE(controller()->IsRevealed()); |
| 623 } | 645 } |
| 624 | 646 |
| 625 // Test revealing the top-of-window views using one modality and ending | 647 // Test revealing the top-of-window views using one modality and ending |
| 626 // the reveal via another. For instance, initiating the reveal via a SWIPE_OPEN | 648 // the reveal via another. For instance, initiating the reveal via a SWIPE_OPEN |
| 627 // edge gesture, switching to using the mouse and ending the reveal by moving | 649 // edge gesture, switching to using the mouse and ending the reveal by moving |
| 628 // the mouse off of the top-of-window views. | 650 // the mouse off of the top-of-window views. |
| 629 TEST_F(ImmersiveFullscreenControllerTest, DifferentModalityEnterExit) { | 651 TEST_F(ImmersiveFullscreenControllerTest, DifferentModalityEnterExit) { |
| 652 // TODO: investigate failure. http://crbug.com/698085. |
| 653 if (WmShell::Get()->IsRunningInMash()) |
| 654 return; |
| 655 |
| 630 SetEnabled(true); | 656 SetEnabled(true); |
| 631 EXPECT_TRUE(controller()->IsEnabled()); | 657 EXPECT_TRUE(controller()->IsEnabled()); |
| 632 EXPECT_FALSE(controller()->IsRevealed()); | 658 EXPECT_FALSE(controller()->IsRevealed()); |
| 633 | 659 |
| 634 // Initiate reveal via gesture, end reveal via mouse. | 660 // Initiate reveal via gesture, end reveal via mouse. |
| 635 AttemptReveal(MODALITY_GESTURE_SCROLL); | 661 AttemptReveal(MODALITY_GESTURE_SCROLL); |
| 636 EXPECT_TRUE(controller()->IsRevealed()); | 662 EXPECT_TRUE(controller()->IsRevealed()); |
| 637 MoveMouse(1, 1); | 663 MoveMouse(1, 1); |
| 638 EXPECT_TRUE(controller()->IsRevealed()); | 664 EXPECT_TRUE(controller()->IsRevealed()); |
| 639 AttemptUnreveal(MODALITY_MOUSE); | 665 AttemptUnreveal(MODALITY_MOUSE); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 653 | 679 |
| 654 // Initiate reveal via mouse, end reveal via touch. | 680 // Initiate reveal via mouse, end reveal via touch. |
| 655 AttemptReveal(MODALITY_MOUSE); | 681 AttemptReveal(MODALITY_MOUSE); |
| 656 EXPECT_TRUE(controller()->IsRevealed()); | 682 EXPECT_TRUE(controller()->IsRevealed()); |
| 657 AttemptUnreveal(MODALITY_GESTURE_TAP); | 683 AttemptUnreveal(MODALITY_GESTURE_TAP); |
| 658 EXPECT_FALSE(controller()->IsRevealed()); | 684 EXPECT_FALSE(controller()->IsRevealed()); |
| 659 } | 685 } |
| 660 | 686 |
| 661 // Test when the SWIPE_CLOSE edge gesture closes the top-of-window views. | 687 // Test when the SWIPE_CLOSE edge gesture closes the top-of-window views. |
| 662 TEST_F(ImmersiveFullscreenControllerTest, EndRevealViaGesture) { | 688 TEST_F(ImmersiveFullscreenControllerTest, EndRevealViaGesture) { |
| 689 // TODO: investigate failure. http://crbug.com/698085. |
| 690 if (WmShell::Get()->IsRunningInMash()) |
| 691 return; |
| 692 |
| 663 SetEnabled(true); | 693 SetEnabled(true); |
| 664 EXPECT_TRUE(controller()->IsEnabled()); | 694 EXPECT_TRUE(controller()->IsEnabled()); |
| 665 EXPECT_FALSE(controller()->IsRevealed()); | 695 EXPECT_FALSE(controller()->IsRevealed()); |
| 666 | 696 |
| 667 // A gesture should be able to close the top-of-window views when | 697 // A gesture should be able to close the top-of-window views when |
| 668 // top-of-window views have focus. | 698 // top-of-window views have focus. |
| 669 AttemptReveal(MODALITY_MOUSE); | 699 AttemptReveal(MODALITY_MOUSE); |
| 670 top_container()->RequestFocus(); | 700 top_container()->RequestFocus(); |
| 671 EXPECT_TRUE(controller()->IsRevealed()); | 701 EXPECT_TRUE(controller()->IsRevealed()); |
| 672 AttemptUnreveal(MODALITY_GESTURE_SCROLL); | 702 AttemptUnreveal(MODALITY_GESTURE_SCROLL); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 685 EXPECT_TRUE(controller()->IsRevealed()); | 715 EXPECT_TRUE(controller()->IsRevealed()); |
| 686 AttemptUnreveal(MODALITY_GESTURE_SCROLL); | 716 AttemptUnreveal(MODALITY_GESTURE_SCROLL); |
| 687 EXPECT_TRUE(controller()->IsRevealed()); | 717 EXPECT_TRUE(controller()->IsRevealed()); |
| 688 lock.reset(); | 718 lock.reset(); |
| 689 EXPECT_FALSE(controller()->IsRevealed()); | 719 EXPECT_FALSE(controller()->IsRevealed()); |
| 690 } | 720 } |
| 691 | 721 |
| 692 // Tests that touch-gesture can be used to reveal the top-of-window views when | 722 // Tests that touch-gesture can be used to reveal the top-of-window views when |
| 693 // the child window consumes all events. | 723 // the child window consumes all events. |
| 694 TEST_F(ImmersiveFullscreenControllerTest, RevealViaGestureChildConsumesEvents) { | 724 TEST_F(ImmersiveFullscreenControllerTest, RevealViaGestureChildConsumesEvents) { |
| 725 // TODO: investigate failure. http://crbug.com/698085. |
| 726 if (WmShell::Get()->IsRunningInMash()) |
| 727 return; |
| 728 |
| 695 // Enabling initially hides the top views. | 729 // Enabling initially hides the top views. |
| 696 SetEnabled(true); | 730 SetEnabled(true); |
| 697 EXPECT_TRUE(controller()->IsEnabled()); | 731 EXPECT_TRUE(controller()->IsEnabled()); |
| 698 EXPECT_FALSE(controller()->IsRevealed()); | 732 EXPECT_FALSE(controller()->IsRevealed()); |
| 699 | 733 |
| 700 aura::test::TestWindowDelegate child_delegate; | 734 aura::test::TestWindowDelegate child_delegate; |
| 701 std::unique_ptr<aura::Window> child( | 735 std::unique_ptr<aura::Window> child( |
| 702 CreateTestWindowInShellWithDelegateAndType( | 736 CreateTestWindowInShellWithDelegateAndType( |
| 703 &child_delegate, ui::wm::WINDOW_TYPE_CONTROL, 1234, gfx::Rect())); | 737 &child_delegate, ui::wm::WINDOW_TYPE_CONTROL, 1234, gfx::Rect())); |
| 704 content_view()->Attach(child.get()); | 738 content_view()->Attach(child.get()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 EXPECT_TRUE(window_state->in_immersive_fullscreen()); | 795 EXPECT_TRUE(window_state->in_immersive_fullscreen()); |
| 762 | 796 |
| 763 SetEnabled(false); | 797 SetEnabled(false); |
| 764 ASSERT_FALSE(controller()->IsEnabled()); | 798 ASSERT_FALSE(controller()->IsEnabled()); |
| 765 EXPECT_FALSE(window_state->in_immersive_fullscreen()); | 799 EXPECT_FALSE(window_state->in_immersive_fullscreen()); |
| 766 } | 800 } |
| 767 | 801 |
| 768 // Test how focus and activation affects whether the top-of-window views are | 802 // Test how focus and activation affects whether the top-of-window views are |
| 769 // revealed. | 803 // revealed. |
| 770 TEST_F(ImmersiveFullscreenControllerTest, Focus) { | 804 TEST_F(ImmersiveFullscreenControllerTest, Focus) { |
| 805 // TODO: investigate failure. http://crbug.com/698085. |
| 806 if (WmShell::Get()->IsRunningInMash()) |
| 807 return; |
| 808 |
| 771 // Add views to the view hierarchy which we will focus and unfocus during the | 809 // Add views to the view hierarchy which we will focus and unfocus during the |
| 772 // test. | 810 // test. |
| 773 views::View* child_view = new views::View(); | 811 views::View* child_view = new views::View(); |
| 774 child_view->SetBounds(0, 0, 10, 10); | 812 child_view->SetBounds(0, 0, 10, 10); |
| 775 child_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); | 813 child_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 776 top_container()->AddChildView(child_view); | 814 top_container()->AddChildView(child_view); |
| 777 views::View* unrelated_view = new views::View(); | 815 views::View* unrelated_view = new views::View(); |
| 778 unrelated_view->SetBounds(0, 100, 10, 10); | 816 unrelated_view->SetBounds(0, 100, 10, 10); |
| 779 unrelated_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); | 817 unrelated_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 780 top_container()->parent()->AddChildView(unrelated_view); | 818 top_container()->parent()->AddChildView(unrelated_view); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 unrelated_view->RequestFocus(); | 864 unrelated_view->RequestFocus(); |
| 827 SetEnabled(true); | 865 SetEnabled(true); |
| 828 EXPECT_TRUE(controller()->IsRevealed()); | 866 EXPECT_TRUE(controller()->IsRevealed()); |
| 829 lock.reset(); | 867 lock.reset(); |
| 830 EXPECT_FALSE(controller()->IsRevealed()); | 868 EXPECT_FALSE(controller()->IsRevealed()); |
| 831 } | 869 } |
| 832 | 870 |
| 833 // Test how transient windows affect whether the top-of-window views are | 871 // Test how transient windows affect whether the top-of-window views are |
| 834 // revealed. | 872 // revealed. |
| 835 TEST_F(ImmersiveFullscreenControllerTest, Transient) { | 873 TEST_F(ImmersiveFullscreenControllerTest, Transient) { |
| 874 // TODO: investigate failure. http://crbug.com/698085. |
| 875 if (WmShell::Get()->IsRunningInMash()) |
| 876 return; |
| 877 |
| 836 views::Widget* top_container_widget = top_container()->GetWidget(); | 878 views::Widget* top_container_widget = top_container()->GetWidget(); |
| 837 | 879 |
| 838 SetEnabled(true); | 880 SetEnabled(true); |
| 839 ASSERT_FALSE(controller()->IsRevealed()); | 881 ASSERT_FALSE(controller()->IsRevealed()); |
| 840 | 882 |
| 841 // 1) Test that a transient window which is not a bubble does not trigger a | 883 // 1) Test that a transient window which is not a bubble does not trigger a |
| 842 // reveal but does keep the top-of-window views revealed if they are already | 884 // reveal but does keep the top-of-window views revealed if they are already |
| 843 // revealed. | 885 // revealed. |
| 844 views::Widget::InitParams transient_params; | 886 views::Widget::InitParams transient_params; |
| 845 transient_params.ownership = | 887 transient_params.ownership = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 871 EXPECT_FALSE(controller()->IsRevealed()); | 913 EXPECT_FALSE(controller()->IsRevealed()); |
| 872 AttemptReveal(MODALITY_MOUSE); | 914 AttemptReveal(MODALITY_MOUSE); |
| 873 EXPECT_TRUE(controller()->IsRevealed()); | 915 EXPECT_TRUE(controller()->IsRevealed()); |
| 874 non_transient_widget->Show(); | 916 non_transient_widget->Show(); |
| 875 SetHovered(false); | 917 SetHovered(false); |
| 876 EXPECT_FALSE(controller()->IsRevealed()); | 918 EXPECT_FALSE(controller()->IsRevealed()); |
| 877 } | 919 } |
| 878 | 920 |
| 879 // Test how bubbles affect whether the top-of-window views are revealed. | 921 // Test how bubbles affect whether the top-of-window views are revealed. |
| 880 TEST_F(ImmersiveFullscreenControllerTest, Bubbles) { | 922 TEST_F(ImmersiveFullscreenControllerTest, Bubbles) { |
| 923 // TODO: investigate failure. http://crbug.com/698085. |
| 924 if (WmShell::Get()->IsRunningInMash()) |
| 925 return; |
| 926 |
| 881 std::unique_ptr<ImmersiveRevealedLock> revealed_lock; | 927 std::unique_ptr<ImmersiveRevealedLock> revealed_lock; |
| 882 views::Widget* top_container_widget = top_container()->GetWidget(); | 928 views::Widget* top_container_widget = top_container()->GetWidget(); |
| 883 | 929 |
| 884 // Add views to the view hierarchy to which we will anchor bubbles. | 930 // Add views to the view hierarchy to which we will anchor bubbles. |
| 885 views::View* child_view = new views::View(); | 931 views::View* child_view = new views::View(); |
| 886 child_view->SetBounds(0, 0, 10, 10); | 932 child_view->SetBounds(0, 0, 10, 10); |
| 887 top_container()->AddChildView(child_view); | 933 top_container()->AddChildView(child_view); |
| 888 views::View* unrelated_view = new views::View(); | 934 views::View* unrelated_view = new views::View(); |
| 889 unrelated_view->SetBounds(0, 100, 10, 10); | 935 unrelated_view->SetBounds(0, 100, 10, 10); |
| 890 top_container()->parent()->AddChildView(unrelated_view); | 936 top_container()->parent()->AddChildView(unrelated_view); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 SetEnabled(true); | 1077 SetEnabled(true); |
| 1032 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1078 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1033 | 1079 |
| 1034 // Disabling immersive fullscreen maintains the user's auto-hide selection. | 1080 // Disabling immersive fullscreen maintains the user's auto-hide selection. |
| 1035 SetEnabled(false); | 1081 SetEnabled(false); |
| 1036 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 1082 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 1037 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1083 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1038 } | 1084 } |
| 1039 | 1085 |
| 1040 } // namespase ash | 1086 } // namespase ash |
| OLD | NEW |