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

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 32943006: [Refactor] Replace kFullscreenUsesMinimalChromeKey with WindowState::hide_shelf_when_fullscreen() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/screen_ash.h" 14 #include "ash/screen_ash.h"
15 #include "ash/session_state_delegate.h" 15 #include "ash/session_state_delegate.h"
16 #include "ash/shelf/shelf_layout_manager_observer.h" 16 #include "ash/shelf/shelf_layout_manager_observer.h"
17 #include "ash/shelf/shelf_view.h" 17 #include "ash/shelf/shelf_view.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
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 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget|
583 // is fullscreen. (eg browser immersive fullscreen).
583 widget->SetFullscreen(true); 584 widget->SetFullscreen(true);
584 window->SetProperty(ash::internal::kFullscreenUsesMinimalChromeKey, true); 585 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
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
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 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen
617 // fullscreen). 618 // with or without immersive browser fullscreen).
618 window->SetProperty(ash::internal::kFullscreenUsesMinimalChromeKey, false); 619 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(true);
619 shelf->UpdateVisibilityState(); 620 shelf->UpdateVisibilityState();
620 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 621 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
621 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 622 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
622 623
623 // Swipe-up. This should not change anything. 624 // Swipe-up. This should not change anything.
624 end = start - delta; 625 end = start - delta;
625 generator.GestureScrollSequenceWithCallback(below_start, end, 626 generator.GestureScrollSequenceWithCallback(below_start, end,
626 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, 627 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps,
627 base::Bind(&ShelfDragCallback::ProcessScroll, 628 base::Bind(&ShelfDragCallback::ProcessScroll,
628 base::Unretained(&handler))); 629 base::Unretained(&handler)));
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 1871 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
1871 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1872 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1872 generator.ClickLeftButton(); 1873 generator.ClickLeftButton();
1873 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1874 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1874 generator.ClickLeftButton(); 1875 generator.ClickLeftButton();
1875 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1876 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1876 } 1877 }
1877 1878
1878 } // namespace internal 1879 } // namespace internal
1879 } // namespace ash 1880 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/system/web_notification/web_notification_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698