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

Unified Diff: content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 12 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/renderer/pepper/plugin_instance_throttler_impl_unittest.cc
diff --git a/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc b/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc
index 92b749e5f8f29fdf495d8a24eea488b07cad36bf..3493b4ad6234942306d72edfdfa62e24b1a09293 100644
--- a/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc
+++ b/content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc
@@ -16,6 +16,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
+#include "ui/events/base_event_utils.h"
#include "ui/gfx/canvas.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -63,9 +64,9 @@ class PluginInstanceThrottlerImplTest
bool expect_consumed,
bool expect_throttled,
int expect_change_callback_count) {
- blink::WebMouseEvent event;
- event.type = event_type;
- event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
+ blink::WebMouseEvent event(
+ event_type, blink::WebInputEvent::Modifiers::LeftButtonDown,
+ ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
EXPECT_EQ(expect_consumed, throttler()->ConsumeInputEvent(event));
EXPECT_EQ(expect_throttled, throttler()->IsThrottled());
EXPECT_EQ(expect_change_callback_count, change_callback_calls());
@@ -202,18 +203,18 @@ TEST_F(PluginInstanceThrottlerImplTest, ThrottleOnLeftClickOnly) {
EXPECT_TRUE(throttler()->IsThrottled());
EXPECT_EQ(1, change_callback_calls());
- blink::WebMouseEvent event;
- event.type = blink::WebInputEvent::Type::MouseUp;
-
- event.modifiers = blink::WebInputEvent::Modifiers::RightButtonDown;
+ blink::WebMouseEvent event(
+ blink::WebInputEvent::Type::MouseUp,
+ blink::WebInputEvent::Modifiers::RightButtonDown,
+ ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
EXPECT_FALSE(throttler()->ConsumeInputEvent(event));
EXPECT_TRUE(throttler()->IsThrottled());
- event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
+ event.setModifiers(blink::WebInputEvent::Modifiers::MiddleButtonDown);
EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
EXPECT_TRUE(throttler()->IsThrottled());
- event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
+ event.setModifiers(blink::WebInputEvent::Modifiers::LeftButtonDown);
EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
EXPECT_FALSE(throttler()->IsThrottled());
}

Powered by Google App Engine
This is Rietveld 408576698