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

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

Issue 802453004: Plugin Power Saver: Improve right-click and middle-click behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0208-plugin-power-saver-fix-black-video-on-resume-problem
Patch Set: Created 6 years 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 | « content/renderer/pepper/pepper_plugin_instance_throttler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc
diff --git a/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc b/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc
index b474f53d08f616af73b99b4b75e4ce57a661cf27..182afae44e1507505a3305cb4eca2776171de12e 100644
--- a/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc
@@ -61,6 +61,7 @@ class PepperPluginInstanceThrottlerTest : public testing::Test {
int expect_change_callback_count) {
blink::WebMouseEvent event;
event.type = event_type;
+ event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
EXPECT_EQ(expect_consumed, throttler()->ConsumeInputEvent(event));
EXPECT_EQ(expect_throttled, throttler()->is_throttled());
EXPECT_EQ(expect_change_callback_count, change_callback_calls());
@@ -189,4 +190,28 @@ TEST_F(PepperPluginInstanceThrottlerTest, EventConsumption) {
SendEventAndTest(blink::WebInputEvent::Type::MouseUp, false, false, 2);
}
+TEST_F(PepperPluginInstanceThrottlerTest, ThrottleOnLeftClickOnly) {
+ EXPECT_FALSE(throttler()->is_throttled());
+ EXPECT_EQ(0, change_callback_calls());
+
+ EngageThrottle();
+ EXPECT_TRUE(throttler()->is_throttled());
+ EXPECT_EQ(1, change_callback_calls());
+
+ blink::WebMouseEvent event;
+ event.type = blink::WebInputEvent::Type::MouseUp;
+
+ event.modifiers = blink::WebInputEvent::Modifiers::RightButtonDown;
+ EXPECT_FALSE(throttler()->ConsumeInputEvent(event));
+ EXPECT_TRUE(throttler()->is_throttled());
+
+ event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
+ EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
+ EXPECT_TRUE(throttler()->is_throttled());
+
+ event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
+ EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
+ EXPECT_FALSE(throttler()->is_throttled());
+}
+
} // namespace content
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_throttler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698