OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
12 #include "ash/focus_cycler.h" | 12 #include "ash/focus_cycler.h" |
13 #include "ash/launcher/launcher.h" | 13 #include "ash/launcher/launcher.h" |
14 #include "ash/launcher/launcher_view.h" | 14 #include "ash/launcher/launcher_view.h" |
15 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
16 #include "ash/screen_ash.h" | 16 #include "ash/screen_ash.h" |
17 #include "ash/session_state_delegate.h" | 17 #include "ash/session_state_delegate.h" |
18 #include "ash/shelf/shelf_layout_manager_observer.h" | 18 #include "ash/shelf/shelf_layout_manager_observer.h" |
19 #include "ash/shelf/shelf_widget.h" | 19 #include "ash/shelf/shelf_widget.h" |
20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
21 #include "ash/shell_window_ids.h" | 21 #include "ash/shell_window_ids.h" |
22 #include "ash/system/status_area_widget.h" | 22 #include "ash/system/status_area_widget.h" |
23 #include "ash/system/tray/system_tray.h" | 23 #include "ash/system/tray/system_tray.h" |
24 #include "ash/system/tray/system_tray_item.h" | 24 #include "ash/system/tray/system_tray_item.h" |
25 #include "ash/test/ash_test_base.h" | 25 #include "ash/test/ash_test_base.h" |
26 #include "ash/test/launcher_test_api.h" | 26 #include "ash/test/launcher_test_api.h" |
27 #include "ash/wm/window_properties.h" | 27 #include "ash/wm/window_state.h" |
28 #include "ash/wm/window_util.h" | 28 #include "ash/wm/window_util.h" |
29 #include "base/command_line.h" | 29 #include "base/command_line.h" |
30 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
31 #include "ui/aura/client/aura_constants.h" | 31 #include "ui/aura/client/aura_constants.h" |
32 #include "ui/aura/root_window.h" | 32 #include "ui/aura/root_window.h" |
33 #include "ui/aura/test/event_generator.h" | 33 #include "ui/aura/test/event_generator.h" |
34 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
35 #include "ui/compositor/layer.h" | 35 #include "ui/compositor/layer.h" |
36 #include "ui/compositor/layer_animator.h" | 36 #include "ui/compositor/layer_animator.h" |
37 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 37 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 base::Bind(&ShelfDragCallback::ProcessScroll, | 573 base::Bind(&ShelfDragCallback::ProcessScroll, |
574 base::Unretained(&handler))); | 574 base::Unretained(&handler))); |
575 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 575 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
576 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 576 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
577 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 577 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
578 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); | 578 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); |
579 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); | 579 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); |
580 EXPECT_EQ(shelf_hidden.ToString(), | 580 EXPECT_EQ(shelf_hidden.ToString(), |
581 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 581 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
582 | 582 |
583 // Enter into fullscreen with minimal chrome (immersive fullscreen). | 583 // Enter into immersive fullscreen with minimal chrome (browser fullscreen). |
584 widget->SetFullscreen(true); | 584 widget->SetFullscreen(true); |
585 window->SetProperty(ash::internal::kFullscreenUsesMinimalChromeKey, true); | 585 wm::GetWindowState(window)->SetFullscreenType( |
| 586 ash::wm::FULLSCREEN_TYPE_IMMERSIVE_MINIMAL_CHROME); |
586 shelf->UpdateVisibilityState(); | 587 shelf->UpdateVisibilityState(); |
587 | 588 |
588 gfx::Rect bounds_fullscreen = window->bounds(); | 589 gfx::Rect bounds_fullscreen = window->bounds(); |
589 EXPECT_TRUE(widget->IsFullscreen()); | 590 EXPECT_TRUE(widget->IsFullscreen()); |
590 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 591 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
591 | 592 |
592 // Swipe up. This should show the shelf. | 593 // Swipe up. This should show the shelf. |
593 end = below_start - delta; | 594 end = below_start - delta; |
594 generator.GestureScrollSequenceWithCallback(below_start, end, | 595 generator.GestureScrollSequenceWithCallback(below_start, end, |
595 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 596 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
(...skipping 11 matching lines...) Expand all Loading... |
607 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 608 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
608 base::Bind(&ShelfDragCallback::ProcessScroll, | 609 base::Bind(&ShelfDragCallback::ProcessScroll, |
609 base::Unretained(&handler))); | 610 base::Unretained(&handler))); |
610 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 611 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
611 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 612 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
612 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 613 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
613 EXPECT_EQ(shelf_hidden.ToString(), | 614 EXPECT_EQ(shelf_hidden.ToString(), |
614 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 615 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
615 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); | 616 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); |
616 | 617 |
617 // Put the window into fullscreen without any chrome at all (eg tab | 618 // Put the window into immersive fullscreen without any chrome at all |
618 // fullscreen). | 619 // (browser immersive fullscreen + tab fullscreen). |
619 window->SetProperty(ash::internal::kFullscreenUsesMinimalChromeKey, false); | 620 wm::GetWindowState(window)->SetFullscreenType( |
| 621 ash::wm::FULLSCREEN_TYPE_IMMERSIVE_NO_CHROME); |
620 shelf->UpdateVisibilityState(); | 622 shelf->UpdateVisibilityState(); |
621 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 623 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
622 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 624 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
623 | 625 |
624 // Swipe-up. This should not change anything. | 626 // Swipe-up. This should not change anything. |
625 end = start - delta; | 627 end = start - delta; |
626 generator.GestureScrollSequenceWithCallback(below_start, end, | 628 generator.GestureScrollSequenceWithCallback(below_start, end, |
627 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 629 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
628 base::Bind(&ShelfDragCallback::ProcessScroll, | 630 base::Bind(&ShelfDragCallback::ProcessScroll, |
629 base::Unretained(&handler))); | 631 base::Unretained(&handler))); |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1873 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
1872 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1874 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1873 generator.ClickLeftButton(); | 1875 generator.ClickLeftButton(); |
1874 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1876 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1875 generator.ClickLeftButton(); | 1877 generator.ClickLeftButton(); |
1876 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1878 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1877 } | 1879 } |
1878 | 1880 |
1879 } // namespace internal | 1881 } // namespace internal |
1880 } // namespace ash | 1882 } // namespace ash |
OLD | NEW |