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" |
11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/test/scoped_feature_list.h" | 13 #include "base/test/scoped_feature_list.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_features.h" | 20 #include "chrome/common/chrome_features.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "chrome/test/base/test_switches.h" | 23 #include "chrome/test/base/test_switches.h" |
23 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
25 #include "components/zoom/zoom_controller.h" | 26 #include "components/zoom/zoom_controller.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 LoadHTML("/zoom_independent.html"); | 560 LoadHTML("/zoom_independent.html"); |
560 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 561 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
561 } | 562 } |
562 | 563 |
563 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, BlockTinyPlugins) { | 564 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, BlockTinyPlugins) { |
564 LoadHTML("/block_tiny_plugins.html"); | 565 LoadHTML("/block_tiny_plugins.html"); |
565 | 566 |
566 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_same_origin"); | 567 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_same_origin"); |
567 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_1"); | 568 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_1"); |
568 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_2"); | 569 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_2"); |
| 570 |
| 571 TabSpecificContentSettings* tab_specific_content_settings = |
| 572 TabSpecificContentSettings::FromWebContents(GetActiveWebContents()); |
| 573 EXPECT_FALSE(tab_specific_content_settings->blocked_plugin_names().empty()); |
569 } | 574 } |
570 | 575 |
571 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, BackgroundTabTinyPlugins) { | 576 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, BackgroundTabTinyPlugins) { |
572 content::WebContents* background_contents = | 577 content::WebContents* background_contents = |
573 LoadHTMLInBackgroundTab("/background_tab_tiny_plugins.html"); | 578 LoadHTMLInBackgroundTab("/background_tab_tiny_plugins.html"); |
574 EXPECT_FALSE(PluginLoaded(background_contents, "tiny")); | 579 EXPECT_FALSE(PluginLoaded(background_contents, "tiny")); |
575 | 580 |
576 ActivateTab(background_contents); | 581 ActivateTab(background_contents); |
577 VerifyPluginIsPlaceholderOnly("tiny"); | 582 VerifyPluginIsPlaceholderOnly("tiny"); |
578 } | 583 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, | 616 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, |
612 ThrottlePluginsOnAllowContentSetting) { | 617 ThrottlePluginsOnAllowContentSetting) { |
613 HostContentSettingsMap* content_settings_map = | 618 HostContentSettingsMap* content_settings_map = |
614 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); | 619 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); |
615 | 620 |
616 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 621 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
617 CONTENT_SETTING_ALLOW); | 622 CONTENT_SETTING_ALLOW); |
618 LoadPeripheralPlugin(); | 623 LoadPeripheralPlugin(); |
619 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 624 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
620 } | 625 } |
OLD | NEW |