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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); | 414 feature_list.InitAndEnableFeature(features::kPreferHtmlOverPlugins); |
415 | 415 |
416 HostContentSettingsMap* map = | 416 HostContentSettingsMap* map = |
417 HostContentSettingsMapFactory::GetForProfile(profile()); | 417 HostContentSettingsMapFactory::GetForProfile(profile()); |
418 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 418 map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
419 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); | 419 CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); |
420 | 420 |
421 sync_preferences::TestingPrefServiceSyncable* prefs = | 421 sync_preferences::TestingPrefServiceSyncable* prefs = |
422 profile()->GetTestingPrefService(); | 422 profile()->GetTestingPrefService(); |
423 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, | 423 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, |
424 new base::FundamentalValue(CONTENT_SETTING_ASK)); | 424 new base::Value(CONTENT_SETTING_ASK)); |
425 | 425 |
426 SiteEngagementService* service = SiteEngagementService::Get(profile()); | 426 SiteEngagementService* service = SiteEngagementService::Get(profile()); |
427 GURL url("http://www.google.com"); | 427 GURL url("http://www.google.com"); |
428 url::Origin main_frame_origin(url); | 428 url::Origin main_frame_origin(url); |
429 NavigateAndCommit(url); | 429 NavigateAndCommit(url); |
430 | 430 |
431 service->ResetScoreForURL(url, 30.0); | 431 service->ResetScoreForURL(url, 30.0); |
432 // Reaching 30.0 engagement would usually allow Flash, but not for enterprise. | 432 // Reaching 30.0 engagement would usually allow Flash, but not for enterprise. |
433 service->ResetScoreForURL(url, 0); | 433 service->ResetScoreForURL(url, 0); |
434 EXPECT_FALSE(IsPluginAvailable( | 434 EXPECT_FALSE(IsPluginAvailable( |
435 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); | 435 url, main_frame_origin, profile()->GetResourceContext(), flash_plugin)); |
436 | 436 |
437 // Allow flash temporarily. | 437 // Allow flash temporarily. |
438 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( | 438 FlashTemporaryPermissionTracker::Get(profile())->FlashEnabledForWebContents( |
439 web_contents()); | 439 web_contents()); |
440 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, | 440 EXPECT_TRUE(IsPluginAvailable(url, main_frame_origin, |
441 profile()->GetResourceContext(), flash_plugin)); | 441 profile()->GetResourceContext(), flash_plugin)); |
442 } | 442 } |
OLD | NEW |