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

Unified Diff: chrome/browser/plugins/plugin_power_saver_browsertest.cc

Issue 1124173008: Plugin Power Saver: Unthrottle dynamically sized plugins correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add defines Created 5 years, 6 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
Index: chrome/browser/plugins/plugin_power_saver_browsertest.cc
diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
index d7ace2a4fd2e3cdb5de8b6e754c46c62cc48174c..5974139865f3e0293909da13b17ba5cb090f9aa6 100644
--- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc
+++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
@@ -224,12 +224,31 @@ IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, OriginWhitelisting) {
IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOriginObscured) {
LoadHTML(
- "<div style='width: 100px; height: 100px; overflow: hidden;'>"
+ "<div id='container' "
+ " style='width: 400px; height: 100px; overflow: hidden;'>"
" <object id='plugin' data='http://otherorigin.com/fake.swf' "
" type='application/x-ppapi-tests' width='400' height='500'>"
" </object>"
"</div>");
VerifyPluginIsThrottled(GetActiveWebContents(), "plugin");
+
+ // Test that's unthrottled if it is unobscured.
+ std::string script =
+ "var container = window.document.getElementById('container');"
+ "container.setAttribute('style', 'width: 400px; height: 400px;');";
+ ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script));
+ VerifyPluginMarkedEssential(GetActiveWebContents(), "plugin");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ExpandingSmallPlugin) {
+ LoadHTML(
+ "<object id='plugin' data='http://otherorigin.com/fake.swf' "
+ " type='application/x-ppapi-tests' width='400' height='80'></object>");
+ VerifyPluginIsThrottled(GetActiveWebContents(), "plugin");
+
+ std::string script = "window.document.getElementById('plugin').height = 400;";
+ ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script));
+ VerifyPluginMarkedEssential(GetActiveWebContents(), "plugin");
}
IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, BackgroundTabPlugins) {

Powered by Google App Engine
This is Rietveld 408576698