| 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/web_notification/web_notification_tray.h" | 5 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/shelf/shelf_layout_manager.h" | 10 #include "ash/common/shelf/shelf_layout_manager.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 AddNotification("test_id"); | 475 AddNotification("test_id"); |
| 476 RunAllPendingInMessageLoop(); | 476 RunAllPendingInMessageLoop(); |
| 477 WebNotificationTray* tray = GetTray(); | 477 WebNotificationTray* tray = GetTray(); |
| 478 EXPECT_TRUE(tray->visible()); | 478 EXPECT_TRUE(tray->visible()); |
| 479 | 479 |
| 480 ui::test::EventGenerator& generator = GetEventGenerator(); | 480 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 481 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint(); | 481 gfx::Point center_point = tray->GetBoundsInScreen().CenterPoint(); |
| 482 generator.set_current_location(center_point); | 482 generator.set_current_location(center_point); |
| 483 | 483 |
| 484 generator.PressTouch(); | 484 generator.PressTouch(); |
| 485 EXPECT_TRUE(tray->draw_background_as_active()); | 485 EXPECT_TRUE(tray->is_active()); |
| 486 | 486 |
| 487 generator.ReleaseTouch(); | 487 generator.ReleaseTouch(); |
| 488 EXPECT_TRUE(tray->draw_background_as_active()); | 488 EXPECT_TRUE(tray->is_active()); |
| 489 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible()); | 489 EXPECT_TRUE(tray->IsMessageCenterBubbleVisible()); |
| 490 | 490 |
| 491 generator.GestureTapAt(center_point); | 491 generator.GestureTapAt(center_point); |
| 492 EXPECT_FALSE(tray->draw_background_as_active()); | 492 EXPECT_FALSE(tray->is_active()); |
| 493 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 493 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 494 } | 494 } |
| 495 | 495 |
| 496 // Tests that while touch presses trigger visual feedback, that subsequent non | 496 // Tests that while touch presses trigger visual feedback, that subsequent non |
| 497 // tap gestures cancel the feedback without triggering the message center. | 497 // tap gestures cancel the feedback without triggering the message center. |
| 498 TEST_P(WebNotificationTrayTest, TouchFeedbackCancellation) { | 498 TEST_P(WebNotificationTrayTest, TouchFeedbackCancellation) { |
| 499 AddNotification("test_id"); | 499 AddNotification("test_id"); |
| 500 RunAllPendingInMessageLoop(); | 500 RunAllPendingInMessageLoop(); |
| 501 WebNotificationTray* tray = GetTray(); | 501 WebNotificationTray* tray = GetTray(); |
| 502 EXPECT_TRUE(tray->visible()); | 502 EXPECT_TRUE(tray->visible()); |
| 503 | 503 |
| 504 ui::test::EventGenerator& generator = GetEventGenerator(); | 504 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 505 gfx::Rect bounds = tray->GetBoundsInScreen(); | 505 gfx::Rect bounds = tray->GetBoundsInScreen(); |
| 506 gfx::Point center_point = bounds.CenterPoint(); | 506 gfx::Point center_point = bounds.CenterPoint(); |
| 507 generator.set_current_location(center_point); | 507 generator.set_current_location(center_point); |
| 508 | 508 |
| 509 generator.PressTouch(); | 509 generator.PressTouch(); |
| 510 EXPECT_TRUE(tray->draw_background_as_active()); | 510 EXPECT_TRUE(tray->is_active()); |
| 511 | 511 |
| 512 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y()); | 512 gfx::Point out_of_bounds(bounds.x() - 1, center_point.y()); |
| 513 generator.MoveTouch(out_of_bounds); | 513 generator.MoveTouch(out_of_bounds); |
| 514 EXPECT_FALSE(tray->draw_background_as_active()); | 514 EXPECT_FALSE(tray->is_active()); |
| 515 | 515 |
| 516 generator.ReleaseTouch(); | 516 generator.ReleaseTouch(); |
| 517 EXPECT_FALSE(tray->draw_background_as_active()); | 517 EXPECT_FALSE(tray->is_active()); |
| 518 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 518 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 #endif // OS_CHROMEOS | 521 #endif // OS_CHROMEOS |
| 522 | 522 |
| 523 } // namespace ash | 523 } // namespace ash |
| OLD | NEW |