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/common/system/tray/system_tray.h" | 5 #include "ash/common/system/tray/system_tray.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/accelerators/accelerator_controller.h" | 10 #include "ash/common/accelerators/accelerator_controller.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // tray. | 340 // tray. |
341 new_item->tray_view()->SetVisible(false); | 341 new_item->tray_view()->SetVisible(false); |
342 EXPECT_EQ(initial_size.ToString(), | 342 EXPECT_EQ(initial_size.ToString(), |
343 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); | 343 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); |
344 | 344 |
345 new_item->tray_view()->SetVisible(true); | 345 new_item->tray_view()->SetVisible(true); |
346 EXPECT_EQ(new_size.ToString(), | 346 EXPECT_EQ(new_size.ToString(), |
347 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); | 347 tray->GetWidget()->GetWindowBoundsInScreen().size().ToString()); |
348 } | 348 } |
349 | 349 |
350 TEST_F(SystemTrayTest, SystemTrayNotifications) { | |
351 SystemTray* tray = GetPrimarySystemTray(); | |
352 ASSERT_TRUE(tray->GetWidget()); | |
353 | |
354 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | |
355 TestSystemTrayItem* detailed_item = new TestSystemTrayItem(); | |
356 tray->AddTrayItem(base::WrapUnique(test_item)); | |
357 tray->AddTrayItem(base::WrapUnique(detailed_item)); | |
358 | |
359 // Ensure the tray views are created. | |
360 ASSERT_TRUE(test_item->tray_view() != NULL); | |
361 ASSERT_TRUE(detailed_item->tray_view() != NULL); | |
362 | |
363 // Ensure a notification view is created. | |
364 tray->ShowNotificationView(test_item); | |
365 ASSERT_TRUE(test_item->notification_view() != NULL); | |
366 | |
367 // Show the default view, notification view should remain. | |
368 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | |
369 RunAllPendingInMessageLoop(); | |
370 ASSERT_TRUE(test_item->notification_view() != NULL); | |
371 | |
372 // Show the detailed view, ensure the notification view remains. | |
373 tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW); | |
374 RunAllPendingInMessageLoop(); | |
375 ASSERT_TRUE(detailed_item->detailed_view() != NULL); | |
376 ASSERT_TRUE(test_item->notification_view() != NULL); | |
377 | |
378 // Hide the detailed view, ensure the notification view still exists. | |
379 ASSERT_TRUE(tray->CloseSystemBubble()); | |
380 RunAllPendingInMessageLoop(); | |
381 ASSERT_TRUE(detailed_item->detailed_view() == NULL); | |
382 ASSERT_TRUE(test_item->notification_view() != NULL); | |
383 } | |
384 | |
385 // Test is flaky. http://crbug.com/637978 | 350 // Test is flaky. http://crbug.com/637978 |
386 TEST_F(SystemTrayTest, DISABLED_BubbleCreationTypesTest) { | 351 TEST_F(SystemTrayTest, DISABLED_BubbleCreationTypesTest) { |
387 SystemTray* tray = GetPrimarySystemTray(); | 352 SystemTray* tray = GetPrimarySystemTray(); |
388 ASSERT_TRUE(tray->GetWidget()); | 353 ASSERT_TRUE(tray->GetWidget()); |
389 | 354 |
390 TestSystemTrayItem* test_item = new TestSystemTrayItem(); | 355 TestSystemTrayItem* test_item = new TestSystemTrayItem(); |
391 tray->AddTrayItem(base::WrapUnique(test_item)); | 356 tray->AddTrayItem(base::WrapUnique(test_item)); |
392 | 357 |
393 // Ensure the tray views are created. | 358 // Ensure the tray views are created. |
394 ASSERT_TRUE(test_item->tray_view() != NULL); | 359 ASSERT_TRUE(test_item->tray_view() != NULL); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 604 |
640 // Hide the default view, ensure the tray bubble height is back to zero. | 605 // Hide the default view, ensure the tray bubble height is back to zero. |
641 ASSERT_TRUE(tray->CloseSystemBubble()); | 606 ASSERT_TRUE(tray->CloseSystemBubble()); |
642 RunAllPendingInMessageLoop(); | 607 RunAllPendingInMessageLoop(); |
643 | 608 |
644 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); | 609 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); |
645 } | 610 } |
646 | 611 |
647 } // namespace test | 612 } // namespace test |
648 } // namespace ash | 613 } // namespace ash |
OLD | NEW |