| 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 <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 Loading... |
| 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 // Although this is redundant with the Field Trial testing configuration, |
| 294 // the official builders don't use those, so we also enable it here. |
| 295 feature_list.InitAndEnableFeature(features::kBlockSmallContent); |
| 296 } |
| 297 |
| 292 protected: | 298 protected: |
| 293 void LoadHTML(const std::string& html) { | 299 void LoadHTML(const std::string& html) { |
| 294 if (PixelTestsEnabled()) { | 300 if (PixelTestsEnabled()) { |
| 295 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); | 301 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); |
| 296 gfx::Rect screen_bounds = | 302 gfx::Rect screen_bounds = |
| 297 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 303 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 298 ASSERT_GT(screen_bounds.width(), kBrowserWidth); | 304 ASSERT_GT(screen_bounds.width(), kBrowserWidth); |
| 299 ASSERT_GT(screen_bounds.height(), kBrowserHeight); | 305 ASSERT_GT(screen_bounds.height(), kBrowserHeight); |
| 300 browser()->window()->SetBounds(bounds); | 306 browser()->window()->SetBounds(bounds); |
| 301 } | 307 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // Flaky on Windows and Asan bots. See crbug.com/549285. | 402 // Flaky on Windows and Asan bots. See crbug.com/549285. |
| 397 return false; | 403 return false; |
| 398 #elif defined(OS_CHROMEOS) | 404 #elif defined(OS_CHROMEOS) |
| 399 // Because ChromeOS cannot use software rendering and the pixel tests | 405 // Because ChromeOS cannot use software rendering and the pixel tests |
| 400 // continue to flake with hardware acceleration, disable these on ChromeOS. | 406 // continue to flake with hardware acceleration, disable these on ChromeOS. |
| 401 return false; | 407 return false; |
| 402 #else | 408 #else |
| 403 return true; | 409 return true; |
| 404 #endif | 410 #endif |
| 405 } | 411 } |
| 412 |
| 413 private: |
| 414 base::test::ScopedFeatureList feature_list; |
| 406 }; | 415 }; |
| 407 | 416 |
| 408 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, EssentialPlugins) { | 417 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, EssentialPlugins) { |
| 409 LoadHTML( | 418 LoadHTML( |
| 410 "<object id='small_same_origin' data='fake.swf' " | 419 "<object id='small_same_origin' data='fake.swf' " |
| 411 " type='application/x-ppapi-tests' width='400' height='100'>" | 420 " type='application/x-ppapi-tests' width='400' height='100'>" |
| 412 "</object>" | 421 "</object>" |
| 413 "<object id='small_same_origin_poster' data='fake.swf' " | 422 "<object id='small_same_origin_poster' data='fake.swf' " |
| 414 " type='application/x-ppapi-tests' width='400' height='100' " | 423 " type='application/x-ppapi-tests' width='400' height='100' " |
| 415 " poster='click_me.png'>" | 424 " poster='click_me.png'>" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' " | 737 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' " |
| 729 " type='application/x-ppapi-tests' width='3' height='3'>" | 738 " type='application/x-ppapi-tests' width='3' height='3'>" |
| 730 "</object>" | 739 "</object>" |
| 731 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " | 740 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " |
| 732 " type='application/x-ppapi-tests' width='1' height='1'>" | 741 " type='application/x-ppapi-tests' width='1' height='1'>" |
| 733 "</object>"); | 742 "</object>"); |
| 734 | 743 |
| 735 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1"); | 744 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1"); |
| 736 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2"); | 745 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2"); |
| 737 } | 746 } |
| OLD | NEW |