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

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

Issue 1421693002: Plugin Power Saver: Do not always throttle plugins with posters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0025-pps-poster-pixel-tests
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/plugin_power_saver_helper.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/plugin_power_saver_helper_browsertest.cc
diff --git a/content/renderer/pepper/plugin_power_saver_helper_browsertest.cc b/content/renderer/pepper/plugin_power_saver_helper_browsertest.cc
index 9eb32bce2a70bc6671215484ca7367d5f35d66e3..c6bb23aa8cdab1f7b6ec96c4ce5d23b68fe6aa48 100644
--- a/content/renderer/pepper/plugin_power_saver_helper_browsertest.cc
+++ b/content/renderer/pepper/plugin_power_saver_helper_browsertest.cc
@@ -33,10 +33,6 @@ class PluginPowerSaverHelperTest : public RenderViewTest {
return static_cast<RenderFrameImpl*>(view_->GetMainRenderFrame());
}
- PluginPowerSaverHelper* helper() {
- return frame()->plugin_power_saver_helper();
- }
-
blink::WebPluginParams MakeParams(const std::string& url,
const std::string& poster,
const std::string& width,
@@ -69,24 +65,24 @@ class PluginPowerSaverHelperTest : public RenderViewTest {
TEST_F(PluginPowerSaverHelperTest, AllowSameOrigin) {
EXPECT_FALSE(
- helper()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
- url::Origin(GURL("http://same.com")),
- kFlashPluginName, 100, 100, nullptr));
+ frame()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
+ url::Origin(GURL("http://same.com")),
+ kFlashPluginName, 100, 100, nullptr));
EXPECT_FALSE(
- helper()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
- url::Origin(GURL("http://same.com")),
- kFlashPluginName, 1000, 1000, nullptr));
+ frame()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
+ url::Origin(GURL("http://same.com")),
+ kFlashPluginName, 1000, 1000, nullptr));
}
TEST_F(PluginPowerSaverHelperTest, DisallowCrossOriginUnlessLarge) {
bool cross_origin_main_content = false;
- EXPECT_TRUE(helper()->ShouldThrottleContent(
+ EXPECT_TRUE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 100, 100,
&cross_origin_main_content));
EXPECT_FALSE(cross_origin_main_content);
- EXPECT_FALSE(helper()->ShouldThrottleContent(
+ EXPECT_FALSE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 1000, 1000,
&cross_origin_main_content));
@@ -95,24 +91,24 @@ TEST_F(PluginPowerSaverHelperTest, DisallowCrossOriginUnlessLarge) {
TEST_F(PluginPowerSaverHelperTest, AlwaysAllowTinyContent) {
bool cross_origin_main_content = false;
- EXPECT_FALSE(helper()->ShouldThrottleContent(
+ EXPECT_FALSE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://same.com")), kFlashPluginName, 1, 1, nullptr));
EXPECT_FALSE(cross_origin_main_content);
- EXPECT_FALSE(helper()->ShouldThrottleContent(
+ EXPECT_FALSE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 1, 1,
&cross_origin_main_content));
EXPECT_FALSE(cross_origin_main_content);
- EXPECT_FALSE(helper()->ShouldThrottleContent(
+ EXPECT_FALSE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 5, 5,
&cross_origin_main_content));
EXPECT_FALSE(cross_origin_main_content);
- EXPECT_TRUE(helper()->ShouldThrottleContent(
+ EXPECT_TRUE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 10, 10,
&cross_origin_main_content));
@@ -121,7 +117,7 @@ TEST_F(PluginPowerSaverHelperTest, AlwaysAllowTinyContent) {
TEST_F(PluginPowerSaverHelperTest, TemporaryOriginWhitelist) {
bool cross_origin_main_content = false;
- EXPECT_TRUE(helper()->ShouldThrottleContent(
+ EXPECT_TRUE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 100, 100,
&cross_origin_main_content));
@@ -130,8 +126,8 @@ TEST_F(PluginPowerSaverHelperTest, TemporaryOriginWhitelist) {
// Clear out other messages so we find just the plugin power saver IPCs.
sink_->ClearMessages();
- helper()->WhitelistContentOrigin(url::Origin(GURL("http://other.com")));
- EXPECT_FALSE(helper()->ShouldThrottleContent(
+ frame()->WhitelistContentOrigin(url::Origin(GURL("http://other.com")));
+ EXPECT_FALSE(frame()->ShouldThrottleContent(
url::Origin(GURL("http://same.com")),
url::Origin(GURL("http://other.com")), kFlashPluginName, 100, 100,
&cross_origin_main_content));
@@ -162,19 +158,19 @@ TEST_F(PluginPowerSaverHelperTest, UnthrottleOnExPostFactoWhitelist) {
}
TEST_F(PluginPowerSaverHelperTest, ClearWhitelistOnNavigate) {
- helper()->WhitelistContentOrigin(url::Origin(GURL("http://other.com")));
+ frame()->WhitelistContentOrigin(url::Origin(GURL("http://other.com")));
EXPECT_FALSE(
- helper()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
- url::Origin(GURL("http://other.com")),
- kFlashPluginName, 100, 100, nullptr));
+ frame()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
+ url::Origin(GURL("http://other.com")),
+ kFlashPluginName, 100, 100, nullptr));
LoadHTML("<html></html>");
EXPECT_TRUE(
- helper()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
- url::Origin(GURL("http://other.com")),
- kFlashPluginName, 100, 100, nullptr));
+ frame()->ShouldThrottleContent(url::Origin(GURL("http://same.com")),
+ url::Origin(GURL("http://other.com")),
+ kFlashPluginName, 100, 100, nullptr));
}
} // namespace content
« no previous file with comments | « content/renderer/pepper/plugin_power_saver_helper.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698