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

Unified Diff: content/renderer/pepper/pepper_plugin_instance_throttler_unittest.cc

Issue 707113002: Plugin Power Saver: Refactor Plugin Instance Throttling code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0190-plugin-power-saver-add-some-umas
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698