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

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

Issue 22121002: Prevent a user from hiding the shelf via a gesture when there are no visible windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved misc parts of this CL to https://codereview.chromium.org/22121002/ Created 7 years, 4 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') | 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/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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 base::Bind(&ShelfDragCallback::ProcessScroll, 569 base::Bind(&ShelfDragCallback::ProcessScroll,
570 base::Unretained(&handler))); 570 base::Unretained(&handler)));
571 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 571 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
572 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 572 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
573 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); 573 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString());
574 574
575 // Close actually, otherwise further event may be affected since widget 575 // Close actually, otherwise further event may be affected since widget
576 // is fullscreen status. 576 // is fullscreen status.
577 widget->Close(); 577 widget->Close();
578 RunAllPendingInMessageLoop(); 578 RunAllPendingInMessageLoop();
579
580 // The shelf should be shown because there are no more visible windows.
581 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
582 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
583 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
584
585 // Swipe-up to hide. This should have no effect because there are no visible
586 // windows.
587 end = below_start - delta;
588 generator.GestureScrollSequenceWithCallback(below_start, end,
589 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps,
590 base::Bind(&ShelfDragCallback::ProcessScroll,
591 base::Unretained(&handler)));
592 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
593 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state());
594 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
579 } 595 }
580 596
581 // Fails on Mac only. Need to be implemented. http://crbug.com/111279. 597 // Fails on Mac only. Need to be implemented. http://crbug.com/111279.
582 #if defined(OS_MACOSX) || defined(OS_WIN) 598 #if defined(OS_MACOSX) || defined(OS_WIN)
583 #define MAYBE_SetVisible DISABLED_SetVisible 599 #define MAYBE_SetVisible DISABLED_SetVisible
584 #else 600 #else
585 #define MAYBE_SetVisible SetVisible 601 #define MAYBE_SetVisible SetVisible
586 #endif 602 #endif
587 // Makes sure SetVisible updates work area and widget appropriately. 603 // Makes sure SetVisible updates work area and widget appropriately.
588 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { 604 TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 scoped_ptr<aura::Window> w1(CreateTestWindow()); 1694 scoped_ptr<aura::Window> w1(CreateTestWindow());
1679 w1->Show(); 1695 w1->Show();
1680 wm::ActivateWindow(w1.get()); 1696 wm::ActivateWindow(w1.get());
1681 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); 1697 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
1682 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); 1698 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
1683 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); 1699 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
1684 } 1700 }
1685 1701
1686 } // namespace internal 1702 } // namespace internal
1687 } // namespace ash 1703 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698