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

Side by Side Diff: content/renderer/pepper/pepper_webplugin_impl_browsertest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/pepper_webplugin_impl.h" 5 #include "content/renderer/pepper/pepper_webplugin_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) override { 162 void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) override {
163 plugins->push_back(GetPluginInfo()); 163 plugins->push_back(GetPluginInfo());
164 } 164 }
165 }; 165 };
166 class MockContentRendererClient : public ContentRendererClient { 166 class MockContentRendererClient : public ContentRendererClient {
167 public: 167 public:
168 bool OverrideCreatePlugin(RenderFrame* render_frame, 168 bool OverrideCreatePlugin(RenderFrame* render_frame,
169 blink::WebLocalFrame* frame, 169 blink::WebLocalFrame* frame,
170 const blink::WebPluginParams& params, 170 const blink::WebPluginParams& params,
171 blink::WebPlugin** plugin) override { 171 blink::WebPlugin** plugin) override {
172 current_test_->throttler_ = new PluginInstanceThrottlerImpl; 172 current_test_->throttler_ =
173 new PluginInstanceThrottlerImpl(RenderFrame::DONT_RECORD_DECISION);
173 current_test_->throttler_->AddObserver(current_test_); 174 current_test_->throttler_->AddObserver(current_test_);
174 *plugin = render_frame->CreatePlugin( 175 *plugin = render_frame->CreatePlugin(
175 frame, GetPluginInfo().ToWebPluginInfo(), params, 176 frame, GetPluginInfo().ToWebPluginInfo(), params,
176 base::WrapUnique(current_test_->throttler_)); 177 base::WrapUnique(current_test_->throttler_));
177 return *plugin; 178 return *plugin;
178 } 179 }
179 }; 180 };
180 181
181 PluginInstanceThrottlerImpl* throttler_; 182 PluginInstanceThrottlerImpl* throttler_;
182 bool throttle_engaged_; 183 bool throttle_engaged_;
(...skipping 19 matching lines...) Expand all
202 LoadHTML("<!DOCTYPE html><object type='test/always-throttle'></object>"); 203 LoadHTML("<!DOCTYPE html><object type='test/always-throttle'></object>");
203 EXPECT_NE(0, pp_instance_); 204 EXPECT_NE(0, pp_instance_);
204 LoadHTML(""); 205 LoadHTML("");
205 EXPECT_EQ(0, pp_instance_); 206 EXPECT_EQ(0, pp_instance_);
206 EXPECT_FALSE(throttle_engaged_); 207 EXPECT_FALSE(throttle_engaged_);
207 } 208 }
208 209
209 } // unnamed namespace 210 } // unnamed namespace
210 211
211 } // namespace content 212 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/render_frame.h ('k') | content/renderer/pepper/plugin_instance_throttler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698