OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/bind.h" |
| 6 #include "base/logging.h" |
| 7 #include "content/renderer/pepper/pepper_plugin_instance_throttler.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 namespace { |
| 13 |
| 14 class TestPepperPluginInstanceThrottler : public PepperPluginInstanceThrottler { |
| 15 public: |
| 16 TestPepperPluginInstanceThrottler(bool power_saver_enabled, |
| 17 bool is_peripheral_content) |
| 18 : PepperPluginInstanceThrottler( |
| 19 base::Bind(&TestPepperPluginInstanceThrottler::ChangeCallback, |
| 20 base::Unretained(this)), |
| 21 power_saver_enabled, |
| 22 is_peripheral_content), |
| 23 change_callback_calls_(0) { |
| 24 } |
| 25 |
| 26 int change_callback_calls() { return change_callback_calls_; } |
| 27 |
| 28 private: |
| 29 void ChangeCallback() { |
| 30 ++change_callback_calls_; |
| 31 } |
| 32 |
| 33 int change_callback_calls_; |
| 34 }; |
| 35 |
| 36 } // namespace |
| 37 |
| 38 TEST(PepperPluginInstanceThrottlerTest, ThrottleAndUnthrottle) { |
| 39 TestPepperPluginInstanceThrottler throttler(true /* power_saver_enabled */, |
| 40 true /* is_perpheral_content */); |
| 41 EXPECT_FALSE(throttler.is_throttled()); |
| 42 |
| 43 } |
| 44 |
| 45 } // namespace content |
OLD | NEW |