OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
28 #include "base/values.h" | 28 #include "base/values.h" |
29 #include "chrome/app/chrome_command_ids.h" | 29 #include "chrome/app/chrome_command_ids.h" |
30 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 30 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
31 #include "chrome/browser/background/background_contents_service.h" | 31 #include "chrome/browser/background/background_contents_service.h" |
32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/chrome_notification_types.h" | 33 #include "chrome/browser/chrome_notification_types.h" |
34 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 34 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
35 #include "chrome/browser/devtools/devtools_window_testing.h" | 35 #include "chrome/browser/devtools/devtools_window_testing.h" |
36 #include "chrome/browser/download/download_prefs.h" | 36 #include "chrome/browser/download/download_prefs.h" |
37 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" | 37 #include "chrome/browser/extensions/api/messaging/message_service.h" |
38 #include "chrome/browser/extensions/crx_installer.h" | 38 #include "chrome/browser/extensions/crx_installer.h" |
39 #include "chrome/browser/extensions/extension_service.h" | 39 #include "chrome/browser/extensions/extension_service.h" |
40 #include "chrome/browser/extensions/unpacked_installer.h" | 40 #include "chrome/browser/extensions/unpacked_installer.h" |
41 #include "chrome/browser/extensions/updater/extension_cache_fake.h" | 41 #include "chrome/browser/extensions/updater/extension_cache_fake.h" |
42 #include "chrome/browser/extensions/updater/extension_updater.h" | 42 #include "chrome/browser/extensions/updater/extension_updater.h" |
43 #include "chrome/browser/infobars/infobar_service.h" | 43 #include "chrome/browser/infobars/infobar_service.h" |
44 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 44 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
45 #include "chrome/browser/media/media_stream_devices_controller.h" | 45 #include "chrome/browser/media/media_stream_devices_controller.h" |
46 #include "chrome/browser/metrics/variations/variations_service.h" | 46 #include "chrome/browser/metrics/variations/variations_service.h" |
47 #include "chrome/browser/net/prediction_options.h" | 47 #include "chrome/browser/net/prediction_options.h" |
(...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 | 3164 |
3165 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistSelective) { | 3165 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistSelective) { |
3166 base::ListValue blacklist; | 3166 base::ListValue blacklist; |
3167 blacklist.Append(new base::StringValue("host.name")); | 3167 blacklist.Append(new base::StringValue("host.name")); |
3168 PolicyMap policies; | 3168 PolicyMap policies; |
3169 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, | 3169 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, |
3170 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); | 3170 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); |
3171 UpdateProviderPolicy(policies); | 3171 UpdateProviderPolicy(policies); |
3172 | 3172 |
3173 PrefService* prefs = browser()->profile()->GetPrefs(); | 3173 PrefService* prefs = browser()->profile()->GetPrefs(); |
3174 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3174 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3175 prefs, "host.name")); | 3175 prefs, "host.name")); |
3176 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3176 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3177 prefs, "other.host.name")); | 3177 prefs, "other.host.name")); |
3178 } | 3178 } |
3179 | 3179 |
3180 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistWildcard) { | 3180 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistWildcard) { |
3181 base::ListValue blacklist; | 3181 base::ListValue blacklist; |
3182 blacklist.Append(new base::StringValue("*")); | 3182 blacklist.Append(new base::StringValue("*")); |
3183 PolicyMap policies; | 3183 PolicyMap policies; |
3184 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, | 3184 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, |
3185 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); | 3185 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); |
3186 UpdateProviderPolicy(policies); | 3186 UpdateProviderPolicy(policies); |
3187 | 3187 |
3188 PrefService* prefs = browser()->profile()->GetPrefs(); | 3188 PrefService* prefs = browser()->profile()->GetPrefs(); |
3189 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3189 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3190 prefs, "host.name")); | 3190 prefs, "host.name")); |
3191 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3191 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3192 prefs, "other.host.name")); | 3192 prefs, "other.host.name")); |
3193 } | 3193 } |
3194 | 3194 |
3195 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingWhitelist) { | 3195 IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingWhitelist) { |
3196 base::ListValue blacklist; | 3196 base::ListValue blacklist; |
3197 blacklist.Append(new base::StringValue("*")); | 3197 blacklist.Append(new base::StringValue("*")); |
3198 base::ListValue whitelist; | 3198 base::ListValue whitelist; |
3199 whitelist.Append(new base::StringValue("host.name")); | 3199 whitelist.Append(new base::StringValue("host.name")); |
3200 PolicyMap policies; | 3200 PolicyMap policies; |
3201 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, | 3201 policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY, |
3202 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); | 3202 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); |
3203 policies.Set(key::kNativeMessagingWhitelist, POLICY_LEVEL_MANDATORY, | 3203 policies.Set(key::kNativeMessagingWhitelist, POLICY_LEVEL_MANDATORY, |
3204 POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL); | 3204 POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL); |
3205 UpdateProviderPolicy(policies); | 3205 UpdateProviderPolicy(policies); |
3206 | 3206 |
3207 PrefService* prefs = browser()->profile()->GetPrefs(); | 3207 PrefService* prefs = browser()->profile()->GetPrefs(); |
3208 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3208 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3209 prefs, "host.name")); | 3209 prefs, "host.name")); |
3210 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3210 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( |
3211 prefs, "other.host.name")); | 3211 prefs, "other.host.name")); |
3212 } | 3212 } |
3213 | 3213 |
3214 IN_PROC_BROWSER_TEST_F(PolicyTest, | 3214 IN_PROC_BROWSER_TEST_F(PolicyTest, |
3215 EnableDeprecatedWebPlatformFeatures_ShowModalDialog) { | 3215 EnableDeprecatedWebPlatformFeatures_ShowModalDialog) { |
3216 base::ListValue enabled_features; | 3216 base::ListValue enabled_features; |
3217 enabled_features.Append(new base::StringValue( | 3217 enabled_features.Append(new base::StringValue( |
3218 "ShowModalDialog_EffectiveUntil20150430")); | 3218 "ShowModalDialog_EffectiveUntil20150430")); |
3219 PolicyMap policies; | 3219 PolicyMap policies; |
3220 policies.Set(key::kEnableDeprecatedWebPlatformFeatures, | 3220 policies.Set(key::kEnableDeprecatedWebPlatformFeatures, |
(...skipping 11 matching lines...) Expand all Loading... |
3232 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3232 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
3233 browser2->tab_strip_model()->GetActiveWebContents(), | 3233 browser2->tab_strip_model()->GetActiveWebContents(), |
3234 "domAutomationController.send(window.showModalDialog !== undefined);", | 3234 "domAutomationController.send(window.showModalDialog !== undefined);", |
3235 &result)); | 3235 &result)); |
3236 EXPECT_TRUE(result); | 3236 EXPECT_TRUE(result); |
3237 } | 3237 } |
3238 | 3238 |
3239 #endif // !defined(CHROME_OS) | 3239 #endif // !defined(CHROME_OS) |
3240 | 3240 |
3241 } // namespace policy | 3241 } // namespace policy |
OLD | NEW |