Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: ui/message_center/views/notification_view_unittest.cc

Issue 1297373004: Don't synthesize mousemove events if the mouse cursor is not on the widget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Query the mouse location instead of caching Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view_unittest.cc
diff --git a/ui/message_center/views/notification_view_unittest.cc b/ui/message_center/views/notification_view_unittest.cc
index 054dfbd97bc7a6c3d351bc25268a5360c166da34..ea44756c69711d6d35df2d2f4d6eb05d324b4f9b 100644
--- a/ui/message_center/views/notification_view_unittest.cc
+++ b/ui/message_center/views/notification_view_unittest.cc
@@ -10,6 +10,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/events/event_processor.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
@@ -25,6 +26,7 @@
#include "ui/message_center/views/proportional_image_view.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/test/views_test_base.h"
+#include "ui/views/test/widget_test.h"
#include "ui/views/widget/widget_delegate.h"
namespace message_center {
@@ -417,11 +419,14 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) {
// Now construct a mouse move event 1 pixel inside the boundary of the action
// button.
gfx::Point cursor_location(1, 1);
- views::View::ConvertPointToWidget(notification_view()->action_buttons_[0],
+ views::View::ConvertPointToScreen(notification_view()->action_buttons_[0],
&cursor_location);
ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location,
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
- widget()->OnMouseEvent(&move);
+ ui::EventDispatchDetails details =
+ views::test::WidgetTest::GetEventProcessor(widget())->
+ OnEventFromSource(&move);
+ EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(views::CustomButton::STATE_HOVERED,
notification_view()->action_buttons_[0]->state());
« no previous file with comments | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698