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

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

Issue 1849623002: Remove unused ash::SHELF_ALIGNMENT_TOP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/shelf/shelf_tooltip_manager.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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), 174 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(),
175 GetShelfWidget()->GetDimmerBoundsForTest()); 175 GetShelfWidget()->GetDimmerBoundsForTest());
176 176
177 // The shelf should never be smaller than the hidden state. 177 // The shelf should never be smaller than the hidden state.
178 EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); 178 EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height());
179 float scroll_delta = GetShelfLayoutManager()->PrimaryAxisValue( 179 float scroll_delta = GetShelfLayoutManager()->PrimaryAxisValue(
180 scroll_.y(), 180 scroll_.y(),
181 scroll_.x()); 181 scroll_.x());
182 bool increasing_drag = 182 bool increasing_drag =
183 GetShelfWidget()->shelf()->SelectValueForShelfAlignment( 183 GetShelfWidget()->shelf()->SelectValueForShelfAlignment(
184 scroll_delta < 0, scroll_delta > 0, 184 scroll_delta < 0, scroll_delta > 0, scroll_delta < 0);
185 scroll_delta < 0, scroll_delta > 0);
186 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue( 185 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue(
187 shelf_bounds.height(), 186 shelf_bounds.height(),
188 shelf_bounds.width()); 187 shelf_bounds.width());
189 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( 188 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue(
190 visible_bounds_.height(), 189 visible_bounds_.height(),
191 visible_bounds_.width()); 190 visible_bounds_.width());
192 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( 191 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue(
193 not_visible_bounds_.height(), 192 not_visible_bounds_.height(),
194 not_visible_bounds_.width()); 193 not_visible_bounds_.width());
195 if (was_visible_on_drag_start_) { 194 if (was_visible_on_drag_start_) {
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 } 1699 }
1701 1700
1702 1701
1703 #if defined(OS_WIN) 1702 #if defined(OS_WIN)
1704 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 1703 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
1705 #define MAYBE_SetAlignment DISABLED_SetAlignment 1704 #define MAYBE_SetAlignment DISABLED_SetAlignment
1706 #else 1705 #else
1707 #define MAYBE_SetAlignment SetAlignment 1706 #define MAYBE_SetAlignment SetAlignment
1708 #endif 1707 #endif
1709 1708
1710 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT, TOP). 1709 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT).
1711 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { 1710 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
1712 ShelfLayoutManager* shelf = GetShelfLayoutManager(); 1711 ShelfLayoutManager* shelf = GetShelfLayoutManager();
1713 // Force an initial layout. 1712 // Force an initial layout.
1714 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 1713 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1715 shelf->LayoutShelf(); 1714 shelf->LayoutShelf();
1716 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); 1715 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
1717 1716
1718 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 1717 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
1719 gfx::Rect shelf_bounds( 1718 gfx::Rect shelf_bounds(
1720 GetShelfWidget()->GetWindowBoundsInScreen()); 1719 GetShelfWidget()->GetWindowBoundsInScreen());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 EXPECT_EQ(0, display.GetWorkAreaInsets().left()); 1766 EXPECT_EQ(0, display.GetWorkAreaInsets().left());
1768 EXPECT_EQ(display.work_area().right(), shelf_bounds.x()); 1767 EXPECT_EQ(display.work_area().right(), shelf_bounds.x());
1769 EXPECT_EQ(display.bounds().y(), shelf_bounds.y()); 1768 EXPECT_EQ(display.bounds().y(), shelf_bounds.y());
1770 EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); 1769 EXPECT_EQ(display.bounds().height(), shelf_bounds.height());
1771 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 1770 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1772 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); 1771 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
1773 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, 1772 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1774 display.GetWorkAreaInsets().right()); 1773 display.GetWorkAreaInsets().right());
1775 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, 1774 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1776 display.bounds().right() - display.work_area().right()); 1775 display.bounds().right() - display.work_area().right());
1777
1778 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1779 shelf->SetAlignment(SHELF_ALIGNMENT_TOP);
1780 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
1781 shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
1782 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
1783 ASSERT_NE(-1, display.id());
1784 EXPECT_EQ(shelf->GetIdealBounds().height(),
1785 display.GetWorkAreaInsets().top());
1786 EXPECT_GE(shelf_bounds.height(),
1787 GetShelfWidget()->GetContentsView()->GetPreferredSize().height());
1788 EXPECT_EQ(SHELF_ALIGNMENT_TOP, GetSystemTray()->shelf_alignment());
1789 status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen());
1790 EXPECT_GE(status_bounds.height(),
1791 status_area_widget->GetContentsView()->GetPreferredSize().height());
1792 EXPECT_EQ(shelf->GetIdealBounds().height(),
1793 display.GetWorkAreaInsets().top());
1794 EXPECT_EQ(0, display.GetWorkAreaInsets().right());
1795 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
1796 EXPECT_EQ(0, display.GetWorkAreaInsets().left());
1797 EXPECT_EQ(display.work_area().y(), shelf_bounds.bottom());
1798 EXPECT_EQ(display.bounds().x(), shelf_bounds.x());
1799 EXPECT_EQ(display.bounds().width(), shelf_bounds.width());
1800 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
1801 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
1802 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1803 display.GetWorkAreaInsets().top());
1804 EXPECT_EQ(ShelfLayoutManager::kAutoHideSize,
1805 display.work_area().y() - display.bounds().y());
1806 } 1776 }
1807 1777
1808 TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) { 1778 TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) {
1809 ShelfLayoutManager* shelf = GetShelfLayoutManager(); 1779 ShelfLayoutManager* shelf = GetShelfLayoutManager();
1810 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 1780 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
1811 views::Widget* widget = new views::Widget; 1781 views::Widget* widget = new views::Widget;
1812 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 1782 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
1813 params.bounds = gfx::Rect(0, 0, 200, 200); 1783 params.bounds = gfx::Rect(0, 0, 200, 200);
1814 params.context = CurrentContext(); 1784 params.context = CurrentContext();
1815 widget->Init(params); 1785 widget->Init(params);
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 StatusAreaWidget* status_area_widget = 2330 StatusAreaWidget* status_area_widget =
2361 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); 2331 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
2362 EXPECT_TRUE(status_area_widget->IsVisible()); 2332 EXPECT_TRUE(status_area_widget->IsVisible());
2363 // Shelf should be in the first display's area. 2333 // Shelf should be in the first display's area.
2364 // TODO: make this test more robust against changes in font, font size. 2334 // TODO: make this test more robust against changes in font, font size.
2365 EXPECT_EQ("353,453 147x47", 2335 EXPECT_EQ("353,453 147x47",
2366 status_area_widget->GetWindowBoundsInScreen().ToString()); 2336 status_area_widget->GetWindowBoundsInScreen().ToString());
2367 } 2337 }
2368 2338
2369 } // namespace ash 2339 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shelf/shelf_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698