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

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 23416003: Add content::RenderWidgetHost::MouseEventCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased changes Created 7 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
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index d33e048ade32cb250bdc4d5872027ff67df62345..54138de12067d879b654cd1c504fdc933cc09552 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -605,14 +605,20 @@ class MockPaintingObserver : public NotificationObserver {
class RenderWidgetHostTest : public testing::Test {
public:
- RenderWidgetHostTest() : process_(NULL), handle_key_press_event_(false) {
+ RenderWidgetHostTest()
+ : process_(NULL),
+ handle_key_press_event_(false),
+ handle_mouse_event_(false) {
}
virtual ~RenderWidgetHostTest() {
}
- bool KeyPressEventCallback(const NativeWebKeyboardEvent& event) {
+ bool KeyPressEventCallback(const NativeWebKeyboardEvent& /* event */) {
return handle_key_press_event_;
}
+ bool MouseEventCallback(const WebKit::WebMouseEvent& /* event */) {
+ return handle_mouse_event_;
+ }
protected:
// testing::Test
@@ -817,6 +823,7 @@ class RenderWidgetHostTest : public testing::Test {
scoped_ptr<TestView> view_;
scoped_ptr<gfx::Screen> screen_;
bool handle_key_press_event_;
+ bool handle_mouse_event_;
private:
WebTouchEvent touch_event_;
@@ -2518,6 +2525,24 @@ TEST_F(RenderWidgetHostTest, KeyboardListenerSuppressFollowingEvents) {
EXPECT_TRUE(host_->mock_input_router()->sent_keyboard_event_);
}
+TEST_F(RenderWidgetHostTest, MouseEventCallbackCanHandleEvent) {
+ host_->SetupForInputRouterTest();
+
+ host_->AddMouseEventCallback(
+ base::Bind(&RenderWidgetHostTest::MouseEventCallback,
+ base::Unretained(this)));
+
+ handle_mouse_event_ = true;
+ SimulateMouseEvent(WebInputEvent::MouseDown);
+
+ EXPECT_FALSE(host_->mock_input_router()->sent_mouse_event_);
+
+ handle_mouse_event_ = false;
+ SimulateMouseEvent(WebInputEvent::MouseDown);
+
+ EXPECT_TRUE(host_->mock_input_router()->sent_mouse_event_);
+}
+
TEST_F(RenderWidgetHostTest, InputRouterReceivesHandleInputEvent_ACK) {
host_->SetupForInputRouterTest();
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/public/browser/render_widget_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698