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

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

Issue 2368343002: Revert auto-hide-invisible mode for ARC++ (Closed)
Patch Set: Revert "Use MD-ash's auto hide behavior for arc++ windows." Created 4 years, 2 months 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
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/common/shelf/shelf_layout_manager.h" 5 #include "ash/common/shelf/shelf_layout_manager.h"
6 6
7 #include "ash/aura/wm_shelf_aura.h" 7 #include "ash/aura/wm_shelf_aura.h"
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/accelerator_table.h" 10 #include "ash/common/accelerators/accelerator_table.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); 515 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
516 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 516 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
517 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); 517 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
518 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); 518 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
519 EXPECT_EQ(shelf_hidden.ToString(), 519 EXPECT_EQ(shelf_hidden.ToString(),
520 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); 520 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
521 521
522 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| 522 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget|
523 // is fullscreen. (eg browser immersive fullscreen). 523 // is fullscreen. (eg browser immersive fullscreen).
524 widget->SetFullscreen(true); 524 widget->SetFullscreen(true);
525 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( 525 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
526 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE);
527 layout_manager->UpdateVisibilityState(); 526 layout_manager->UpdateVisibilityState();
528 527
529 gfx::Rect bounds_fullscreen = window->bounds(); 528 gfx::Rect bounds_fullscreen = window->bounds();
530 EXPECT_TRUE(widget->IsFullscreen()); 529 EXPECT_TRUE(widget->IsFullscreen());
531 530
532 // Shelf hints are removed in immersive full screen mode in MD; and some shelf 531 // Shelf hints are removed in immersive full screen mode in MD; and some shelf
533 // hints are shown in non-MD mode. 532 // hints are shown in non-MD mode.
534 if (ash::MaterialDesignController::IsImmersiveModeMaterial()) 533 if (ash::MaterialDesignController::IsImmersiveModeMaterial())
535 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); 534 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString());
536 else 535 else
(...skipping 17 matching lines...) Expand all
554 below_start, end, kTimeDelta, kNumScrollSteps, 553 below_start, end, kTimeDelta, kNumScrollSteps,
555 base::Bind(&ShelfDragCallback::ProcessScroll, 554 base::Bind(&ShelfDragCallback::ProcessScroll,
556 base::Unretained(&handler))); 555 base::Unretained(&handler)));
557 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); 556 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
558 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); 557 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
559 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 558 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
560 EXPECT_EQ(shelf_hidden.ToString(), 559 EXPECT_EQ(shelf_hidden.ToString(),
561 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); 560 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
562 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); 561 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString());
563 562
564 // Set the shelf to be auto hide and invisible when |widget| is fullscreen.
565 // (used in arc immersive fullscreen)
566 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen(
567 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE);
568 layout_manager->UpdateVisibilityState();
569 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
570 EXPECT_TRUE(widget->IsFullscreen());
571 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
572 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
573
574 // Switch from invisible to visible autohide.
575 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen(
576 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE);
577 layout_manager->UpdateVisibilityState();
578 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
579 EXPECT_TRUE(widget->IsFullscreen());
580
581 // Auto hidden shelf has a visible height of 0 in MD (where this inequality
582 // does not apply); whereas auto hidden shelf has a visible height of 3 in
583 // non-MD.
584 if (ash::MaterialDesignController::IsImmersiveModeMaterial()) {
585 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
586 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
587 } else {
588 EXPECT_NE(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
589 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
590 }
591
592 // Switch from visible to invisible autohide.
593 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen(
594 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE);
595 layout_manager->UpdateVisibilityState();
596 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
597 EXPECT_TRUE(widget->IsFullscreen());
598 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(),
599 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
600
601 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen 563 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen
602 // with or without immersive browser fullscreen). 564 // with or without immersive browser fullscreen).
603 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( 565 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(true);
604 ash::wm::WindowState::SHELF_HIDDEN);
605 566
606 layout_manager->UpdateVisibilityState(); 567 layout_manager->UpdateVisibilityState();
607 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); 568 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState());
608 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 569 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
609 570
610 // Swipe-up. This should not change anything. 571 // Swipe-up. This should not change anything.
611 end = start - delta; 572 end = start - delta;
612 generator.GestureScrollSequenceWithCallback( 573 generator.GestureScrollSequenceWithCallback(
613 below_start, end, kTimeDelta, kNumScrollSteps, 574 below_start, end, kTimeDelta, kNumScrollSteps,
614 base::Bind(&ShelfDragCallback::ProcessScroll, 575 base::Bind(&ShelfDragCallback::ProcessScroll,
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 // Open keyboard in sticky mode. 2045 // Open keyboard in sticky mode.
2085 kb_controller->ShowKeyboard(true); 2046 kb_controller->ShowKeyboard(true);
2086 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 2047 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
2087 2048
2088 // Work area should be changed. 2049 // Work area should be changed.
2089 EXPECT_NE(orig_work_area, 2050 EXPECT_NE(orig_work_area,
2090 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 2051 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
2091 } 2052 }
2092 2053
2093 } // namespace ash 2054 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/window_state.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