OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/plugins/chrome_plugin_service_filter.h" | 5 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/plugins/plugin_finder.h" | 23 #include "chrome/browser/plugins/plugin_finder.h" |
24 #include "chrome/browser/plugins/plugin_metadata.h" | 24 #include "chrome/browser/plugins/plugin_metadata.h" |
25 #include "chrome/browser/plugins/plugin_prefs.h" | 25 #include "chrome/browser/plugins/plugin_prefs.h" |
26 #include "chrome/browser/plugins/plugins_field_trial.h" | 26 #include "chrome/browser/plugins/plugins_field_trial.h" |
27 #include "chrome/common/chrome_content_client.h" | 27 #include "chrome/common/chrome_content_client.h" |
28 #include "chrome/common/chrome_features.h" | 28 #include "chrome/common/chrome_features.h" |
29 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 29 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
30 #include "chrome/test/base/testing_profile.h" | 30 #include "chrome/test/base/testing_profile.h" |
31 #include "components/content_settings/core/browser/host_content_settings_map.h" | 31 #include "components/content_settings/core/browser/host_content_settings_map.h" |
32 #include "components/content_settings/core/common/pref_names.h" | 32 #include "components/content_settings/core/common/pref_names.h" |
33 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 33 #include "components/sync_preferences/testing_pref_service_syncable.h" |
34 #include "components/variations/variations_associated_data.h" | 34 #include "components/variations/variations_associated_data.h" |
35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
36 #include "content/public/browser/plugin_service.h" | 36 #include "content/public/browser/plugin_service.h" |
37 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" |
38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
39 #include "content/public/common/content_constants.h" | 39 #include "content/public/common/content_constants.h" |
40 #include "content/public/test/test_utils.h" | 40 #include "content/public/test/test_utils.h" |
41 #include "url/origin.h" | 41 #include "url/origin.h" |
42 | 42 |
43 namespace { | 43 namespace { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 // Activate PreferHtmlOverPlugins. | 405 // Activate PreferHtmlOverPlugins. |
406 base::test::ScopedFeatureList feature_list; | 406 base::test::ScopedFeatureList feature_list; |
407 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); | 407 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); |
408 | 408 |
409 HostContentSettingsMap* map = | 409 HostContentSettingsMap* map = |
410 HostContentSettingsMapFactory::GetForProfile(profile()); | 410 HostContentSettingsMapFactory::GetForProfile(profile()); |
411 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 411 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
412 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 412 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); |
413 | 413 |
414 syncable_prefs::TestingPrefServiceSyncable* prefs = | 414 sync_preferences::TestingPrefServiceSyncable* prefs = |
415 profile()->GetTestingPrefService(); | 415 profile()->GetTestingPrefService(); |
416 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, | 416 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, |
417 new base::FundamentalValue(CONTENT_SETTING_ASK)); | 417 new base::FundamentalValue(CONTENT_SETTING_ASK)); |
418 | 418 |
419 SiteEngagementService* service = SiteEngagementService::Get(profile()); | 419 SiteEngagementService* service = SiteEngagementService::Get(profile()); |
420 GURL url("http://www.google.com"); | 420 GURL url("http://www.google.com"); |
421 url::Origin main_frame_origin(url); | 421 url::Origin main_frame_origin(url); |
422 NavigateAndCommit(url); | 422 NavigateAndCommit(url); |
423 | 423 |
424 service->ResetScoreForURL(url, 30.0); | 424 service->ResetScoreForURL(url, 30.0); |
425 // Reaching 30.0 engagement would usually allow Flash, but not for enterprise. | 425 // Reaching 30.0 engagement would usually allow Flash, but not for enterprise. |
426 service->ResetScoreForURL(url, 0); | 426 service->ResetScoreForURL(url, 0); |
427 EXPECT_FALSE(IsPluginAvailable( | 427 EXPECT_FALSE(IsPluginAvailable( |
428 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 428 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); |
429 | 429 |
430 // Allow flash temporarily. | 430 // Allow flash temporarily. |
431 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( | 431 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( |
432 web_contents()); | 432 web_contents()); |
433 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 433 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, |
434 profile()->GetResourceContext(), flash_plugin)); | 434 profile()->GetResourceContext(), flash_plugin)); |
435 } | 435 } |
OLD | NEW |