OLD | NEW |
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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
11 #include "ash/accessibility_delegate.h" | 11 #include "ash/accessibility_delegate.h" |
12 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
14 #include "ash/shelf/wm_shelf.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/tray/system_tray_bubble.h" | 17 #include "ash/system/tray/system_tray_bubble.h" |
18 #include "ash/system/tray/system_tray_item.h" | 18 #include "ash/system/tray/system_tray_item.h" |
19 #include "ash/system/tray/tray_constants.h" | 19 #include "ash/system/tray/tray_constants.h" |
20 #include "ash/system/web_notification/web_notification_tray.h" | 20 #include "ash/system/web_notification/web_notification_tray.h" |
21 #include "ash/test/ash_test_base.h" | 21 #include "ash/test/ash_test_base.h" |
22 #include "ash/test/status_area_widget_test_helper.h" | 22 #include "ash/test/status_area_widget_test_helper.h" |
23 #include "ash/test/test_system_tray_item.h" | 23 #include "ash/test/test_system_tray_item.h" |
24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ASSERT_TRUE(tray->CloseSystemBubble()); | 284 ASSERT_TRUE(tray->CloseSystemBubble()); |
285 RunAllPendingInMessageLoop(); | 285 RunAllPendingInMessageLoop(); |
286 ASSERT_FALSE(tray->is_active()); | 286 ASSERT_FALSE(tray->is_active()); |
287 } | 287 } |
288 | 288 |
289 // Closing the system bubble through an alignment change should change the | 289 // Closing the system bubble through an alignment change should change the |
290 // system tray coloring back to normal. | 290 // system tray coloring back to normal. |
291 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { | 291 TEST_F(SystemTrayTest, SystemTrayColoringAfterAlignmentChange) { |
292 SystemTray* tray = GetPrimarySystemTray(); | 292 SystemTray* tray = GetPrimarySystemTray(); |
293 ASSERT_TRUE(tray->GetWidget()); | 293 ASSERT_TRUE(tray->GetWidget()); |
294 WmShelf* shelf = GetPrimaryShelf(); | 294 Shelf* shelf = GetPrimaryShelf(); |
295 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 295 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
296 // At the beginning the tray coloring is not active. | 296 // At the beginning the tray coloring is not active. |
297 ASSERT_FALSE(tray->is_active()); | 297 ASSERT_FALSE(tray->is_active()); |
298 | 298 |
299 // Showing the system bubble should show the background as active. | 299 // Showing the system bubble should show the background as active. |
300 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 300 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
301 ASSERT_TRUE(tray->is_active()); | 301 ASSERT_TRUE(tray->is_active()); |
302 | 302 |
303 // Changing the alignment should close the system bubble and change the | 303 // Changing the alignment should close the system bubble and change the |
304 // background color. | 304 // background color. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view() | 423 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view() |
424 ->GetWidget() | 424 ->GetWidget() |
425 ->GetWindowBoundsInScreen() | 425 ->GetWindowBoundsInScreen() |
426 .ToString()); | 426 .ToString()); |
427 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); | 427 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); |
428 } | 428 } |
429 | 429 |
430 // Tests that the tray view is laid out properly and is fully contained within | 430 // Tests that the tray view is laid out properly and is fully contained within |
431 // the shelf widget. | 431 // the shelf widget. |
432 TEST_F(SystemTrayTest, TrayBoundsInWidget) { | 432 TEST_F(SystemTrayTest, TrayBoundsInWidget) { |
433 WmShelf* shelf = GetPrimaryShelf(); | 433 Shelf* shelf = GetPrimaryShelf(); |
434 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); | 434 StatusAreaWidget* widget = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); |
435 SystemTray* tray = GetPrimarySystemTray(); | 435 SystemTray* tray = GetPrimarySystemTray(); |
436 | 436 |
437 // Test in bottom alignment. | 437 // Test in bottom alignment. |
438 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); | 438 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
439 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); | 439 gfx::Rect window_bounds = widget->GetWindowBoundsInScreen(); |
440 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); | 440 gfx::Rect tray_bounds = tray->GetBoundsInScreen(); |
441 EXPECT_TRUE(window_bounds.Contains(tray_bounds)); | 441 EXPECT_TRUE(window_bounds.Contains(tray_bounds)); |
442 | 442 |
443 // Test in locked alignment. | 443 // Test in locked alignment. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 588 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
589 } | 589 } |
590 | 590 |
591 TEST_F(SystemTrayTest, SeparatorThickness) { | 591 TEST_F(SystemTrayTest, SeparatorThickness) { |
592 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); | 592 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); |
593 } | 593 } |
594 | 594 |
595 } // namespace test | 595 } // namespace test |
596 } // namespace ash | 596 } // namespace ash |
OLD | NEW |