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

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

Issue 2683033002: Remove non-MD test coverage from ShelfLayoutManagerTest (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/accelerators/accelerator_controller.h" 7 #include "ash/common/accelerators/accelerator_controller.h"
8 #include "ash/common/accelerators/accelerator_table.h" 8 #include "ash/common/accelerators/accelerator_table.h"
9 #include "ash/common/focus_cycler.h" 9 #include "ash/common/focus_cycler.h"
10 #include "ash/common/material_design/material_design_controller.h"
11 #include "ash/common/session/session_controller.h" 10 #include "ash/common/session/session_controller.h"
12 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
13 #include "ash/common/shelf/shelf_layout_manager_observer.h" 12 #include "ash/common/shelf/shelf_layout_manager_observer.h"
14 #include "ash/common/shelf/shelf_view.h" 13 #include "ash/common/shelf/shelf_view.h"
15 #include "ash/common/shelf/shelf_widget.h" 14 #include "ash/common/shelf/shelf_widget.h"
16 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
17 #include "ash/common/system/status_area_widget.h" 16 #include "ash/common/system/status_area_widget.h"
18 #include "ash/common/system/tray/system_tray.h" 17 #include "ash/common/system/tray/system_tray.h"
19 #include "ash/common/system/tray/system_tray_item.h" 18 #include "ash/common/system/tray/system_tray_item.h"
20 #include "ash/common/wm/window_state.h" 19 #include "ash/common/wm/window_state.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 shelf_bounds.bottom()); 162 shelf_bounds.bottom());
164 EXPECT_EQ(shelf_widget_bounds_.bottom(), shelf_bounds.bottom()); 163 EXPECT_EQ(shelf_widget_bounds_.bottom(), shelf_bounds.bottom());
165 } else if (SHELF_ALIGNMENT_RIGHT == shelf->GetAlignment()) { 164 } else if (SHELF_ALIGNMENT_RIGHT == shelf->GetAlignment()) {
166 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.right(), shelf_bounds.right()); 165 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.right(), shelf_bounds.right());
167 EXPECT_EQ(shelf_widget_bounds_.right(), shelf_bounds.right()); 166 EXPECT_EQ(shelf_widget_bounds_.right(), shelf_bounds.right());
168 } else if (SHELF_ALIGNMENT_LEFT == shelf->GetAlignment()) { 167 } else if (SHELF_ALIGNMENT_LEFT == shelf->GetAlignment()) {
169 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.x(), shelf_bounds.x()); 168 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.x(), shelf_bounds.x());
170 EXPECT_EQ(shelf_widget_bounds_.x(), shelf_bounds.x()); 169 EXPECT_EQ(shelf_widget_bounds_.x(), shelf_bounds.x());
171 } 170 }
172 171
173 // Auto hidden shelf has a visible height of 0 in MD (where this inequality
174 // does not apply); whereas auto hidden shelf has a visible height of 3 in
175 // non-MD.
176 if (!ash::MaterialDesignController::IsImmersiveModeMaterial() ||
177 shelf->GetAutoHideState() != ash::SHELF_AUTO_HIDE_HIDDEN) {
178 EXPECT_GE(shelf_bounds.height(),
179 auto_hidden_shelf_widget_bounds_.height());
tdanderson 2017/02/08 22:36:53 Instead of removing this altogether can you replac
mohsen 2017/02/09 06:57:02 I think I mistakenly removed this check entirely.
mohsen 2017/02/09 21:39:11 Per offline discussions with tdanderson@, this che
180 }
181
182 float scroll_delta = 172 float scroll_delta =
183 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); 173 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x());
184 bool increasing_drag = 174 bool increasing_drag =
185 GetShelfLayoutManager()->SelectValueForShelfAlignment( 175 GetShelfLayoutManager()->SelectValueForShelfAlignment(
186 scroll_delta<0, scroll_delta> 0, scroll_delta < 0); 176 scroll_delta<0, scroll_delta> 0, scroll_delta < 0);
187 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue( 177 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue(
188 shelf_bounds.height(), shelf_bounds.width()); 178 shelf_bounds.height(), shelf_bounds.width());
189 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( 179 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue(
190 shelf_widget_bounds_.height(), shelf_widget_bounds_.width()); 180 shelf_widget_bounds_.height(), shelf_widget_bounds_.width());
191 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( 181 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue(
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 493
504 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| 494 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget|
505 // is fullscreen. (eg browser immersive fullscreen). 495 // is fullscreen. (eg browser immersive fullscreen).
506 widget->SetFullscreen(true); 496 widget->SetFullscreen(true);
507 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); 497 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
508 layout_manager->UpdateVisibilityState(); 498 layout_manager->UpdateVisibilityState();
509 499
510 gfx::Rect bounds_fullscreen = window->bounds(); 500 gfx::Rect bounds_fullscreen = window->bounds();
511 EXPECT_TRUE(widget->IsFullscreen()); 501 EXPECT_TRUE(widget->IsFullscreen());
512 502
513 // Shelf hints are removed in immersive full screen mode in MD; and some shelf 503 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString());
514 // hints are shown in non-MD mode.
515 if (ash::MaterialDesignController::IsImmersiveModeMaterial())
516 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString());
517 else
518 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString());
519 504
520 // Swipe up. This should show the shelf. 505 // Swipe up. This should show the shelf.
521 end = below_start - delta; 506 end = below_start - delta;
522 generator.GestureScrollSequenceWithCallback( 507 generator.GestureScrollSequenceWithCallback(
523 below_start, end, kTimeDelta, kNumScrollSteps, 508 below_start, end, kTimeDelta, kNumScrollSteps,
524 base::Bind(&ShelfDragCallback::ProcessScroll, 509 base::Bind(&ShelfDragCallback::ProcessScroll,
525 base::Unretained(&handler))); 510 base::Unretained(&handler)));
526 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); 511 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
527 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); 512 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState());
528 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); 513 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 // Open keyboard in sticky mode. 1819 // Open keyboard in sticky mode.
1835 kb_controller->ShowKeyboard(true); 1820 kb_controller->ShowKeyboard(true);
1836 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1821 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1837 1822
1838 // Work area should be changed. 1823 // Work area should be changed.
1839 EXPECT_NE(orig_work_area, 1824 EXPECT_NE(orig_work_area,
1840 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1825 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1841 } 1826 }
1842 1827
1843 } // namespace ash 1828 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698