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

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

Issue 2391823003: [HBD] Hardcode SEI threshold to 30 (for testers) (Closed)
Patch Set: fix one more test Created 4 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 unified diff | Download patch
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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); 733 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential");
734 } 734 }
735 735
736 // Separate test case that allows tiny plugins. This requires a separate test 736 // Separate test case that allows tiny plugins. This requires a separate test
737 // case, because we need to initialize the renderer with a different feature 737 // case, because we need to initialize the renderer with a different feature
738 // setting. 738 // setting.
739 class PluginPowerSaverAllowTinyBrowserTest 739 class PluginPowerSaverAllowTinyBrowserTest
740 : public PluginPowerSaverBrowserTest { 740 : public PluginPowerSaverBrowserTest {
741 public: 741 public:
742 void SetUpInProcessBrowserTestFixture() override { 742 void SetUpInProcessBrowserTestFixture() override {
743 PluginPowerSaverBrowserTest::SetUpInProcessBrowserTestFixture(); 743 feature_list.InitWithFeatures(
744 feature_list.InitAndDisableFeature(features::kBlockSmallContent); 744 {}, {features::kPreferHtmlOverPlugins, features::kBlockSmallContent});
745 } 745 }
746 746
747 private: 747 private:
748 base::test::ScopedFeatureList feature_list; 748 base::test::ScopedFeatureList feature_list;
749 }; 749 };
750 750
751 IN_PROC_BROWSER_TEST_F(PluginPowerSaverAllowTinyBrowserTest, 751 IN_PROC_BROWSER_TEST_F(PluginPowerSaverAllowTinyBrowserTest,
752 EssentialTinyPlugins) { 752 EssentialTinyPlugins) {
753 LoadHTML( 753 LoadHTML(
754 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' " 754 "<object id='tiny_cross_origin_1' data='http://a.com/fake.swf' "
755 " type='application/x-shockwave-flash' width='3' height='3'>" 755 " type='application/x-shockwave-flash' width='3' height='3'>"
756 "</object>" 756 "</object>"
757 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " 757 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' "
758 " type='application/x-shockwave-flash' width='1' height='1'>" 758 " type='application/x-shockwave-flash' width='1' height='1'>"
759 "</object>"); 759 "</object>");
760 760
761 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1"); 761 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_1");
762 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2"); 762 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_cross_origin_2");
763 } 763 }
764 764
765 // Separate test case with HTML By Default feature flag on. 765 // Separate test case with HTML By Default feature flag on.
766 class PluginPowerSaverPreferHtmlBrowserTest 766 class PluginPowerSaverPreferHtmlBrowserTest
767 : public PluginPowerSaverBrowserTest { 767 : public PluginPowerSaverBrowserTest {
768 public: 768 public:
769 void SetUpInProcessBrowserTestFixture() override { 769 void SetUpInProcessBrowserTestFixture() override {
770 PluginPowerSaverBrowserTest::SetUpInProcessBrowserTestFixture(); 770 // Although these are redundant with the Field Trial testing configuration,
771 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); 771 // the official builders don't use those, so enable them here.
772 feature_list.InitWithFeatures(
773 {features::kBlockSmallContent, features::kPreferHtmlOverPlugins}, {});
772 } 774 }
773 775
774 private: 776 private:
775 base::test::ScopedFeatureList feature_list; 777 base::test::ScopedFeatureList feature_list;
776 }; 778 };
777 779
778 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, 780 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest,
779 ThrottlePluginsOnAllowContentSetting) { 781 ThrottlePluginsOnAllowContentSetting) {
780 HostContentSettingsMap* content_settings_map = 782 HostContentSettingsMap* content_settings_map =
781 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); 783 HostContentSettingsMapFactory::GetForProfile(browser()->profile());
782 784
783 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, 785 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
784 CONTENT_SETTING_ALLOW); 786 CONTENT_SETTING_ALLOW);
785 LoadPeripheralPlugin(); 787 LoadPeripheralPlugin();
786 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); 788 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin");
787 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698