| 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/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 int bottom = GetPopupWorkAreaBottom(); | 471 int bottom = GetPopupWorkAreaBottom(); |
| 472 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); | 472 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); |
| 473 | 473 |
| 474 // System tray is created on the primary display. The popups in the secondary | 474 // System tray is created on the primary display. The popups in the secondary |
| 475 // tray aren't affected. | 475 // tray aren't affected. |
| 476 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); | 476 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); |
| 477 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); | 477 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); |
| 478 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); | 478 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); |
| 479 } | 479 } |
| 480 | 480 |
| 481 // TODO(jonross): This test is failing on ASAN bots, fix the failure and |
| 482 // re-enable. (crbug.com/411881) |
| 481 // TODO(jonross): Replace manually creating TouchEvent with | 483 // TODO(jonross): Replace manually creating TouchEvent with |
| 482 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the | 484 // EventGenerator.PressTouch/ReleaseTouch. Currently they set a width on the |
| 483 // touch event causing the gesture recognizer to target a different view. | 485 // touch event causing the gesture recognizer to target a different view. |
| 484 #if defined(OS_CHROMEOS) | 486 #if defined(OS_CHROMEOS) |
| 485 // Tests that there is visual feedback for touch presses. | 487 // Tests that there is visual feedback for touch presses. |
| 486 TEST_F(WebNotificationTrayTest, TouchFeedback) { | 488 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedback) { |
| 487 AddNotification("test_id"); | 489 AddNotification("test_id"); |
| 488 RunAllPendingInMessageLoop(); | 490 RunAllPendingInMessageLoop(); |
| 489 WebNotificationTray* tray = GetTray(); | 491 WebNotificationTray* tray = GetTray(); |
| 490 EXPECT_TRUE(tray->visible()); | 492 EXPECT_TRUE(tray->visible()); |
| 491 | 493 |
| 492 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 494 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 493 const int touch_id = 0; | 495 const int touch_id = 0; |
| 494 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint(); | 496 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint(); |
| 495 | 497 |
| 496 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id, | 498 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center_point, touch_id, |
| 497 generator.Now()); | 499 generator.Now()); |
| 498 generator.Dispatch(&press); | 500 generator.Dispatch(&press); |
| 499 RunAllPendingInMessageLoop(); | 501 RunAllPendingInMessageLoop(); |
| 500 EXPECT_TRUE(tray->draw_background_as_active()); | 502 EXPECT_TRUE(tray->draw_background_as_active()); |
| 501 | 503 |
| 502 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id, | 504 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center_point, touch_id, |
| 503 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); | 505 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); |
| 504 generator.Dispatch(&release); | 506 generator.Dispatch(&release); |
| 505 RunAllPendingInMessageLoop(); | 507 RunAllPendingInMessageLoop(); |
| 506 EXPECT_TRUE(tray->draw_background_as_active()); | 508 EXPECT_TRUE(tray->draw_background_as_active()); |
| 507 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible()); | 509 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible()); |
| 508 | 510 |
| 509 generator.GestureTapAt(center_point); | 511 generator.GestureTapAt(center_point); |
| 510 RunAllPendingInMessageLoop(); | 512 RunAllPendingInMessageLoop(); |
| 511 EXPECT_FALSE(tray->draw_background_as_active()); | 513 EXPECT_FALSE(tray->draw_background_as_active()); |
| 512 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 514 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 513 } | 515 } |
| 514 | 516 |
| 517 // TODO(jonross): This test is failing on ASAN bots, fix the failure and |
| 518 // re-enable. (crbug.com/411881) |
| 515 // Tests that while touch presses trigger visual feedback, that subsequent non | 519 // Tests that while touch presses trigger visual feedback, that subsequent non |
| 516 // tap gestures cancel the feedback without triggering the message center. | 520 // tap gestures cancel the feedback without triggering the message center. |
| 517 TEST_F(WebNotificationTrayTest, TouchFeedbackCancellation) { | 521 TEST_F(WebNotificationTrayTest, DISABLED_TouchFeedbackCancellation) { |
| 518 AddNotification("test_id"); | 522 AddNotification("test_id"); |
| 519 RunAllPendingInMessageLoop(); | 523 RunAllPendingInMessageLoop(); |
| 520 WebNotificationTray* tray = GetTray(); | 524 WebNotificationTray* tray = GetTray(); |
| 521 EXPECT_TRUE(tray->visible()); | 525 EXPECT_TRUE(tray->visible()); |
| 522 | 526 |
| 523 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 527 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 524 const int touch_id = 0; | 528 const int touch_id = 0; |
| 525 gfx::Rect bounds = tray->GetBoundsInScreen(); | 529 gfx::Rect bounds = tray->GetBoundsInScreen(); |
| 526 gfx::Point center_point = bounds.CenterPoint(); | 530 gfx::Point center_point = bounds.CenterPoint(); |
| 527 | 531 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 542 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); | 546 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); |
| 543 generator.Dispatch(&release); | 547 generator.Dispatch(&release); |
| 544 RunAllPendingInMessageLoop(); | 548 RunAllPendingInMessageLoop(); |
| 545 EXPECT_FALSE(tray->draw_background_as_active()); | 549 EXPECT_FALSE(tray->draw_background_as_active()); |
| 546 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 550 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 547 } | 551 } |
| 548 | 552 |
| 549 #endif // OS_CHROMEOS | 553 #endif // OS_CHROMEOS |
| 550 | 554 |
| 551 } // namespace ash | 555 } // namespace ash |
| OLD | NEW |