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 "chrome/browser/content_settings/content_settings_rule.h" | 8 #include "chrome/browser/content_settings/content_settings_rule.h" |
9 #include "chrome/browser/content_settings/content_settings_utils.h" | 9 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 10 #include "chrome/common/content_settings_component.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 while (rule_iterator->HasNext()) | 73 while (rule_iterator->HasNext()) |
73 rules->push_back(rule_iterator->Next()); | 74 rules->push_back(rule_iterator->Next()); |
74 } | 75 } |
75 | 76 |
76 } // namespace | 77 } // namespace |
77 | 78 |
78 class ContentSettingsStoreTest : public ::testing::Test { | 79 class ContentSettingsStoreTest : public ::testing::Test { |
79 public: | 80 public: |
80 ContentSettingsStoreTest() : | 81 ContentSettingsStoreTest() : |
81 store_(new ContentSettingsStore()) { | 82 store_(new ContentSettingsStore()) { |
| 83 InitContentSettingsComponent(); |
82 } | 84 } |
83 | 85 |
84 protected: | 86 protected: |
85 void RegisterExtension(const std::string& ext_id) { | 87 void RegisterExtension(const std::string& ext_id) { |
86 store_->RegisterExtension(ext_id, timer_.GetNext(), true); | 88 store_->RegisterExtension(ext_id, timer_.GetNext(), true); |
87 } | 89 } |
88 | 90 |
89 ContentSettingsStore* store() { | 91 ContentSettingsStore* store() { |
90 return store_.get(); | 92 return store_.get(); |
91 } | 93 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 246 |
245 // Uninstall second extension. | 247 // Uninstall second extension. |
246 store()->UnregisterExtension(ext_id_2); | 248 store()->UnregisterExtension(ext_id_2); |
247 | 249 |
248 GetSettingsForOneTypeFromStore( | 250 GetSettingsForOneTypeFromStore( |
249 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); | 251 store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); |
250 ASSERT_EQ(0u, rules.size()); | 252 ASSERT_EQ(0u, rules.size()); |
251 } | 253 } |
252 | 254 |
253 } // namespace extensions | 255 } // namespace extensions |
OLD | NEW |