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 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ |
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ |
7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" |
8 #include "components/content_settings/core/browser/content_settings_utils.h" | 10 #include "components/content_settings/core/browser/content_settings_utils.h" |
9 | 11 |
10 namespace content_settings { | 12 namespace content_settings { |
11 | 13 |
12 // The following two functions return the content setting (represented as | 14 class TestUtils { |
13 // Value or directly the ContentSetting enum) from |provider| for the | 15 public: |
14 // given |content_type| and |resource_identifier|. The returned content setting | 16 // The following two functions return the content setting (represented as |
15 // applies to the primary and secondary URL, and to the normal or incognito | 17 // Value or directly the ContentSetting enum) from |provider| for the |
16 // mode, depending on |include_incognito|. | 18 // given |content_type| and |resource_identifier|. The returned content |
17 base::Value* GetContentSettingValue(const ProviderInterface* provider, | 19 // setting applies to the primary and secondary URL, and to the normal or |
18 const GURL& primary_url, | 20 // incognito mode, depending on |include_incognito|. |
19 const GURL& secondary_url, | 21 static base::Value* GetContentSettingValue( |
20 ContentSettingsType content_type, | 22 const ProviderInterface* provider, |
21 const std::string& resource_identifier, | 23 const GURL& primary_url, |
22 bool include_incognito); | 24 const GURL& secondary_url, |
| 25 ContentSettingsType content_type, |
| 26 const std::string& resource_identifier, |
| 27 bool include_incognito); |
23 | 28 |
24 ContentSetting GetContentSetting(const ProviderInterface* provider, | 29 static ContentSetting GetContentSetting( |
25 const GURL& primary_url, | 30 const ProviderInterface* provider, |
26 const GURL& secondary_url, | 31 const GURL& primary_url, |
27 ContentSettingsType content_type, | 32 const GURL& secondary_url, |
28 const std::string& resource_identifier, | 33 ContentSettingsType content_type, |
29 bool include_incognito); | 34 const std::string& resource_identifier, |
| 35 bool include_incognito); |
| 36 |
| 37 // This wrapper exists only to make |
| 38 // HostContentSettingsMap::GetContentSettingValueAndPatterns public for use in |
| 39 // tests. |
| 40 static scoped_ptr<base::Value> GetContentSettingValueAndPatterns( |
| 41 content_settings::RuleIterator* rule_iterator, |
| 42 const GURL& primary_url, |
| 43 const GURL& secondary_url, |
| 44 ContentSettingsPattern* primary_pattern, |
| 45 ContentSettingsPattern* secondary_pattern); |
| 46 |
| 47 private: |
| 48 DISALLOW_IMPLICIT_CONSTRUCTORS(TestUtils); |
| 49 }; |
30 | 50 |
31 } // namespace content_settings | 51 } // namespace content_settings |
32 | 52 |
33 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ | 53 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_TEST_CONTENT_SETTINGS_TEST_UTILS_H_ |
OLD | NEW |