| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_piece.h" | 6 #include "base/strings/string_piece.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 "<object id='large' data='http://otherorigin.com/fake.swf' " | 193 "<object id='large' data='http://otherorigin.com/fake.swf' " |
| 194 " type='application/x-ppapi-tests' width='400' height='500'>" | 194 " type='application/x-ppapi-tests' width='400' height='500'>" |
| 195 "</object>" | 195 "</object>" |
| 196 "<object id='medium_16_9' data='http://otherorigin.com/fake.swf' " | 196 "<object id='medium_16_9' data='http://otherorigin.com/fake.swf' " |
| 197 " type='application/x-ppapi-tests' width='480' height='270'>" | 197 " type='application/x-ppapi-tests' width='480' height='270'>" |
| 198 "</object>"); | 198 "</object>"); |
| 199 VerifyPluginMarkedEssential(GetActiveWebContents(), "large"); | 199 VerifyPluginMarkedEssential(GetActiveWebContents(), "large"); |
| 200 VerifyPluginMarkedEssential(GetActiveWebContents(), "medium_16_9"); | 200 VerifyPluginMarkedEssential(GetActiveWebContents(), "medium_16_9"); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // Test extremely flaky, see https://crbug.com/547224 | |
| 204 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, | |
| 205 DISABLED_LargePluginsPeripheralWhenPosterSpecified) { | |
| 206 LoadHTML( | |
| 207 "<object id='plugin_src' type='application/x-ppapi-tests' " | |
| 208 " width='400' height='500' poster='snapshot1x.png'></object>" | |
| 209 "<object id='plugin_srcset' type='application/x-ppapi-tests' " | |
| 210 " width='400' height='500' " | |
| 211 " poster='snapshot1x.png 1x, snapshot2x.png 2x'></object>" | |
| 212 "<object id='plugin_legacy_syntax' type='application/x-ppapi-tests' " | |
| 213 " width='400' height='500'>" | |
| 214 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x'>" | |
| 215 "</object>" | |
| 216 "<embed id='plugin_embed_src' type='application/x-ppapi-tests' " | |
| 217 " width='400' height='500' poster='snapshot1x.png'></embed>" | |
| 218 "<embed id='plugin_embed_srcset' type='application/x-ppapi-tests' " | |
| 219 " width='400' height='500'" | |
| 220 " poster='snapshot1x.png 1x, snapshot2x.png 2x'></embed>"); | |
| 221 | |
| 222 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_src")); | |
| 223 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_srcset")); | |
| 224 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_legacy_syntax")); | |
| 225 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_embed_src")); | |
| 226 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin_embed_srcset")); | |
| 227 } | |
| 228 | |
| 229 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargePostersNotThrottled) { | 203 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargePostersNotThrottled) { |
| 230 // This test verifies that small posters are throttled, large posters are not, | 204 // This test verifies that small posters are throttled, large posters are not, |
| 231 // and that large posters can whitelist origins for other plugins. | 205 // and that large posters can whitelist origins for other plugins. |
| 232 LoadHTML( | 206 LoadHTML( |
| 233 "<object id='poster_small' data='http://a.com/fake.swf' " | 207 "<object id='poster_small' data='http://a.com/fake.swf' " |
| 234 " type='application/x-ppapi-tests' width='50' height='50' " | 208 " type='application/x-ppapi-tests' width='50' height='50' " |
| 235 " poster='click_me.png'></object>" | 209 " poster='click_me.png'></object>" |
| 236 "<object id='poster_whitelisted_origin' data='http://b.com/fake.swf' " | 210 "<object id='poster_whitelisted_origin' data='http://b.com/fake.swf' " |
| 237 " type='application/x-ppapi-tests' width='50' height='50' " | 211 " type='application/x-ppapi-tests' width='50' height='50' " |
| 238 " poster='click_me.png'></object>" | 212 " poster='click_me.png'></object>" |
| 239 "<object id='plugin_whitelisted_origin' data='http://b.com/fake.swf' " | 213 "<object id='plugin_whitelisted_origin' data='http://b.com/fake.swf' " |
| 240 " type='application/x-ppapi-tests' width='50' height='50'></object>" | 214 " type='application/x-ppapi-tests' width='50' height='50'></object>" |
| 241 "<br>" | 215 "<br>" |
| 242 "<object id='poster_large' data='http://b.com/fake.swf' " | 216 "<object id='poster_large' data='http://b.com/fake.swf' " |
| 243 " type='application/x-ppapi-tests' width='400' height='300' " | 217 " type='application/x-ppapi-tests' width='400' height='300' " |
| 244 " poster='click_me.png'></object>"); | 218 " poster='click_me.png'></object>"); |
| 245 | 219 |
| 246 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "poster_small")); | 220 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "poster_small")); |
| 247 VerifyPluginMarkedEssential(GetActiveWebContents(), | 221 VerifyPluginMarkedEssential(GetActiveWebContents(), |
| 222 "poster_whitelisted_origin"); |
| 223 VerifyPluginMarkedEssential(GetActiveWebContents(), |
| 248 "plugin_whitelisted_origin"); | 224 "plugin_whitelisted_origin"); |
| 249 VerifyPluginMarkedEssential(GetActiveWebContents(), "poster_large"); | 225 VerifyPluginMarkedEssential(GetActiveWebContents(), "poster_large"); |
| 250 } | 226 } |
| 251 | 227 |
| 252 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, | 228 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, |
| 253 PluginMarkedEssentialAfterPosterClicked) { | 229 PluginMarkedEssentialAfterPosterClicked) { |
| 254 LoadHTML( | 230 LoadHTML( |
| 255 "<object id='plugin' type='application/x-ppapi-tests' " | 231 "<object id='plugin' type='application/x-ppapi-tests' " |
| 256 " width='400' height='100' poster='snapshot1x.png'></object>"); | 232 " width='400' height='100' poster='snapshot1x.png'></object>"); |
| 257 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin")); | 233 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), "plugin")); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 309 |
| 334 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { | 310 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { |
| 335 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) | 311 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) |
| 336 ->SetZoomLevel(4.0); | 312 ->SetZoomLevel(4.0); |
| 337 LoadHTML( | 313 LoadHTML( |
| 338 "<object id='plugin' data='http://otherorigin.com/fake.swf' " | 314 "<object id='plugin' data='http://otherorigin.com/fake.swf' " |
| 339 " type='application/x-ppapi-tests' width='400' height='200'>" | 315 " type='application/x-ppapi-tests' width='400' height='200'>" |
| 340 "</object>"); | 316 "</object>"); |
| 341 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 317 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
| 342 } | 318 } |
| OLD | NEW |