OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/plugin_info_message_filter.h" | 5 #include "chrome/browser/plugins/plugin_info_message_filter.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
15 #include "chrome/browser/plugins/plugin_utils.h" | 15 #include "chrome/browser/plugins/plugin_utils.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
20 #include "components/content_settings/core/common/pref_names.h" | 20 #include "components/content_settings/core/common/pref_names.h" |
21 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 21 #include "components/sync_preferences/testing_pref_service_syncable.h" |
22 #include "content/public/browser/plugin_service.h" | 22 #include "content/public/browser/plugin_service.h" |
23 #include "content/public/browser/plugin_service_filter.h" | 23 #include "content/public/browser/plugin_service_filter.h" |
24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
25 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
26 #include "content/public/test/test_browser_thread_bundle.h" | 26 #include "content/public/test/test_browser_thread_bundle.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "url/origin.h" | 29 #include "url/origin.h" |
30 | 30 |
31 using content::PluginService; | 31 using content::PluginService; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // There is no specific content setting for "bar", so the general setting | 260 // There is no specific content setting for "bar", so the general setting |
261 // for example.com applies. | 261 // for example.com applies. |
262 VerifyPluginContentSetting( | 262 VerifyPluginContentSetting( |
263 host, "bar", CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, false, false); | 263 host, "bar", CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, false, false); |
264 | 264 |
265 // Otherwise, use the default. | 265 // Otherwise, use the default. |
266 VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, | 266 VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, |
267 true, false); | 267 true, false); |
268 | 268 |
269 // Block plugins via policy. | 269 // Block plugins via policy. |
270 syncable_prefs::TestingPrefServiceSyncable* prefs = | 270 sync_preferences::TestingPrefServiceSyncable* prefs = |
271 profile()->GetTestingPrefService(); | 271 profile()->GetTestingPrefService(); |
272 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, | 272 prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, |
273 new base::FundamentalValue(CONTENT_SETTING_BLOCK)); | 273 new base::FundamentalValue(CONTENT_SETTING_BLOCK)); |
274 | 274 |
275 // All plugins should be blocked now. | 275 // All plugins should be blocked now. |
276 VerifyPluginContentSetting(host, "foo", CONTENT_SETTING_BLOCK, true, true); | 276 VerifyPluginContentSetting(host, "foo", CONTENT_SETTING_BLOCK, true, true); |
277 VerifyPluginContentSetting(host, "bar", CONTENT_SETTING_BLOCK, true, true); | 277 VerifyPluginContentSetting(host, "bar", CONTENT_SETTING_BLOCK, true, true); |
278 VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, | 278 VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, |
279 true, true); | 279 true, true); |
280 } | 280 } |
OLD | NEW |