| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 notification_view()->action_buttons_[1]->state()); | 490 notification_view()->action_buttons_[1]->state()); |
| 491 | 491 |
| 492 // Now construct a mouse move event 1 pixel inside the boundary of the action | 492 // Now construct a mouse move event 1 pixel inside the boundary of the action |
| 493 // button. | 493 // button. |
| 494 gfx::Point cursor_location(1, 1); | 494 gfx::Point cursor_location(1, 1); |
| 495 views::View::ConvertPointToScreen(notification_view()->action_buttons_[0], | 495 views::View::ConvertPointToScreen(notification_view()->action_buttons_[0], |
| 496 &cursor_location); | 496 &cursor_location); |
| 497 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, | 497 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, |
| 498 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 498 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 499 ui::EventDispatchDetails details = | 499 ui::EventDispatchDetails details = |
| 500 views::test::WidgetTest::GetEventProcessor(widget())-> | 500 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move); |
| 501 OnEventFromSource(&move); | |
| 502 EXPECT_FALSE(details.dispatcher_destroyed); | 501 EXPECT_FALSE(details.dispatcher_destroyed); |
| 503 | 502 |
| 504 EXPECT_EQ(views::CustomButton::STATE_HOVERED, | 503 EXPECT_EQ(views::CustomButton::STATE_HOVERED, |
| 505 notification_view()->action_buttons_[0]->state()); | 504 notification_view()->action_buttons_[0]->state()); |
| 506 EXPECT_EQ(views::CustomButton::STATE_NORMAL, | 505 EXPECT_EQ(views::CustomButton::STATE_NORMAL, |
| 507 notification_view()->action_buttons_[1]->state()); | 506 notification_view()->action_buttons_[1]->state()); |
| 508 | 507 |
| 509 notification()->set_buttons(CreateButtons(1)); | 508 notification()->set_buttons(CreateButtons(1)); |
| 510 notification_view()->CreateOrUpdateViews(*notification()); | 509 notification_view()->CreateOrUpdateViews(*notification()); |
| 511 | 510 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 543 |
| 545 // Now construct a mouse move event 1 pixel inside the boundary of the action | 544 // Now construct a mouse move event 1 pixel inside the boundary of the action |
| 546 // button. | 545 // button. |
| 547 gfx::Point cursor_location(1, 1); | 546 gfx::Point cursor_location(1, 1); |
| 548 views::View::ConvertPointToScreen(notification_view()->settings_button_view_, | 547 views::View::ConvertPointToScreen(notification_view()->settings_button_view_, |
| 549 &cursor_location); | 548 &cursor_location); |
| 550 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, | 549 ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, |
| 551 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 550 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 552 widget()->OnMouseEvent(&move); | 551 widget()->OnMouseEvent(&move); |
| 553 ui::EventDispatchDetails details = | 552 ui::EventDispatchDetails details = |
| 554 views::test::WidgetTest::GetEventProcessor(widget()) | 553 views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move); |
| 555 ->OnEventFromSource(&move); | |
| 556 EXPECT_FALSE(details.dispatcher_destroyed); | 554 EXPECT_FALSE(details.dispatcher_destroyed); |
| 557 | 555 |
| 558 EXPECT_EQ(views::CustomButton::STATE_HOVERED, | 556 EXPECT_EQ(views::CustomButton::STATE_HOVERED, |
| 559 notification_view()->settings_button_view_->state()); | 557 notification_view()->settings_button_view_->state()); |
| 560 | 558 |
| 561 // Now construct a mouse move event 1 pixel outside the boundary of the | 559 // Now construct a mouse move event 1 pixel outside the boundary of the |
| 562 // widget. | 560 // widget. |
| 563 cursor_location = gfx::Point(-1, -1); | 561 cursor_location = gfx::Point(-1, -1); |
| 564 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, | 562 move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, |
| 565 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 563 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 TEST_F(NotificationViewTest, Pinned) { | 709 TEST_F(NotificationViewTest, Pinned) { |
| 712 notification()->set_pinned(true); | 710 notification()->set_pinned(true); |
| 713 | 711 |
| 714 UpdateNotificationViews(); | 712 UpdateNotificationViews(); |
| 715 EXPECT_EQ(NULL, GetCloseButton()); | 713 EXPECT_EQ(NULL, GetCloseButton()); |
| 716 } | 714 } |
| 717 | 715 |
| 718 #endif // defined(OS_CHROMEOS) | 716 #endif // defined(OS_CHROMEOS) |
| 719 | 717 |
| 720 } // namespace message_center | 718 } // namespace message_center |
| OLD | NEW |