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

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

Issue 879653002: Remove --ash-enable-tray-dragging flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « ash/shelf/shelf_layout_manager.cc ('k') | ash/wm/gestures/shelf_gesture_handler.h » ('j') | 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/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_controller.h" 10 #include "ash/display/display_controller.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 // Create a simple widget attached to the current context (will 356 // Create a simple widget attached to the current context (will
357 // delete on TearDown). 357 // delete on TearDown).
358 views::Widget* CreateTestWidget() { 358 views::Widget* CreateTestWidget() {
359 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 359 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
360 params.bounds = gfx::Rect(0, 0, 200, 200); 360 params.bounds = gfx::Rect(0, 0, 200, 200);
361 params.context = CurrentContext(); 361 params.context = CurrentContext();
362 return CreateTestWidgetWithParams(params); 362 return CreateTestWidgetWithParams(params);
363 } 363 }
364 364
365 // Overridden from AshTestBase:
366 void SetUp() override {
367 base::CommandLine::ForCurrentProcess()->AppendSwitch(
368 ash::switches::kAshEnableTrayDragging);
369 test::AshTestBase::SetUp();
370 }
371
372 void RunGestureDragTests(gfx::Vector2d); 365 void RunGestureDragTests(gfx::Vector2d);
373 366
374 // Turn on the lock screen. 367 // Turn on the lock screen.
375 void LockScreen() { 368 void LockScreen() {
376 Shell::GetInstance()->session_state_delegate()->LockScreen(); 369 Shell::GetInstance()->session_state_delegate()->LockScreen();
377 // The test session state delegate does not fire the lock state change. 370 // The test session state delegate does not fire the lock state change.
378 Shell::GetInstance()->OnLockStateChanged(true); 371 Shell::GetInstance()->OnLockStateChanged(true);
379 } 372 }
380 373
381 // Turn off the lock screen. 374 // Turn off the lock screen.
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 generator.GestureScrollSequence(start, end, 1967 generator.GestureScrollSequence(start, end,
1975 base::TimeDelta::FromMilliseconds(10), 1); 1968 base::TimeDelta::FromMilliseconds(10), 1);
1976 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 1969 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
1977 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 1970 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
1978 ShelfAnimationWaiter waiter2(auto_hidden_bounds); 1971 ShelfAnimationWaiter waiter2(auto_hidden_bounds);
1979 waiter2.WaitTillDoneAnimating(); 1972 waiter2.WaitTillDoneAnimating();
1980 EXPECT_TRUE(waiter2.WasValidAnimation()); 1973 EXPECT_TRUE(waiter2.WasValidAnimation());
1981 } 1974 }
1982 } 1975 }
1983 1976
1984 TEST_F(ShelfLayoutManagerTest, GestureRevealsTrayBubble) {
1985 if (!SupportsHostWindowResize())
1986 return;
1987
1988 ShelfLayoutManager* shelf = GetShelfLayoutManager();
1989 shelf->LayoutShelf();
1990
1991 // Create a visible window so auto-hide behavior is enforced.
1992 CreateTestWidget();
1993
1994 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
1995 SystemTray* tray = GetSystemTray();
1996
1997 // First, make sure the shelf is visible.
1998 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1999 EXPECT_FALSE(tray->HasSystemBubble());
2000
2001 // Now, drag up on the tray to show the bubble.
2002 gfx::Point start = GetShelfWidget()->status_area_widget()->
2003 GetWindowBoundsInScreen().CenterPoint();
2004 gfx::Point end(start.x(), start.y() - 100);
2005 generator.GestureScrollSequence(start, end,
2006 base::TimeDelta::FromMilliseconds(10), 1);
2007 EXPECT_TRUE(tray->HasSystemBubble());
2008 tray->CloseSystemBubble();
2009 RunAllPendingInMessageLoop();
2010 EXPECT_FALSE(tray->HasSystemBubble());
2011
2012 // Drag again, but only a small amount, and slowly. The bubble should not be
2013 // visible.
2014 end.set_y(start.y() - 30);
2015 generator.GestureScrollSequence(start, end,
2016 base::TimeDelta::FromMilliseconds(500), 100);
2017 EXPECT_FALSE(tray->HasSystemBubble());
2018
2019 // Now, hide the shelf.
2020 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
2021
2022 // Start a drag from the bezel, and drag up to show both the shelf and the
2023 // tray bubble.
2024 start.set_y(start.y() + 100);
2025 end.set_y(start.y() - 400);
2026 generator.GestureScrollSequence(start, end,
2027 base::TimeDelta::FromMilliseconds(10), 1);
2028 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
2029 EXPECT_TRUE(tray->HasSystemBubble());
2030 }
2031
2032 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { 1977 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) {
2033 ShelfLayoutManager* shelf = GetShelfLayoutManager(); 1978 ShelfLayoutManager* shelf = GetShelfLayoutManager();
2034 1979
2035 // Create a visible window so auto-hide behavior is enforced. 1980 // Create a visible window so auto-hide behavior is enforced.
2036 CreateTestWidget(); 1981 CreateTestWidget();
2037 1982
2038 // Turn on auto-hide for the shelf. 1983 // Turn on auto-hide for the shelf.
2039 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1984 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
2040 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 1985 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
2041 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 1986 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 2215 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
2271 gfx::Rect hide_target_bounds = status_window->GetTargetBounds(); 2216 gfx::Rect hide_target_bounds = status_window->GetTargetBounds();
2272 EXPECT_GT(hide_target_bounds.y(), initial_bounds.y()); 2217 EXPECT_GT(hide_target_bounds.y(), initial_bounds.y());
2273 2218
2274 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 2219 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
2275 gfx::Rect reshow_target_bounds = status_window->GetTargetBounds(); 2220 gfx::Rect reshow_target_bounds = status_window->GetTargetBounds();
2276 EXPECT_EQ(initial_bounds, reshow_target_bounds); 2221 EXPECT_EQ(initial_bounds, reshow_target_bounds);
2277 } 2222 }
2278 2223
2279 } // namespace ash 2224 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/wm/gestures/shelf_gesture_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698