| 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 "chrome/browser/extensions/api/content_settings/content_settings_store.
h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "components/content_settings/core/browser/content_settings_rule.h" | 8 #include "components/content_settings/core/browser/content_settings_rule.h" |
| 9 #include "components/content_settings/core/browser/content_settings_utils.h" | 9 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 10 #include "components/content_settings/core/test/content_settings_test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 using ::testing::Mock; | 15 using ::testing::Mock; |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 ContentSetting GetContentSettingFromStore( | 50 ContentSetting GetContentSettingFromStore( |
| 50 const ContentSettingsStore* store, | 51 const ContentSettingsStore* store, |
| 51 const GURL& primary_url, const GURL& secondary_url, | 52 const GURL& primary_url, const GURL& secondary_url, |
| 52 ContentSettingsType content_type, | 53 ContentSettingsType content_type, |
| 53 const std::string& resource_identifier, | 54 const std::string& resource_identifier, |
| 54 bool incognito) { | 55 bool incognito) { |
| 55 scoped_ptr<content_settings::RuleIterator> rule_iterator( | 56 scoped_ptr<content_settings::RuleIterator> rule_iterator( |
| 56 store->GetRuleIterator(content_type, resource_identifier, incognito)); | 57 store->GetRuleIterator(content_type, resource_identifier, incognito)); |
| 57 scoped_ptr<base::Value> setting( | 58 scoped_ptr<base::Value> setting( |
| 58 content_settings::GetContentSettingValueAndPatterns( | 59 content_settings::TestUtils::GetContentSettingValueAndPatterns( |
| 59 rule_iterator.get(), primary_url, secondary_url, NULL, NULL)); | 60 rule_iterator.get(), primary_url, secondary_url, NULL, NULL)); |
| 60 return content_settings::ValueToContentSetting(setting.get()); | 61 return content_settings::ValueToContentSetting(setting.get()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void GetSettingsForOneTypeFromStore( | 64 void GetSettingsForOneTypeFromStore( |
| 64 const ContentSettingsStore* store, | 65 const ContentSettingsStore* store, |
| 65 ContentSettingsType content_type, | 66 ContentSettingsType content_type, |
| 66 const std::string& resource_identifier, | 67 const std::string& resource_identifier, |
| 67 bool incognito, | 68 bool incognito, |
| 68 std::vector<content_settings::Rule>* rules) { | 69 std::vector<content_settings::Rule>* rules) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 245 // Uninstall second extension. | 246 // Uninstall second extension. |
| 246 store()->UnregisterExtension(ext_id_2); | 247 store()->UnregisterExtension(ext_id_2); |
| 247 | 248 |
| 248 GetSettingsForOneTypeFromStore( | 249 GetSettingsForOneTypeFromStore( |
| 249 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); | 250 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); |
| 250 ASSERT_EQ(0u, rules.size()); | 251 ASSERT_EQ(0u, rules.size()); |
| 251 } | 252 } |
| 252 | 253 |
| 253 } // namespace extensions | 254 } // namespace extensions |
| OLD | NEW |