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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 sync_preferences::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::Value(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 |