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

Unified Diff: ash/wm/workspace_controller_unittest.cc

Issue 2017413002: ash: Fix variable names and setters in ShelfLayoutManager and tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shellshelf
Patch Set: rebase Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace_controller_unittest.cc
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index aa81adbdbb64c229325536593eda25a11b84d3c8..7aea16d9ac7b6f2bb3494e31a7d0e8117749b09f 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -376,10 +376,10 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
std::unique_ptr<Window> w1(CreateTestWindow());
const gfx::Rect w1_bounds(0, 1, 101, 102);
- ShelfLayoutManager* shelf = shelf_layout_manager();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
const gfx::Rect touches_shelf_bounds(
- 0, shelf->GetIdealBounds().y() - 10, 101, 102);
+ 0, shelf_layout_manager()->GetIdealBounds().y() - 10, 101, 102);
// Move |w1| to overlap the shelf.
w1->SetBounds(touches_shelf_bounds);
EXPECT_FALSE(GetWindowOverlapsShelf());
@@ -400,25 +400,25 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
w1->Show();
wm::ActivateWindow(w1.get());
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
// Maximize the window.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
// Restore.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
// Fullscreen.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
+ EXPECT_EQ(SHELF_HIDDEN, shelf_layout_manager()->visibility_state());
// Normal.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_FALSE(GetWindowOverlapsShelf());
@@ -432,12 +432,12 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
// Maximize again.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
// Minimize.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
// Since the restore from minimize will restore to the pre-minimize
// state (tested elsewhere), we abandon the current size and restore
@@ -452,7 +452,7 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
// Restore.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
// Create another window, maximized.
@@ -461,8 +461,8 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Show();
wm::ActivateWindow(w2.get());
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(
w2->parent()).ToString(),
@@ -470,7 +470,7 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
// Switch to w1.
wm::ActivateWindow(w1.get());
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(
w2->parent()).ToString(),
@@ -478,8 +478,8 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
// Switch to w2.
wm::ActivateWindow(w2.get());
- EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager()->visibility_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
w2->bounds().ToString());
@@ -673,7 +673,7 @@ class DontCrashOnChangeAndActivateDelegate
// . show the window and during the bounds change activate it.
TEST_F(WorkspaceControllerTest, DontCrashOnChangeAndActivate) {
// Force the shelf
- ShelfLayoutManager* shelf = shelf_layout_manager();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
msw 2016/06/01 00:53:24 ditto nit: inline/cache consistency (in this file)
James Cook 2016/06/01 15:53:07 As above.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
DontCrashOnChangeAndActivateDelegate delegate;
@@ -1395,20 +1395,20 @@ TEST_F(WorkspaceControllerTestDragging, DragWindowOverlapShelf) {
&delegate, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 5, 100, 50), NULL));
ParentWindowInPrimaryRootWindow(w1.get());
- ShelfLayoutManager* shelf = shelf_layout_manager();
- shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+ Shelf::ForPrimaryDisplay()->SetAutoHideBehavior(
+ SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
// Drag near the shelf.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
gfx::Point());
generator.MoveMouseTo(10, 10);
generator.PressLeftButton();
- generator.MoveMouseTo(100, shelf->GetIdealBounds().y() - 70);
+ generator.MoveMouseTo(100, shelf_layout_manager()->GetIdealBounds().y() - 70);
// Shelf should not be in overlapped state.
EXPECT_FALSE(GetWindowOverlapsShelf());
- generator.MoveMouseTo(100, shelf->GetIdealBounds().y() - 20);
+ generator.MoveMouseTo(100, shelf_layout_manager()->GetIdealBounds().y() - 20);
// Shelf should detect overlap. Overlap state stays after mouse is released.
EXPECT_TRUE(GetWindowOverlapsShelf());
@@ -1425,9 +1425,9 @@ TEST_F(WorkspaceControllerTestDragging, DragWindowKeepsShelfAutohidden) {
&delegate, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 5, 100, 50), NULL));
ParentWindowInPrimaryRootWindow(w1.get());
- ShelfLayoutManager* shelf = shelf_layout_manager();
+ Shelf* shelf = Shelf::ForPrimaryDisplay();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
// Drag very little.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
@@ -1437,9 +1437,9 @@ TEST_F(WorkspaceControllerTestDragging, DragWindowKeepsShelfAutohidden) {
generator.MoveMouseTo(12, 12);
// Shelf should be hidden during and after the drag.
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
generator.ReleaseLeftButton();
- EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
+ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager()->auto_hide_state());
}
// Verifies that events are targeted properly just outside the window edges.

Powered by Google App Engine
This is Rietveld 408576698