| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/views/message_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 TEST_F(MessagePopupCollectionTest, DetectMouseHover) { | 371 TEST_F(MessagePopupCollectionTest, DetectMouseHover) { |
| 372 std::string id0 = AddNotification(); | 372 std::string id0 = AddNotification(); |
| 373 std::string id1 = AddNotification(); | 373 std::string id1 = AddNotification(); |
| 374 WaitForTransitionsDone(); | 374 WaitForTransitionsDone(); |
| 375 | 375 |
| 376 views::WidgetDelegateView* toast0 = GetToast(id0); | 376 views::WidgetDelegateView* toast0 = GetToast(id0); |
| 377 EXPECT_TRUE(toast0 != NULL); | 377 EXPECT_TRUE(toast0 != NULL); |
| 378 views::WidgetDelegateView* toast1 = GetToast(id1); | 378 views::WidgetDelegateView* toast1 = GetToast(id1); |
| 379 EXPECT_TRUE(toast1 != NULL); | 379 EXPECT_TRUE(toast1 != NULL); |
| 380 | 380 |
| 381 ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), | 381 ui::MouseEvent event( |
| 382 ui::EventTimeForNow(), 0, 0); | 382 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, |
| 383 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 383 | 384 |
| 384 // Test that mouse detection logic works in presence of out-of-order events. | 385 // Test that mouse detection logic works in presence of out-of-order events. |
| 385 toast0->OnMouseEntered(event); | 386 toast0->OnMouseEntered(event); |
| 386 EXPECT_TRUE(MouseInCollection()); | 387 EXPECT_TRUE(MouseInCollection()); |
| 387 toast1->OnMouseEntered(event); | 388 toast1->OnMouseEntered(event); |
| 388 EXPECT_TRUE(MouseInCollection()); | 389 EXPECT_TRUE(MouseInCollection()); |
| 389 toast0->OnMouseExited(event); | 390 toast0->OnMouseExited(event); |
| 390 EXPECT_TRUE(MouseInCollection()); | 391 EXPECT_TRUE(MouseInCollection()); |
| 391 toast1->OnMouseExited(event); | 392 toast1->OnMouseExited(event); |
| 392 EXPECT_FALSE(MouseInCollection()); | 393 EXPECT_FALSE(MouseInCollection()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 407 TEST_F(MessagePopupCollectionTest, DetectMouseHoverWithUserClose) { | 408 TEST_F(MessagePopupCollectionTest, DetectMouseHoverWithUserClose) { |
| 408 std::string id0 = AddNotification(); | 409 std::string id0 = AddNotification(); |
| 409 std::string id1 = AddNotification(); | 410 std::string id1 = AddNotification(); |
| 410 WaitForTransitionsDone(); | 411 WaitForTransitionsDone(); |
| 411 | 412 |
| 412 views::WidgetDelegateView* toast0 = GetToast(id0); | 413 views::WidgetDelegateView* toast0 = GetToast(id0); |
| 413 EXPECT_TRUE(toast0 != NULL); | 414 EXPECT_TRUE(toast0 != NULL); |
| 414 views::WidgetDelegateView* toast1 = GetToast(id1); | 415 views::WidgetDelegateView* toast1 = GetToast(id1); |
| 415 ASSERT_TRUE(toast1 != NULL); | 416 ASSERT_TRUE(toast1 != NULL); |
| 416 | 417 |
| 417 ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), | 418 ui::MouseEvent event( |
| 418 ui::EventTimeForNow(), 0, 0); | 419 ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, |
| 420 0, ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 419 toast1->OnMouseEntered(event); | 421 toast1->OnMouseEntered(event); |
| 420 static_cast<MessageCenterObserver*>(collection())->OnNotificationRemoved( | 422 static_cast<MessageCenterObserver*>(collection())->OnNotificationRemoved( |
| 421 id1, true); | 423 id1, true); |
| 422 | 424 |
| 423 EXPECT_FALSE(MouseInCollection()); | 425 EXPECT_FALSE(MouseInCollection()); |
| 424 std::string id2 = AddNotification(); | 426 std::string id2 = AddNotification(); |
| 425 | 427 |
| 426 WaitForTransitionsDone(); | 428 WaitForTransitionsDone(); |
| 427 views::WidgetDelegateView* toast2 = GetToast(id2); | 429 views::WidgetDelegateView* toast2 = GetToast(id2); |
| 428 EXPECT_TRUE(toast2 != NULL); | 430 EXPECT_TRUE(toast2 != NULL); |
| 429 | 431 |
| 430 CloseAllToasts(); | 432 CloseAllToasts(); |
| 431 WaitForTransitionsDone(); | 433 WaitForTransitionsDone(); |
| 432 } | 434 } |
| 433 | 435 |
| 434 | 436 |
| 435 } // namespace test | 437 } // namespace test |
| 436 } // namespace message_center | 438 } // namespace message_center |
| OLD | NEW |