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