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

Unified Diff: ash/system/tray/system_tray_unittest.cc

Issue 23928004: ash:Shelf - Update position and hit box of status area. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe Created 7 years, 3 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
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray_unittest.cc
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc
index 6d0b4d9e822b7b95f94676542b0fc35f533db9d6..2a2bfee3c0ebf959ae08dcc7e3b0c1c0e1849df3 100644
--- a/ash/system/tray/system_tray_unittest.cc
+++ b/ash/system/tray/system_tray_unittest.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "ash/root_window_controller.h"
+#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
@@ -27,8 +28,6 @@ namespace test {
namespace {
-const int kStatusTrayOffsetFromScreenEdgeForTest = 4;
-
SystemTray* GetSystemTray() {
return Shell::GetPrimaryRootWindowController()->shelf()->
status_area_widget()->system_tray();
@@ -295,44 +294,41 @@ TEST_F(SystemTrayTest, BubbleCreationTypesTest) {
EXPECT_EQ(widget, test_item->default_view()->GetWidget());
}
-// Tests that the tray is laid out properly in the widget to make sure that the
-// tray extends to the correct edge of the screen.
+// Tests that the tray is laid out properly and is fully contained within
+// the shelf.
TEST_F(SystemTrayTest, TrayBoundsInWidget) {
+ internal::ShelfLayoutManager* manager =
+ Shell::GetPrimaryRootWindowController()->shelf()->shelf_layout_manager();
internal::StatusAreaWidget* widget =
Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget();
SystemTray* tray = widget->system_tray();
- // Test in bottom alignment. Bottom and right edges of the view should be
- // aligned with the widget.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_BOTTOM);
+ // Test in bottom alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
gfx::Rect window_bounds = widget->GetWindowBoundsInScreen();
gfx::Rect tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(),
- tray_bounds.bottom() + kStatusTrayOffsetFromScreenEdgeForTest);
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
-
- // Test in the top alignment. Top and right edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_TOP);
- window_bounds = widget->GetWindowBoundsInScreen();
- tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.y(),
- tray_bounds.y() - kStatusTrayOffsetFromScreenEdgeForTest);
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
- // Test in the left alignment. Left and bottom edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT);
+ // Test in the left alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_LEFT);
window_bounds = widget->GetWindowBoundsInScreen();
tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom());
- EXPECT_EQ(window_bounds.x(),
- tray_bounds.x() - kStatusTrayOffsetFromScreenEdgeForTest);
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
- // Test in the right alignment. Right and bottom edges should match.
- widget->SetShelfAlignment(SHELF_ALIGNMENT_LEFT);
+ // Test in the right alignment.
+ manager->SetAlignment(SHELF_ALIGNMENT_LEFT);
window_bounds = widget->GetWindowBoundsInScreen();
tray_bounds = tray->GetBoundsInScreen();
- EXPECT_EQ(window_bounds.bottom(), tray_bounds.bottom());
- EXPECT_EQ(window_bounds.right(), tray_bounds.right());
+ EXPECT_TRUE(window_bounds.bottom() >= tray_bounds.bottom());
+ EXPECT_TRUE(window_bounds.right() >= tray_bounds.right());
+ EXPECT_TRUE(window_bounds.x() >= tray_bounds.x());
+ EXPECT_TRUE(window_bounds.y() >= tray_bounds.y());
}
} // namespace test
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698