OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/mock_pref_change_callback.h" | 9 #include "base/prefs/mock_pref_change_callback.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/extensions/./extension_prefs_unittest.h" | 11 #include "chrome/browser/extensions/./extension_prefs_unittest.h" |
12 #include "chrome/browser/extensions/api/content_settings/content_settings_servic
e.h" | 12 #include "chrome/browser/extensions/api/content_settings/content_settings_servic
e.h" |
13 #include "chrome/browser/extensions/api/preference/preference_api.h" | 13 #include "chrome/browser/extensions/api/preference/preference_api.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "components/content_settings/core/common/content_settings_client.h" |
15 #include "components/pref_registry/pref_registry_syncable.h" | 16 #include "components/pref_registry/pref_registry_syncable.h" |
16 #include "extensions/browser/extension_prefs.h" | 17 #include "extensions/browser/extension_prefs.h" |
| 18 #include "extensions/common/constants.h" |
17 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
19 | 21 |
20 using base::Value; | 22 using base::Value; |
21 | 23 |
22 namespace extensions { | 24 namespace extensions { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 const char kPref1[] = "path1.subpath"; | 28 const char kPref1[] = "path1.subpath"; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 ControlledPrefsInstallIncognitoSessionOnly) { } | 273 ControlledPrefsInstallIncognitoSessionOnly) { } |
272 | 274 |
273 class ControlledPrefsUninstallExtension : public ExtensionControlledPrefsTest { | 275 class ControlledPrefsUninstallExtension : public ExtensionControlledPrefsTest { |
274 virtual void Initialize() OVERRIDE { | 276 virtual void Initialize() OVERRIDE { |
275 InstallExtensionControlledPref( | 277 InstallExtensionControlledPref( |
276 extension1(), kPref1, new base::StringValue("val1")); | 278 extension1(), kPref1, new base::StringValue("val1")); |
277 InstallExtensionControlledPref( | 279 InstallExtensionControlledPref( |
278 extension1(), kPref2, new base::StringValue("val2")); | 280 extension1(), kPref2, new base::StringValue("val2")); |
279 scoped_refptr<ContentSettingsStore> store = content_settings_store(); | 281 scoped_refptr<ContentSettingsStore> store = content_settings_store(); |
280 ContentSettingsPattern pattern = | 282 ContentSettingsPattern pattern = |
281 ContentSettingsPattern::FromString("http://[*.]example.com"); | 283 ContentSettingsPattern::FromString(extensions::kExtensionScheme, |
| 284 "http://[*.]example.com"); |
282 store->SetExtensionContentSetting(extension1()->id(), | 285 store->SetExtensionContentSetting(extension1()->id(), |
283 pattern, pattern, | 286 pattern, pattern, |
284 CONTENT_SETTINGS_TYPE_IMAGES, | 287 CONTENT_SETTINGS_TYPE_IMAGES, |
285 std::string(), | 288 std::string(), |
286 CONTENT_SETTING_BLOCK, | 289 CONTENT_SETTING_BLOCK, |
287 kExtensionPrefsScopeRegular); | 290 kExtensionPrefsScopeRegular); |
288 | 291 |
289 UninstallExtension(extension1()->id()); | 292 UninstallExtension(extension1()->id()); |
290 } | 293 } |
291 virtual void Verify() OVERRIDE { | 294 virtual void Verify() OVERRIDE { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 EXPECT_EQ(kDefaultPref1, actual); | 479 EXPECT_EQ(kDefaultPref1, actual); |
477 } | 480 } |
478 } | 481 } |
479 | 482 |
480 private: | 483 private: |
481 int iteration_; | 484 int iteration_; |
482 }; | 485 }; |
483 TEST_F(ControlledPrefsDisableExtensions, ControlledPrefsDisableExtensions) { } | 486 TEST_F(ControlledPrefsDisableExtensions, ControlledPrefsDisableExtensions) { } |
484 | 487 |
485 } // namespace extensions | 488 } // namespace extensions |
OLD | NEW |