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

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

Issue 1024493004: Plugin Power Saver: Record PPS UMAs only for users with PPS enabled. (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
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21 matching lines...) Expand all
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; 39 blink::WebRect rect;
40 rect.width = 100; 40 rect.width = 100;
41 rect.height = 100; 41 rect.height = 100;
42 throttler_.reset( 42 throttler_.reset(new PluginInstanceThrottlerImpl);
43 new PluginInstanceThrottlerImpl(true /* power_saver_enabled */));
44 throttler_->Initialize(nullptr, GURL("http://example.com"), 43 throttler_->Initialize(nullptr, GURL("http://example.com"),
45 "Shockwave Flash", rect); 44 "Shockwave Flash", rect);
46 throttler_->AddObserver(this); 45 throttler_->AddObserver(this);
47 } 46 }
48 47
49 PluginInstanceThrottlerImpl* throttler() { 48 PluginInstanceThrottlerImpl* throttler() {
50 DCHECK(throttler_.get()); 49 DCHECK(throttler_.get());
51 return throttler_.get(); 50 return throttler_.get();
52 } 51 }
53 52
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; 226 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
228 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 227 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
229 EXPECT_TRUE(throttler()->IsThrottled()); 228 EXPECT_TRUE(throttler()->IsThrottled());
230 229
231 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; 230 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
232 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 231 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
233 EXPECT_FALSE(throttler()->IsThrottled()); 232 EXPECT_FALSE(throttler()->IsThrottled());
234 } 233 }
235 234
236 } // namespace content 235 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698