| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |