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

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

Issue 1015023002: Plugin Power Saver: Throttle 'large' plugins that appear small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 18 matching lines...) Expand all
29 protected: 29 protected:
30 const int kMaximumFramesToExamine = 30 const int kMaximumFramesToExamine =
31 PluginInstanceThrottlerImpl::kMaximumFramesToExamine; 31 PluginInstanceThrottlerImpl::kMaximumFramesToExamine;
32 32
33 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} 33 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {}
34 ~PluginInstanceThrottlerImplTest() override { 34 ~PluginInstanceThrottlerImplTest() override {
35 throttler_->RemoveObserver(this); 35 throttler_->RemoveObserver(this);
36 } 36 }
37 37
38 void SetUp() override { 38 void SetUp() override {
39 blink::WebRect rect;
40 rect.width = 100;
41 rect.height = 100;
42 throttler_.reset(new PluginInstanceThrottlerImpl); 39 throttler_.reset(new PluginInstanceThrottlerImpl);
43 throttler_->Initialize(nullptr, GURL("http://example.com"), 40 throttler_->Initialize(nullptr, GURL("http://example.com"),
44 "Shockwave Flash", rect); 41 "Shockwave Flash", gfx::Size(100, 100));
45 throttler_->AddObserver(this); 42 throttler_->AddObserver(this);
46 } 43 }
47 44
48 PluginInstanceThrottlerImpl* throttler() { 45 PluginInstanceThrottlerImpl* throttler() {
49 DCHECK(throttler_.get()); 46 DCHECK(throttler_.get());
50 return throttler_.get(); 47 return throttler_.get();
51 } 48 }
52 49
53 void DisablePowerSaverByRetroactiveWhitelist() { 50 void DisablePowerSaverByRetroactiveWhitelist() {
54 throttler()->MarkPluginEssential( 51 throttler()->MarkPluginEssential(
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; 223 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
227 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 224 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
228 EXPECT_TRUE(throttler()->IsThrottled()); 225 EXPECT_TRUE(throttler()->IsThrottled());
229 226
230 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; 227 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
231 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 228 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
232 EXPECT_FALSE(throttler()->IsThrottled()); 229 EXPECT_FALSE(throttler()->IsThrottled());
233 } 230 }
234 231
235 } // namespace content 232 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | content/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698