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

Side by Side Diff: chrome/browser/plugins/plugin_power_saver_browsertest.cc

Issue 2350773003: Plugin Power Saver: Fix browsertest in official builds. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line)); 282 ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line));
283 283
284 // Allows us to use the same reference image on HiDPI/Retina displays. 284 // Allows us to use the same reference image on HiDPI/Retina displays.
285 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1"); 285 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1");
286 286
287 // The pixel tests run more reliably in software mode. 287 // The pixel tests run more reliably in software mode.
288 if (PixelTestsEnabled()) 288 if (PixelTestsEnabled())
289 command_line->AppendSwitch(switches::kDisableGpu); 289 command_line->AppendSwitch(switches::kDisableGpu);
290 } 290 }
291 291
292 void SetUpInProcessBrowserTestFixture() override {
293 feature_list.InitAndEnableFeature(features::kBlockSmallContent);
Nico 2016/09/19 22:44:42 maybe add a comment for why this is needed
tommycli 2016/09/19 23:10:07 Done.
294 }
295
292 protected: 296 protected:
293 void LoadHTML(const std::string& html) { 297 void LoadHTML(const std::string& html) {
294 if (PixelTestsEnabled()) { 298 if (PixelTestsEnabled()) {
295 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); 299 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight));
296 gfx::Rect screen_bounds = 300 gfx::Rect screen_bounds =
297 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); 301 display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
298 ASSERT_GT(screen_bounds.width(), kBrowserWidth); 302 ASSERT_GT(screen_bounds.width(), kBrowserWidth);
299 ASSERT_GT(screen_bounds.height(), kBrowserHeight); 303 ASSERT_GT(screen_bounds.height(), kBrowserHeight);
300 browser()->window()->SetBounds(bounds); 304 browser()->window()->SetBounds(bounds);
301 } 305 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // Flaky on Windows and Asan bots. See crbug.com/549285. 400 // Flaky on Windows and Asan bots. See crbug.com/549285.
397 return false; 401 return false;
398 #elif defined(OS_CHROMEOS) 402 #elif defined(OS_CHROMEOS)
399 // Because ChromeOS cannot use software rendering and the pixel tests 403 // Because ChromeOS cannot use software rendering and the pixel tests
400 // continue to flake with hardware acceleration, disable these on ChromeOS. 404 // continue to flake with hardware acceleration, disable these on ChromeOS.
401 return false; 405 return false;
402 #else 406 #else
403 return true; 407 return true;
404 #endif 408 #endif
405 } 409 }
410
411 private:
412 base::test::ScopedFeatureList feature_list;
406 }; 413 };
407 414
408 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, EssentialPlugins) { 415 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, EssentialPlugins) {
409 LoadHTML( 416 LoadHTML(
410 "<object id='small_same_origin' data='fake.swf' " 417 "<object id='small_same_origin' data='fake.swf' "
411 " type='application/x-ppapi-tests' width='400' height='100'>" 418 " type='application/x-ppapi-tests' width='400' height='100'>"
412 "</object>" 419 "</object>"
413 "<object id='small_same_origin_poster' data='fake.swf' " 420 "<object id='small_same_origin_poster' data='fake.swf' "
414 " type='application/x-ppapi-tests' width='400' height='100' " 421 " type='application/x-ppapi-tests' width='400' height='100' "
415 " poster='click_me.png'>" 422 " poster='click_me.png'>"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' " 735 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' "
729 " type='application/x-ppapi-tests' width='3' height='3'>" 736 " type='application/x-ppapi-tests' width='3' height='3'>"
730 "</object>" 737 "</object>"
731 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " 738 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' "
732 " type='application/x-ppapi-tests' width='1' height='1'>" 739 " type='application/x-ppapi-tests' width='1' height='1'>"
733 "</object>"); 740 "</object>");
734 741
735 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1"); 742 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1");
736 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2"); 743 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2");
737 } 744 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698