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

Side by Side Diff: content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc

Issue 2211753002: Plugin Power Saver Tiny: Fix Plugin.PowerSaver.PeripheralHeuristic UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge. and change to enum Created 4 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 unified diff | Download patch
OLDNEW
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 "content/renderer/pepper/plugin_instance_throttler_impl.h" 5 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 20 matching lines...) Expand all
31 protected: 31 protected:
32 const int kMaximumFramesToExamine = 32 const int kMaximumFramesToExamine =
33 PluginInstanceThrottlerImpl::kMaximumFramesToExamine; 33 PluginInstanceThrottlerImpl::kMaximumFramesToExamine;
34 34
35 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} 35 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {}
36 ~PluginInstanceThrottlerImplTest() override { 36 ~PluginInstanceThrottlerImplTest() override {
37 throttler_->RemoveObserver(this); 37 throttler_->RemoveObserver(this);
38 } 38 }
39 39
40 void SetUp() override { 40 void SetUp() override {
41 throttler_.reset(new PluginInstanceThrottlerImpl); 41 throttler_.reset(
42 new PluginInstanceThrottlerImpl(RenderFrame::DONT_RECORD_DECISION));
42 throttler_->Initialize(nullptr, url::Origin(GURL("http://example.com")), 43 throttler_->Initialize(nullptr, url::Origin(GURL("http://example.com")),
43 "Shockwave Flash", gfx::Size(100, 100)); 44 "Shockwave Flash", gfx::Size(100, 100));
44 throttler_->AddObserver(this); 45 throttler_->AddObserver(this);
45 } 46 }
46 47
47 PluginInstanceThrottlerImpl* throttler() { 48 PluginInstanceThrottlerImpl* throttler() {
48 DCHECK(throttler_.get()); 49 DCHECK(throttler_.get());
49 return throttler_.get(); 50 return throttler_.get();
50 } 51 }
51 52
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; 212 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
212 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 213 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
213 EXPECT_TRUE(throttler()->IsThrottled()); 214 EXPECT_TRUE(throttler()->IsThrottled());
214 215
215 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; 216 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
216 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 217 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
217 EXPECT_FALSE(throttler()->IsThrottled()); 218 EXPECT_FALSE(throttler()->IsThrottled());
218 } 219 }
219 220
220 } // namespace content 221 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | content/renderer/pepper/plugin_power_saver_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698