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/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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // if the shelf is being dimmed test dimmer bounds as well. | 176 // if the shelf is being dimmed test dimmer bounds as well. |
177 if (GetShelfWidget()->GetDimsShelf()) | 177 if (GetShelfWidget()->GetDimsShelf()) |
178 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), | 178 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), |
179 GetShelfWidget()->GetDimmerBoundsForTest()); | 179 GetShelfWidget()->GetDimmerBoundsForTest()); |
180 | 180 |
181 // Auto hidden shelf has a visible height of 0 in MD (where this inequality | 181 // Auto hidden shelf has a visible height of 0 in MD (where this inequality |
182 // does not apply); whereas auto hidden shelf has a visible height of 3 in | 182 // does not apply); whereas auto hidden shelf has a visible height of 3 in |
183 // non-MD. | 183 // non-MD. |
184 WmShelf* shelf = test::AshTestBase::GetPrimaryShelf(); | 184 WmShelf* shelf = test::AshTestBase::GetPrimaryShelf(); |
185 if (!ash::MaterialDesignController::IsShelfMaterial() || | 185 if (!ash::MaterialDesignController::IsImmersiveModeMaterial() || |
186 shelf->GetAutoHideState() != ash::SHELF_AUTO_HIDE_HIDDEN) { | 186 shelf->GetAutoHideState() != ash::SHELF_AUTO_HIDE_HIDDEN) { |
187 EXPECT_GE(shelf_bounds.height(), | 187 EXPECT_GE(shelf_bounds.height(), |
188 auto_hidden_shelf_widget_bounds_.height()); | 188 auto_hidden_shelf_widget_bounds_.height()); |
189 } | 189 } |
190 | 190 |
191 float scroll_delta = | 191 float scroll_delta = |
192 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); | 192 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); |
193 bool increasing_drag = | 193 bool increasing_drag = |
194 GetShelfLayoutManager()->SelectValueForShelfAlignment( | 194 GetShelfLayoutManager()->SelectValueForShelfAlignment( |
195 scroll_delta<0, scroll_delta> 0, scroll_delta < 0); | 195 scroll_delta<0, scroll_delta> 0, scroll_delta < 0); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 widget->SetFullscreen(true); | 524 widget->SetFullscreen(true); |
525 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 525 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( |
526 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); | 526 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); |
527 layout_manager->UpdateVisibilityState(); | 527 layout_manager->UpdateVisibilityState(); |
528 | 528 |
529 gfx::Rect bounds_fullscreen = window->bounds(); | 529 gfx::Rect bounds_fullscreen = window->bounds(); |
530 EXPECT_TRUE(widget->IsFullscreen()); | 530 EXPECT_TRUE(widget->IsFullscreen()); |
531 | 531 |
532 // Shelf hints are removed in immersive full screen mode in MD; and some shelf | 532 // Shelf hints are removed in immersive full screen mode in MD; and some shelf |
533 // hints are shown in non-MD mode. | 533 // hints are shown in non-MD mode. |
534 if (ash::MaterialDesignController::IsShelfMaterial()) | 534 if (ash::MaterialDesignController::IsImmersiveModeMaterial()) |
535 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 535 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
536 else | 536 else |
537 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 537 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
538 | 538 |
539 // Swipe up. This should show the shelf. | 539 // Swipe up. This should show the shelf. |
540 end = below_start - delta; | 540 end = below_start - delta; |
541 generator.GestureScrollSequenceWithCallback( | 541 generator.GestureScrollSequenceWithCallback( |
542 below_start, end, kTimeDelta, kNumScrollSteps, | 542 below_start, end, kTimeDelta, kNumScrollSteps, |
543 base::Bind(&ShelfDragCallback::ProcessScroll, | 543 base::Bind(&ShelfDragCallback::ProcessScroll, |
544 base::Unretained(&handler))); | 544 base::Unretained(&handler))); |
(...skipping 19 matching lines...) Expand all Loading... |
564 // Set the shelf to be auto hide and invisible when |widget| is fullscreen. | 564 // Set the shelf to be auto hide and invisible when |widget| is fullscreen. |
565 // (used in arc immersive fullscreen) | 565 // (used in arc immersive fullscreen) |
566 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 566 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( |
567 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); | 567 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); |
568 layout_manager->UpdateVisibilityState(); | 568 layout_manager->UpdateVisibilityState(); |
569 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 569 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
570 EXPECT_TRUE(widget->IsFullscreen()); | 570 EXPECT_TRUE(widget->IsFullscreen()); |
571 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | 571 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), |
572 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 572 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
573 | 573 |
574 // Switch from invisible to visible autodhide. | 574 // Switch from invisible to visible autohide. |
575 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 575 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( |
576 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); | 576 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); |
577 layout_manager->UpdateVisibilityState(); | 577 layout_manager->UpdateVisibilityState(); |
578 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 578 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
579 EXPECT_TRUE(widget->IsFullscreen()); | 579 EXPECT_TRUE(widget->IsFullscreen()); |
580 EXPECT_NE(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | |
581 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | |
582 | 580 |
583 // Switch from invisible to visible autodhide. | 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. |
584 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 593 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( |
585 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); | 594 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); |
586 layout_manager->UpdateVisibilityState(); | 595 layout_manager->UpdateVisibilityState(); |
587 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 596 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
588 EXPECT_TRUE(widget->IsFullscreen()); | 597 EXPECT_TRUE(widget->IsFullscreen()); |
589 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | 598 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), |
590 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 599 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
591 | 600 |
592 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen | 601 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen |
593 // with or without immersive browser fullscreen). | 602 // with or without immersive browser fullscreen). |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 // Open keyboard in sticky mode. | 2084 // Open keyboard in sticky mode. |
2076 kb_controller->ShowKeyboard(true); | 2085 kb_controller->ShowKeyboard(true); |
2077 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 2086 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
2078 | 2087 |
2079 // Work area should be changed. | 2088 // Work area should be changed. |
2080 EXPECT_NE(orig_work_area, | 2089 EXPECT_NE(orig_work_area, |
2081 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 2090 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
2082 } | 2091 } |
2083 | 2092 |
2084 } // namespace ash | 2093 } // namespace ash |
OLD | NEW |