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

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

Issue 143023003: Fully support the autohide shelf option for touch UI on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile out edge swipe code on non-Windows, and add tests. Created 6 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 | 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"
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 EXPECT_EQ(display.bounds().width(), shelf_bounds.width()); 1487 EXPECT_EQ(display.bounds().width(), shelf_bounds.width());
1488 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1488 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1489 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); 1489 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
1490 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, 1490 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1491 display.GetWorkAreaInsets().top()); 1491 display.GetWorkAreaInsets().top());
1492 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, 1492 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1493 display.work_area().y() - display.bounds().y()); 1493 display.work_area().y() - display.bounds().y());
1494 } 1494 }
1495 1495
1496 #if defined(OS_WIN) 1496 #if defined(OS_WIN)
1497 #define MAYBE_GestureEdgeSwipe GestureEdgeSwipe
1498 #else
1499 #define MAYBE_GestureEdgeSwipe DISABLED_GestureEdgeSwipe
1500 #endif
1501
1502 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureEdgeSwipe) {
1503 ShelfLayoutManager* shelf = GetShelfLayoutManager();
1504 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1505 views::Widget* widget = new views::Widget;
1506 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
1507 params.bounds = gfx::Rect(0, 0, 200, 200);
1508 params.context = CurrentContext();
1509 widget->Init(params);
1510 widget->Show();
1511 widget->Maximize();
1512
1513 aura::Window* window = widget->GetNativeWindow();
1514 shelf->LayoutShelf();
1515
1516 gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen();
1517 gfx::Rect bounds_shelf = window->bounds();
1518 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1519
1520 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1521 shelf->LayoutShelf();
1522 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
1523
1524 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
1525 generator.GestureEdgeSwipe();
1526
1527 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1528 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
1529
1530 widget->SetFullscreen(true);
1531 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
1532 shelf->UpdateVisibilityState();
1533
1534 gfx::Rect bounds_fullscreen = window->bounds();
1535 EXPECT_TRUE(widget->IsFullscreen());
1536 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
1537
1538 generator.GestureEdgeSwipe();
1539 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1540 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
1541 EXPECT_FALSE(widget->IsFullscreen());
1542 }
1543
1544 #if defined(OS_WIN)
1497 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 1545 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
1498 #define MAYBE_GestureDrag DISABLED_GestureDrag 1546 #define MAYBE_GestureDrag DISABLED_GestureDrag
1499 #else 1547 #else
1500 #define MAYBE_GestureDrag GestureDrag 1548 #define MAYBE_GestureDrag GestureDrag
1501 #endif 1549 #endif
1502 1550
1503 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) { 1551 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) {
1504 // Slop is an implementation detail of gesture recognition, and complicates 1552 // Slop is an implementation detail of gesture recognition, and complicates
1505 // these tests. Ignore it. 1553 // these tests. Ignore it.
1506 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(0); 1554 ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(0);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 1968 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
1921 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1969 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1922 generator.ClickLeftButton(); 1970 generator.ClickLeftButton();
1923 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1971 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1924 generator.ClickLeftButton(); 1972 generator.ClickLeftButton();
1925 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1973 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1926 } 1974 }
1927 1975
1928 } // namespace internal 1976 } // namespace internal
1929 } // namespace ash 1977 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698