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

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 2093283002: mash: Convert all of //ash/system to use WmShelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/system/tray/system_tray_bubble.h" 11 #include "ash/common/system/tray/system_tray_bubble.h"
11 #include "ash/common/system/tray/system_tray_item.h" 12 #include "ash/common/system/tray/system_tray_item.h"
12 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
13 #include "ash/common/system/tray/tray_popup_item_container.h" 14 #include "ash/common/system/tray/tray_popup_item_container.h"
14 #include "ash/shelf/shelf.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/system/status_area_widget.h" 16 #include "ash/system/status_area_widget.h"
17 #include "ash/system/web_notification/web_notification_tray.h" 17 #include "ash/system/web_notification/web_notification_tray.h"
18 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
19 #include "ash/test/status_area_widget_test_helper.h" 19 #include "ash/test/status_area_widget_test_helper.h"
20 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
21 #include "base/run_loop.h" 21 #include "base/run_loop.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/base/ui_base_types.h" 24 #include "ui/base/ui_base_types.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 ASSERT_TRUE(tray->CloseSystemBubble()); 171 ASSERT_TRUE(tray->CloseSystemBubble());
172 RunAllPendingInMessageLoop(); 172 RunAllPendingInMessageLoop();
173 ASSERT_FALSE(tray->draw_background_as_active()); 173 ASSERT_FALSE(tray->draw_background_as_active());
174 } 174 }
175 175
176 // Closing the system bubble through an alignment change should change the 176 // Closing the system bubble through an alignment change should change the
177 // system tray coloring back to normal. 177 // system tray coloring back to normal.
178 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { 178 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) {
179 SystemTray* tray = GetPrimarySystemTray(); 179 SystemTray* tray = GetPrimarySystemTray();
180 ASSERT_TRUE(tray->GetWidget()); 180 ASSERT_TRUE(tray->GetWidget());
181 Shelf* shelf = Shelf::ForPrimaryDisplay(); 181 WmShelf* shelf = WmShelf::ForPrimaryDisplay();
182 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 182 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
183 // At the beginning the tray coloring is not active. 183 // At the beginning the tray coloring is not active.
184 ASSERT_FALSE(tray->draw_background_as_active()); 184 ASSERT_FALSE(tray->draw_background_as_active());
185 185
186 // Showing the system bubble should show the background as active. 186 // Showing the system bubble should show the background as active.
187 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 187 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
188 ASSERT_TRUE(tray->draw_background_as_active()); 188 ASSERT_TRUE(tray->draw_background_as_active());
189 189
190 // Changing the alignment should close the system bubble and change the 190 // Changing the alignment should close the system bubble and change the
191 // background color. 191 // background color.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 RunAllPendingInMessageLoop(); 340 RunAllPendingInMessageLoop();
341 341
342 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> 342 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()->
343 GetWindowBoundsInScreen().ToString()); 343 GetWindowBoundsInScreen().ToString());
344 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); 344 EXPECT_EQ(widget, test_item->default_view()->GetWidget());
345 } 345 }
346 346
347 // Tests that the tray view is laid out properly and is fully contained within 347 // Tests that the tray view is laid out properly and is fully contained within
348 // the shelf widget. 348 // the shelf widget.
349 TEST_F(SystemTrayTest, TrayBoundsInWidget) { 349 TEST_F(SystemTrayTest, TrayBoundsInWidget) {
350 Shelf* shelf = Shelf::ForPrimaryDisplay(); 350 WmShelf* shelf = WmShelf::ForPrimaryDisplay();
351 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); 351 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
352 SystemTray* tray = GetPrimarySystemTray(); 352 SystemTray* tray = GetPrimarySystemTray();
353 353
354 // Test in bottom alignment. 354 // Test in bottom alignment.
355 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); 355 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
356 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); 356 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen();
357 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); 357 gfx::Rect tray_bounds = tray->GetBoundsInScreen();
358 EXPECT_TRUE(window_bounds.Contains(tray_bounds)); 358 EXPECT_TRUE(window_bounds.Contains(tray_bounds));
359 359
360 // Test in locked alignment. 360 // Test in locked alignment.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Hide the default view, ensure the system tray height is back to zero. 548 // Hide the default view, ensure the system tray height is back to zero.
549 ASSERT_TRUE(tray->CloseSystemBubble()); 549 ASSERT_TRUE(tray->CloseSystemBubble());
550 RunAllPendingInMessageLoop(); 550 RunAllPendingInMessageLoop();
551 551
552 EXPECT_EQ(0, notification_tray->system_tray_height_for_test()); 552 EXPECT_EQ(0, notification_tray->system_tray_height_for_test());
553 } 553 }
554 #endif // OS_CHROMEOS 554 #endif // OS_CHROMEOS
555 555
556 } // namespace test 556 } // namespace test
557 } // namespace ash 557 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698