Index: content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc |
diff --git a/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc b/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b5fc5c45db8635aca78558c7c6769c339a81232d |
--- /dev/null |
+++ b/content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc |
@@ -0,0 +1,45 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/bind.h" |
+#include "base/logging.h" |
+#include "content/renderer/pepper/pepper_plugin_instance_throttler.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace content { |
+ |
+namespace { |
+ |
+class TestPepperPluginInstanceThrottler : public PepperPluginInstanceThrottler { |
+ public: |
+ TestPepperPluginInstanceThrottler(bool power_saver_enabled, |
+ bool is_peripheral_content) |
+ : PepperPluginInstanceThrottler( |
+ base::Bind(&TestPepperPluginInstanceThrottler::ChangeCallback, |
+ base::Unretained(this)), |
+ power_saver_enabled, |
+ is_peripheral_content), |
+ change_callback_calls_(0) { |
+ } |
+ |
+ int change_callback_calls() { return change_callback_calls_; } |
+ |
+ private: |
+ void ChangeCallback() { |
+ ++change_callback_calls_; |
+ } |
+ |
+ int change_callback_calls_; |
+}; |
+ |
+} // namespace |
+ |
+TEST(PepperPluginInstanceThrottlerTest, ThrottleAndUnthrottle) { |
+ TestPepperPluginInstanceThrottler throttler(true /* power_saver_enabled */, |
+ true /* is_perpheral_content */); |
+ EXPECT_FALSE(throttler.is_throttled()); |
+ |
+} |
+ |
+} // namespace content |