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

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: Rebase to ToT 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
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/touch/touch_uma.cc » ('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_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 EXPECT_EQ(display.bounds().x(), shelf_bounds.x()); 1486 EXPECT_EQ(display.bounds().x(), shelf_bounds.x());
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 TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) {
1497 ShelfLayoutManager* shelf = GetShelfLayoutManager();
1498 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1499 views::Widget* widget = new views::Widget;
1500 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
1501 params.bounds = gfx::Rect(0, 0, 200, 200);
1502 params.context = CurrentContext();
1503 widget->Init(params);
1504 widget->Show();
1505 widget->Maximize();
1506
1507 aura::Window* window = widget->GetNativeWindow();
1508 shelf->LayoutShelf();
1509
1510 gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen();
1511 gfx::Rect bounds_shelf = window->bounds();
1512 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1513
1514 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1515 shelf->LayoutShelf();
1516 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
1517
1518 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
1519 generator.GestureEdgeSwipe();
1520
1521 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1522 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
1523
1524 widget->SetFullscreen(true);
1525 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false);
1526 shelf->UpdateVisibilityState();
1527
1528 gfx::Rect bounds_fullscreen = window->bounds();
1529 EXPECT_TRUE(widget->IsFullscreen());
1530 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
1531
1532 generator.GestureEdgeSwipe();
1533 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1534 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
1535 EXPECT_FALSE(widget->IsFullscreen());
1536 }
1537
1496 #if defined(OS_WIN) 1538 #if defined(OS_WIN)
1497 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 1539 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
1498 #define MAYBE_GestureDrag DISABLED_GestureDrag 1540 #define MAYBE_GestureDrag DISABLED_GestureDrag
1499 #else 1541 #else
1500 #define MAYBE_GestureDrag GestureDrag 1542 #define MAYBE_GestureDrag GestureDrag
1501 #endif 1543 #endif
1502 1544
1503 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) { 1545 TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) {
1504 // Slop is an implementation detail of gesture recognition, and complicates 1546 // Slop is an implementation detail of gesture recognition, and complicates
1505 // these tests. Ignore it. 1547 // these tests. Ignore it.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 1962 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
1921 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1963 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1922 generator.ClickLeftButton(); 1964 generator.ClickLeftButton();
1923 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1965 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1924 generator.ClickLeftButton(); 1966 generator.ClickLeftButton();
1925 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1967 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1926 } 1968 }
1927 1969
1928 } // namespace internal 1970 } // namespace internal
1929 } // namespace ash 1971 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/touch/touch_uma.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698