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/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/guid.h" | 18 #include "base/guid.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/task/cancelable_task_tracker.h" | 24 #include "base/task/cancelable_task_tracker.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 26 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
27 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 27 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
28 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 28 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
29 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 29 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 30 #include "chrome/browser/browsing_data/browsing_data_remover_filter.h" |
30 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 31 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
31 #include "chrome/browser/browsing_data/origin_filter_builder.h" | 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
32 #include "chrome/browser/domain_reliability/service_factory.h" | 33 #include "chrome/browser/domain_reliability/service_factory.h" |
33 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 34 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
34 #include "chrome/browser/favicon/favicon_service_factory.h" | 35 #include "chrome/browser/favicon/favicon_service_factory.h" |
35 #include "chrome/browser/history/history_service_factory.h" | 36 #include "chrome/browser/history/history_service_factory.h" |
36 #include "chrome/browser/password_manager/password_store_factory.h" | 37 #include "chrome/browser/password_manager/password_store_factory.h" |
37 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
39 #include "chrome/test/base/testing_browser_process.h" | 40 #include "chrome/test/base/testing_browser_process.h" |
40 #include "chrome/test/base/testing_profile.h" | 41 #include "chrome/test/base/testing_profile.h" |
41 #include "components/autofill/core/browser/autofill_profile.h" | 42 #include "components/autofill/core/browser/autofill_profile.h" |
42 #include "components/autofill/core/browser/autofill_test_utils.h" | 43 #include "components/autofill/core/browser/autofill_test_utils.h" |
43 #include "components/autofill/core/browser/credit_card.h" | 44 #include "components/autofill/core/browser/credit_card.h" |
44 #include "components/autofill/core/browser/personal_data_manager.h" | 45 #include "components/autofill/core/browser/personal_data_manager.h" |
45 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 46 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
46 #include "components/bookmarks/browser/bookmark_model.h" | 47 #include "components/bookmarks/browser/bookmark_model.h" |
47 #include "components/bookmarks/test/bookmark_test_helpers.h" | 48 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 49 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 50 #include "components/content_settings/core/common/content_settings.h" |
| 51 #include "components/content_settings/core/common/content_settings_pattern.h" |
48 #include "components/domain_reliability/clear_mode.h" | 52 #include "components/domain_reliability/clear_mode.h" |
49 #include "components/domain_reliability/monitor.h" | 53 #include "components/domain_reliability/monitor.h" |
50 #include "components/domain_reliability/service.h" | 54 #include "components/domain_reliability/service.h" |
51 #include "components/favicon/core/favicon_service.h" | 55 #include "components/favicon/core/favicon_service.h" |
52 #include "components/history/core/browser/history_service.h" | 56 #include "components/history/core/browser/history_service.h" |
53 #include "components/omnibox/browser/omnibox_pref_names.h" | 57 #include "components/omnibox/browser/omnibox_pref_names.h" |
54 #include "components/password_manager/core/browser/mock_password_store.h" | 58 #include "components/password_manager/core/browser/mock_password_store.h" |
55 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 59 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
56 #include "components/password_manager/core/browser/password_store_consumer.h" | 60 #include "components/password_manager/core/browser/password_store_consumer.h" |
57 #include "components/prefs/testing_pref_service.h" | 61 #include "components/prefs/testing_pref_service.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 using testing::Invoke; | 113 using testing::Invoke; |
110 using testing::Matcher; | 114 using testing::Matcher; |
111 using testing::MakeMatcher; | 115 using testing::MakeMatcher; |
112 using testing::MatcherInterface; | 116 using testing::MatcherInterface; |
113 using testing::MatchResultListener; | 117 using testing::MatchResultListener; |
114 using testing::Return; | 118 using testing::Return; |
115 using testing::WithArgs; | 119 using testing::WithArgs; |
116 | 120 |
117 namespace { | 121 namespace { |
118 | 122 |
119 const char kTestOrigin1[] = "http://host1:1/"; | 123 const char kTestOrigin1[] = "http://host1.com:1/"; |
120 const char kTestOrigin2[] = "http://host2:1/"; | 124 const char kTestOrigin2[] = "http://host2.com:1/"; |
121 const char kTestOrigin3[] = "http://host3:1/"; | 125 const char kTestOrigin3[] = "http://host3.com:1/"; |
| 126 const char kTestOrigin4[] = "https://host3.com:1/"; |
122 const char kTestOriginExt[] = "chrome-extension://abcdefghijklmnopqrstuvwxyz/"; | 127 const char kTestOriginExt[] = "chrome-extension://abcdefghijklmnopqrstuvwxyz/"; |
123 const char kTestOriginDevTools[] = "chrome-devtools://abcdefghijklmnopqrstuvw/"; | 128 const char kTestOriginDevTools[] = "chrome-devtools://abcdefghijklmnopqrstuvw/"; |
124 | 129 |
125 // For Autofill. | 130 // For Autofill. |
126 const char kChromeOrigin[] = "Chrome settings"; | 131 const char kChromeOrigin[] = "Chrome settings"; |
127 const char kWebOrigin[] = "https://www.example.com/"; | 132 const char kWebOrigin[] = "https://www.example.com/"; |
128 | 133 |
129 const GURL kOrigin1(kTestOrigin1); | 134 const GURL kOrigin1(kTestOrigin1); |
130 const GURL kOrigin2(kTestOrigin2); | 135 const GURL kOrigin2(kTestOrigin2); |
131 const GURL kOrigin3(kTestOrigin3); | 136 const GURL kOrigin3(kTestOrigin3); |
| 137 const GURL kOrigin4(kTestOrigin4); |
132 const GURL kOriginExt(kTestOriginExt); | 138 const GURL kOriginExt(kTestOriginExt); |
133 const GURL kOriginDevTools(kTestOriginDevTools); | 139 const GURL kOriginDevTools(kTestOriginDevTools); |
134 | 140 |
135 const base::FilePath::CharType kDomStorageOrigin1[] = | 141 const base::FilePath::CharType kDomStorageOrigin1[] = |
136 FILE_PATH_LITERAL("http_host1_1.localstorage"); | 142 FILE_PATH_LITERAL("http_host1_1.localstorage"); |
137 | 143 |
138 const base::FilePath::CharType kDomStorageOrigin2[] = | 144 const base::FilePath::CharType kDomStorageOrigin2[] = |
139 FILE_PATH_LITERAL("http_host2_1.localstorage"); | 145 FILE_PATH_LITERAL("http_host2_1.localstorage"); |
140 | 146 |
141 const base::FilePath::CharType kDomStorageOrigin3[] = | 147 const base::FilePath::CharType kDomStorageOrigin3[] = |
142 FILE_PATH_LITERAL("http_host3_1.localstorage"); | 148 FILE_PATH_LITERAL("http_host3_1.localstorage"); |
143 | 149 |
144 const base::FilePath::CharType kDomStorageExt[] = FILE_PATH_LITERAL( | 150 const base::FilePath::CharType kDomStorageExt[] = FILE_PATH_LITERAL( |
145 "chrome-extension_abcdefghijklmnopqrstuvwxyz_0.localstorage"); | 151 "chrome-extension_abcdefghijklmnopqrstuvwxyz_0.localstorage"); |
146 | 152 |
| 153 bool MatchPrimaryPattern(const ContentSettingsPattern& expected_primary, |
| 154 const ContentSettingsPattern& primary_pattern, |
| 155 const ContentSettingsPattern& secondary_pattern) { |
| 156 return expected_primary == primary_pattern; |
| 157 } |
| 158 |
147 #if defined(OS_CHROMEOS) | 159 #if defined(OS_CHROMEOS) |
148 void FakeDBusCall(const chromeos::BoolDBusMethodCallback& callback) { | 160 void FakeDBusCall(const chromeos::BoolDBusMethodCallback& callback) { |
149 base::MessageLoop::current()->PostTask( | 161 base::MessageLoop::current()->PostTask( |
150 FROM_HERE, | 162 FROM_HERE, |
151 base::Bind(callback, chromeos::DBUS_METHOD_CALL_SUCCESS, true)); | 163 base::Bind(callback, chromeos::DBUS_METHOD_CALL_SUCCESS, true)); |
152 } | 164 } |
153 #endif | 165 #endif |
154 | 166 |
155 struct StoragePartitionRemovalData { | 167 struct StoragePartitionRemovalData { |
156 uint32_t remove_mask = 0; | 168 uint32_t remove_mask = 0; |
157 uint32_t quota_storage_remove_mask = 0; | 169 uint32_t quota_storage_remove_mask = 0; |
158 GURL remove_origin; | |
159 base::Time remove_begin; | 170 base::Time remove_begin; |
160 base::Time remove_end; | 171 base::Time remove_end; |
161 StoragePartition::OriginMatcherFunction origin_matcher; | 172 StoragePartition::OriginMatcherFunction origin_matcher; |
| 173 StoragePartition::CookieMatcherFunction cookie_matcher; |
162 | 174 |
163 StoragePartitionRemovalData() {} | 175 StoragePartitionRemovalData() {} |
164 }; | 176 }; |
165 | 177 |
| 178 net::CanonicalCookie CreateCookieWithHost(const GURL& source) { |
| 179 return net::CanonicalCookie( |
| 180 source, "A", "1", source.host(), "/", base::Time::Now(), |
| 181 base::Time::Now(), base::Time::Now(), false, false, |
| 182 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_MEDIUM); |
| 183 } |
| 184 |
166 class TestStoragePartition : public StoragePartition { | 185 class TestStoragePartition : public StoragePartition { |
167 public: | 186 public: |
168 TestStoragePartition() {} | 187 TestStoragePartition() {} |
169 ~TestStoragePartition() override {} | 188 ~TestStoragePartition() override {} |
170 | 189 |
171 // content::StoragePartition implementation. | 190 // content::StoragePartition implementation. |
172 base::FilePath GetPath() override { return base::FilePath(); } | 191 base::FilePath GetPath() override { return base::FilePath(); } |
173 net::URLRequestContextGetter* GetURLRequestContext() override { | 192 net::URLRequestContextGetter* GetURLRequestContext() override { |
174 return nullptr; | 193 return nullptr; |
175 } | 194 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 uint32_t quota_storage_remove_mask, | 245 uint32_t quota_storage_remove_mask, |
227 const GURL& storage_origin, | 246 const GURL& storage_origin, |
228 const OriginMatcherFunction& origin_matcher, | 247 const OriginMatcherFunction& origin_matcher, |
229 const base::Time begin, | 248 const base::Time begin, |
230 const base::Time end, | 249 const base::Time end, |
231 const base::Closure& callback) override { | 250 const base::Closure& callback) override { |
232 // Store stuff to verify parameters' correctness later. | 251 // Store stuff to verify parameters' correctness later. |
233 storage_partition_removal_data_.remove_mask = remove_mask; | 252 storage_partition_removal_data_.remove_mask = remove_mask; |
234 storage_partition_removal_data_.quota_storage_remove_mask = | 253 storage_partition_removal_data_.quota_storage_remove_mask = |
235 quota_storage_remove_mask; | 254 quota_storage_remove_mask; |
236 storage_partition_removal_data_.remove_origin = storage_origin; | |
237 storage_partition_removal_data_.remove_begin = begin; | 255 storage_partition_removal_data_.remove_begin = begin; |
238 storage_partition_removal_data_.remove_end = end; | 256 storage_partition_removal_data_.remove_end = end; |
239 storage_partition_removal_data_.origin_matcher = origin_matcher; | 257 storage_partition_removal_data_.origin_matcher = origin_matcher; |
240 | 258 |
241 BrowserThread::PostTask( | 259 BrowserThread::PostTask( |
242 BrowserThread::UI, | 260 BrowserThread::UI, |
243 FROM_HERE, | 261 FROM_HERE, |
244 base::Bind(&TestStoragePartition::AsyncRunCallback, | 262 base::Bind(&TestStoragePartition::AsyncRunCallback, |
245 base::Unretained(this), callback)); | 263 base::Unretained(this), callback)); |
246 } | 264 } |
247 | 265 |
| 266 void ClearData(uint32_t remove_mask, |
| 267 uint32_t quota_storage_remove_mask, |
| 268 const OriginMatcherFunction& origin_matcher, |
| 269 const CookieMatcherFunction& cookie_matcher, |
| 270 const base::Time begin, |
| 271 const base::Time end, |
| 272 const base::Closure& callback) override { |
| 273 // Store stuff to verify parameters' correctness later. |
| 274 storage_partition_removal_data_.remove_mask = remove_mask; |
| 275 storage_partition_removal_data_.quota_storage_remove_mask = |
| 276 quota_storage_remove_mask; |
| 277 storage_partition_removal_data_.remove_begin = begin; |
| 278 storage_partition_removal_data_.remove_end = end; |
| 279 storage_partition_removal_data_.origin_matcher = origin_matcher; |
| 280 storage_partition_removal_data_.cookie_matcher = cookie_matcher; |
| 281 |
| 282 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 283 base::Bind(&TestStoragePartition::AsyncRunCallback, |
| 284 base::Unretained(this), callback)); |
| 285 } |
| 286 |
248 void Flush() override {} | 287 void Flush() override {} |
249 | 288 |
250 StoragePartitionRemovalData GetStoragePartitionRemovalData() { | 289 StoragePartitionRemovalData GetStoragePartitionRemovalData() { |
251 return storage_partition_removal_data_; | 290 return storage_partition_removal_data_; |
252 } | 291 } |
253 | 292 |
254 private: | 293 private: |
255 void AsyncRunCallback(const base::Closure& callback) { | 294 void AsyncRunCallback(const base::Closure& callback) { |
256 callback.Run(); | 295 callback.Run(); |
257 } | 296 } |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 int remove_mask, | 1057 int remove_mask, |
1019 const GURL& remove_origin) { | 1058 const GURL& remove_origin) { |
1020 BrowsingDataRemover* remover = | 1059 BrowsingDataRemover* remover = |
1021 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); | 1060 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); |
1022 TestStoragePartition storage_partition; | 1061 TestStoragePartition storage_partition; |
1023 remover->OverrideStoragePartitionForTesting(&storage_partition); | 1062 remover->OverrideStoragePartitionForTesting(&storage_partition); |
1024 | 1063 |
1025 called_with_details_.reset(new BrowsingDataRemover::NotificationDetails()); | 1064 called_with_details_.reset(new BrowsingDataRemover::NotificationDetails()); |
1026 | 1065 |
1027 BrowsingDataRemoverCompletionObserver completion_observer(remover); | 1066 BrowsingDataRemoverCompletionObserver completion_observer(remover); |
| 1067 |
| 1068 if (remove_origin.is_empty()) { |
| 1069 BrowsingDataRemoverFilter builder(BrowsingDataRemoverFilter::BLACKLIST); |
| 1070 remover->RemoveImpl(BrowsingDataRemover::Period(period), remove_mask, |
| 1071 builder, BrowsingDataHelper::UNPROTECTED_WEB); |
| 1072 } else { |
| 1073 BrowsingDataRemoverFilter builder(BrowsingDataRemoverFilter::WHITELIST); |
| 1074 builder.AddOrigin(url::Origin(remove_origin)); |
| 1075 remover->RemoveImpl(BrowsingDataRemover::Period(period), remove_mask, |
| 1076 builder, BrowsingDataHelper::UNPROTECTED_WEB); |
| 1077 } |
| 1078 completion_observer.BlockUntilCompletion(); |
| 1079 |
| 1080 // Save so we can verify later. |
| 1081 storage_partition_removal_data_ = |
| 1082 storage_partition.GetStoragePartitionRemovalData(); |
| 1083 } |
| 1084 |
| 1085 void BlockUntilOriginDataRemoved( |
| 1086 BrowsingDataRemover::TimePeriod period, |
| 1087 int remove_mask, |
| 1088 const BrowsingDataRemoverFilter& filter_builder) { |
| 1089 BrowsingDataRemover* remover = |
| 1090 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); |
| 1091 TestStoragePartition storage_partition; |
| 1092 remover->OverrideStoragePartitionForTesting(&storage_partition); |
| 1093 |
| 1094 called_with_details_.reset(new BrowsingDataRemover::NotificationDetails()); |
| 1095 |
| 1096 BrowsingDataRemoverCompletionObserver completion_observer(remover); |
1028 remover->RemoveImpl(BrowsingDataRemover::Period(period), remove_mask, | 1097 remover->RemoveImpl(BrowsingDataRemover::Period(period), remove_mask, |
1029 remove_origin, BrowsingDataHelper::UNPROTECTED_WEB); | 1098 filter_builder, BrowsingDataHelper::UNPROTECTED_WEB); |
1030 completion_observer.BlockUntilCompletion(); | 1099 completion_observer.BlockUntilCompletion(); |
1031 | 1100 |
1032 // Save so we can verify later. | 1101 // Save so we can verify later. |
1033 storage_partition_removal_data_ = | 1102 storage_partition_removal_data_ = |
1034 storage_partition.GetStoragePartitionRemovalData(); | 1103 storage_partition.GetStoragePartitionRemovalData(); |
1035 } | 1104 } |
1036 | 1105 |
1037 TestingProfile* GetProfile() { | 1106 TestingProfile* GetProfile() { |
1038 return profile_.get(); | 1107 return profile_.get(); |
1039 } | 1108 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 | 1198 |
1130 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 1199 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
1131 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 1200 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
1132 | 1201 |
1133 // Verify that storage partition was instructed to remove the cookies. | 1202 // Verify that storage partition was instructed to remove the cookies. |
1134 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1203 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1135 EXPECT_EQ(removal_data.remove_mask, | 1204 EXPECT_EQ(removal_data.remove_mask, |
1136 StoragePartition::REMOVE_DATA_MASK_COOKIES); | 1205 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
1137 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1206 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1138 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1207 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1139 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1140 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1208 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1141 } | 1209 } |
1142 | 1210 |
1143 TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { | 1211 TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { |
1144 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, | 1212 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, |
1145 BrowsingDataRemover::REMOVE_COOKIES, | 1213 BrowsingDataRemover::REMOVE_COOKIES, |
1146 false); | 1214 false); |
1147 | 1215 |
1148 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 1216 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
1149 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 1217 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
1150 | 1218 |
1151 // Verify that storage partition was instructed to remove the cookies. | 1219 // Verify that storage partition was instructed to remove the cookies. |
1152 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1220 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1153 EXPECT_EQ(removal_data.remove_mask, | 1221 EXPECT_EQ(removal_data.remove_mask, |
1154 StoragePartition::REMOVE_DATA_MASK_COOKIES); | 1222 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
1155 // Removing with time period other than EVERYTHING should not clear | 1223 // Removing with time period other than EVERYTHING should not clear |
1156 // persistent storage data. | 1224 // persistent storage data. |
1157 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1225 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1158 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); | 1226 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
1159 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1160 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1227 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1161 } | 1228 } |
1162 | 1229 |
| 1230 TEST_F(BrowsingDataRemoverTest, RemoveCookiesOriginBlacklist) { |
| 1231 BrowsingDataRemoverFilter filter(BrowsingDataRemoverFilter::BLACKLIST); |
| 1232 filter.AddOrigin(url::Origin(kOrigin1)); |
| 1233 filter.AddOrigin(url::Origin(kOrigin3)); |
| 1234 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, |
| 1235 BrowsingDataRemover::REMOVE_COOKIES, filter); |
| 1236 |
| 1237 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
| 1238 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
| 1239 |
| 1240 // Verify that storage partition was instructed to remove the cookies. |
| 1241 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
| 1242 EXPECT_EQ(removal_data.remove_mask, |
| 1243 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
| 1244 // Removing with time period other than EVERYTHING should not clear |
| 1245 // persistent storage data. |
| 1246 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
| 1247 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
| 1248 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
| 1249 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
| 1250 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
| 1251 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
| 1252 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin4, mock_policy())); |
| 1253 |
| 1254 EXPECT_FALSE(removal_data.cookie_matcher.Run(CreateCookieWithHost(kOrigin1))); |
| 1255 EXPECT_TRUE(removal_data.cookie_matcher.Run(CreateCookieWithHost(kOrigin2))); |
| 1256 EXPECT_FALSE(removal_data.cookie_matcher.Run(CreateCookieWithHost(kOrigin3))); |
| 1257 // This is false, because this is the same domain as 3, just with a different |
| 1258 // scheme. |
| 1259 EXPECT_FALSE(removal_data.cookie_matcher.Run(CreateCookieWithHost(kOrigin4))); |
| 1260 } |
| 1261 |
1163 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { | 1262 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { |
1164 RemoveSafeBrowsingCookieTester tester; | 1263 RemoveSafeBrowsingCookieTester tester; |
1165 | 1264 |
1166 tester.AddCookie(); | 1265 tester.AddCookie(); |
1167 ASSERT_TRUE(tester.ContainsCookie()); | 1266 ASSERT_TRUE(tester.ContainsCookie()); |
1168 | 1267 |
1169 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 1268 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
1170 BrowsingDataRemover::REMOVE_COOKIES, false); | 1269 BrowsingDataRemover::REMOVE_COOKIES, false); |
1171 | 1270 |
1172 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 1271 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
(...skipping 10 matching lines...) Expand all Loading... |
1183 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, | 1282 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, |
1184 BrowsingDataRemover::REMOVE_COOKIES, false); | 1283 BrowsingDataRemover::REMOVE_COOKIES, false); |
1185 | 1284 |
1186 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 1285 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
1187 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 1286 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
1188 // Removing with time period other than EVERYTHING should not clear safe | 1287 // Removing with time period other than EVERYTHING should not clear safe |
1189 // browsing cookies. | 1288 // browsing cookies. |
1190 EXPECT_TRUE(tester.ContainsCookie()); | 1289 EXPECT_TRUE(tester.ContainsCookie()); |
1191 } | 1290 } |
1192 | 1291 |
| 1292 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForeverWithPredicate) { |
| 1293 RemoveSafeBrowsingCookieTester tester; |
| 1294 |
| 1295 tester.AddCookie(); |
| 1296 ASSERT_TRUE(tester.ContainsCookie()); |
| 1297 BrowsingDataRemoverFilter filter(BrowsingDataRemoverFilter::BLACKLIST); |
| 1298 filter.AddOrigin(url::Origin(kOrigin1)); |
| 1299 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, |
| 1300 BrowsingDataRemover::REMOVE_COOKIES, filter); |
| 1301 |
| 1302 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
| 1303 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
| 1304 EXPECT_TRUE(tester.ContainsCookie()); |
| 1305 |
| 1306 BrowsingDataRemoverFilter filter2(BrowsingDataRemoverFilter::WHITELIST); |
| 1307 filter2.AddOrigin(url::Origin(kOrigin1)); |
| 1308 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, |
| 1309 BrowsingDataRemover::REMOVE_COOKIES, filter2); |
| 1310 EXPECT_FALSE(tester.ContainsCookie()); |
| 1311 } |
| 1312 |
1193 TEST_F(BrowsingDataRemoverTest, RemoveChannelIDForever) { | 1313 TEST_F(BrowsingDataRemoverTest, RemoveChannelIDForever) { |
1194 RemoveChannelIDTester tester(GetProfile()); | 1314 RemoveChannelIDTester tester(GetProfile()); |
1195 | 1315 |
1196 tester.AddChannelID(kTestOrigin1); | 1316 tester.AddChannelID(kTestOrigin1); |
1197 EXPECT_EQ(0, tester.ssl_config_changed_count()); | 1317 EXPECT_EQ(0, tester.ssl_config_changed_count()); |
1198 EXPECT_EQ(1, tester.ChannelIDCount()); | 1318 EXPECT_EQ(1, tester.ChannelIDCount()); |
1199 | 1319 |
1200 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 1320 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
1201 BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); | 1321 BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); |
1202 | 1322 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 | 1362 |
1243 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); | 1363 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); |
1244 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 1364 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
1245 | 1365 |
1246 // Verify that storage partition was instructed to remove the data correctly. | 1366 // Verify that storage partition was instructed to remove the data correctly. |
1247 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1367 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1248 EXPECT_EQ(removal_data.remove_mask, | 1368 EXPECT_EQ(removal_data.remove_mask, |
1249 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); | 1369 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); |
1250 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1370 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1251 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1371 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1252 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1253 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1372 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1254 | 1373 |
1255 // Check origin matcher. | 1374 // Check origin matcher. |
1256 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), | 1375 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), |
1257 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1376 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1258 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1377 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1259 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1378 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1260 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); | 1379 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); |
1261 } | 1380 } |
1262 | 1381 |
(...skipping 11 matching lines...) Expand all Loading... |
1274 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); | 1393 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); |
1275 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB | | 1394 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB | |
1276 BrowsingDataHelper::PROTECTED_WEB, GetOriginTypeMask()); | 1395 BrowsingDataHelper::PROTECTED_WEB, GetOriginTypeMask()); |
1277 | 1396 |
1278 // Verify that storage partition was instructed to remove the data correctly. | 1397 // Verify that storage partition was instructed to remove the data correctly. |
1279 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1398 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1280 EXPECT_EQ(removal_data.remove_mask, | 1399 EXPECT_EQ(removal_data.remove_mask, |
1281 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); | 1400 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); |
1282 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1401 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1283 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1402 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1284 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1285 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1403 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1286 | 1404 |
1287 // Check origin matcher all http origin will match since we specified | 1405 // Check origin matcher all http origin will match since we specified |
1288 // both protected and unprotected. | 1406 // both protected and unprotected. |
1289 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1407 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1290 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1408 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1291 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1409 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1292 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); | 1410 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); |
1293 } | 1411 } |
1294 | 1412 |
1295 TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) { | 1413 TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) { |
1296 #if defined(ENABLE_EXTENSIONS) | 1414 #if defined(ENABLE_EXTENSIONS) |
1297 CreateMockPolicy(); | 1415 CreateMockPolicy(); |
1298 #endif | 1416 #endif |
1299 | 1417 |
1300 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK, | 1418 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK, |
1301 BrowsingDataRemover::REMOVE_LOCAL_STORAGE, | 1419 BrowsingDataRemover::REMOVE_LOCAL_STORAGE, |
1302 false); | 1420 false); |
1303 | 1421 |
1304 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); | 1422 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); |
1305 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 1423 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
1306 | 1424 |
1307 // Verify that storage partition was instructed to remove the data correctly. | 1425 // Verify that storage partition was instructed to remove the data correctly. |
1308 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1426 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1309 EXPECT_EQ(removal_data.remove_mask, | 1427 EXPECT_EQ(removal_data.remove_mask, |
1310 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); | 1428 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); |
1311 // Persistent storage won't be deleted. | 1429 // Persistent storage won't be deleted. |
1312 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1430 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1313 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); | 1431 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
1314 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1315 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1432 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1316 | 1433 |
1317 // Check origin matcher. | 1434 // Check origin matcher. |
1318 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1435 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1319 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1436 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1320 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1437 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1321 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); | 1438 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); |
1322 } | 1439 } |
1323 | 1440 |
1324 TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) { | 1441 TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); | 1627 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
1511 EXPECT_EQ(removal_data.remove_mask, | 1628 EXPECT_EQ(removal_data.remove_mask, |
1512 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1629 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1513 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1630 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1514 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1631 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1515 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1632 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1516 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1633 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1517 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1634 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1518 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1635 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1519 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1636 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1520 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1521 } | 1637 } |
1522 | 1638 |
1523 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) { | 1639 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) { |
1524 #if defined(ENABLE_EXTENSIONS) | 1640 #if defined(ENABLE_EXTENSIONS) |
1525 CreateMockPolicy(); | 1641 CreateMockPolicy(); |
1526 #endif | 1642 #endif |
1527 | 1643 |
1528 BlockUntilBrowsingDataRemoved( | 1644 BlockUntilBrowsingDataRemoved( |
1529 BrowsingDataRemover::EVERYTHING, | 1645 BrowsingDataRemover::EVERYTHING, |
1530 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | | 1646 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
(...skipping 18 matching lines...) Expand all Loading... |
1549 | 1665 |
1550 EXPECT_EQ(removal_data.remove_mask, | 1666 EXPECT_EQ(removal_data.remove_mask, |
1551 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1667 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1552 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1668 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1553 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1669 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1554 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1670 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1555 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1671 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1556 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1672 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1557 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1673 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1558 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1674 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1559 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1560 | 1675 |
1561 // Check that all related origin data would be removed, that is, origin | 1676 // Check that all related origin data would be removed, that is, origin |
1562 // matcher would match these origin. | 1677 // matcher would match these origin. |
1563 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1678 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1564 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1679 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1565 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1680 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1566 } | 1681 } |
1567 | 1682 |
1568 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) { | 1683 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) { |
1569 #if defined(ENABLE_EXTENSIONS) | 1684 #if defined(ENABLE_EXTENSIONS) |
(...skipping 24 matching lines...) Expand all Loading... |
1594 | 1709 |
1595 EXPECT_EQ(removal_data.remove_mask, | 1710 EXPECT_EQ(removal_data.remove_mask, |
1596 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1711 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1597 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1712 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1598 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1713 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1599 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1714 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1600 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1715 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1601 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1716 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1602 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1717 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1603 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1718 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1604 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1605 | 1719 |
1606 // Check that all related origin data would be removed, that is, origin | 1720 // Check that all related origin data would be removed, that is, origin |
1607 // matcher would match these origin. | 1721 // matcher would match these origin. |
1608 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1722 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1609 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1723 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1610 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1724 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1611 } | 1725 } |
1612 | 1726 |
1613 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) { | 1727 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) { |
1614 #if defined(ENABLE_EXTENSIONS) | 1728 #if defined(ENABLE_EXTENSIONS) |
(...skipping 24 matching lines...) Expand all Loading... |
1639 | 1753 |
1640 EXPECT_EQ(removal_data.remove_mask, | 1754 EXPECT_EQ(removal_data.remove_mask, |
1641 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1755 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1642 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1756 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1643 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1757 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1644 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1758 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1645 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1759 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1646 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1760 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1647 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1761 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1648 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1762 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1649 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1650 | 1763 |
1651 // Check that all related origin data would be removed, that is, origin | 1764 // Check that all related origin data would be removed, that is, origin |
1652 // matcher would match these origin. | 1765 // matcher would match these origin. |
1653 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1766 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1654 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1767 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1655 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1768 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1656 } | 1769 } |
1657 | 1770 |
1658 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { | 1771 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { |
1659 // Remove Origin 1. | 1772 // Remove Origin 1. |
(...skipping 20 matching lines...) Expand all Loading... |
1680 | 1793 |
1681 EXPECT_EQ(removal_data.remove_mask, | 1794 EXPECT_EQ(removal_data.remove_mask, |
1682 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1795 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1683 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1796 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1684 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1797 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1685 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1798 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1686 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1799 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1687 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1800 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1688 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1801 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1689 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1802 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1690 EXPECT_EQ(removal_data.remove_origin, kOrigin1); | 1803 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
| 1804 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
| 1805 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
| 1806 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin4, mock_policy())); |
1691 } | 1807 } |
1692 | 1808 |
1693 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { | 1809 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { |
1694 BlockUntilBrowsingDataRemoved( | 1810 BlockUntilBrowsingDataRemoved( |
1695 BrowsingDataRemover::LAST_HOUR, | 1811 BrowsingDataRemover::LAST_HOUR, |
1696 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | | 1812 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
1697 BrowsingDataRemover::REMOVE_WEBSQL | | 1813 BrowsingDataRemover::REMOVE_WEBSQL | |
1698 BrowsingDataRemover::REMOVE_APPCACHE | | 1814 BrowsingDataRemover::REMOVE_APPCACHE | |
1699 BrowsingDataRemover::REMOVE_SERVICE_WORKERS | | 1815 BrowsingDataRemover::REMOVE_SERVICE_WORKERS | |
1700 BrowsingDataRemover::REMOVE_CACHE_STORAGE | | 1816 BrowsingDataRemover::REMOVE_CACHE_STORAGE | |
(...skipping 18 matching lines...) Expand all Loading... |
1719 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1835 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1720 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1836 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1721 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1837 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1722 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1838 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1723 | 1839 |
1724 // Persistent data would be left out since we are not removing from | 1840 // Persistent data would be left out since we are not removing from |
1725 // beginning of time. | 1841 // beginning of time. |
1726 uint32_t expected_quota_mask = | 1842 uint32_t expected_quota_mask = |
1727 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | 1843 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
1728 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); | 1844 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); |
1729 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1730 // Check removal begin time. | 1845 // Check removal begin time. |
1731 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1846 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1732 } | 1847 } |
1733 | 1848 |
1734 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) { | 1849 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) { |
1735 BlockUntilBrowsingDataRemoved( | 1850 BlockUntilBrowsingDataRemoved( |
1736 BrowsingDataRemover::LAST_WEEK, | 1851 BrowsingDataRemover::LAST_WEEK, |
1737 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | | 1852 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
1738 BrowsingDataRemover::REMOVE_WEBSQL | | 1853 BrowsingDataRemover::REMOVE_WEBSQL | |
1739 BrowsingDataRemover::REMOVE_APPCACHE | | 1854 BrowsingDataRemover::REMOVE_APPCACHE | |
(...skipping 20 matching lines...) Expand all Loading... |
1760 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1875 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1761 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1876 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1762 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1877 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1763 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1878 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1764 | 1879 |
1765 // Persistent data would be left out since we are not removing from | 1880 // Persistent data would be left out since we are not removing from |
1766 // beginning of time. | 1881 // beginning of time. |
1767 uint32_t expected_quota_mask = | 1882 uint32_t expected_quota_mask = |
1768 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; | 1883 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; |
1769 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); | 1884 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); |
1770 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1771 // Check removal begin time. | 1885 // Check removal begin time. |
1772 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 1886 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
1773 } | 1887 } |
1774 | 1888 |
1775 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedUnprotectedOrigins) { | 1889 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedUnprotectedOrigins) { |
1776 #if defined(ENABLE_EXTENSIONS) | 1890 #if defined(ENABLE_EXTENSIONS) |
1777 MockExtensionSpecialStoragePolicy* policy = CreateMockPolicy(); | 1891 MockExtensionSpecialStoragePolicy* policy = CreateMockPolicy(); |
1778 // Protect kOrigin1. | 1892 // Protect kOrigin1. |
1779 policy->AddProtected(kOrigin1.GetOrigin()); | 1893 policy->AddProtected(kOrigin1.GetOrigin()); |
1780 #endif | 1894 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
1803 | 1917 |
1804 EXPECT_EQ(removal_data.remove_mask, | 1918 EXPECT_EQ(removal_data.remove_mask, |
1805 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1919 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1806 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1920 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1807 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1921 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1808 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1922 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1809 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1923 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1810 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1924 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1811 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1925 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1812 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1926 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1813 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1814 | 1927 |
1815 // Check OriginMatcherFunction. | 1928 // Check OriginMatcherFunction. |
1816 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), | 1929 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), |
1817 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1930 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1818 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1931 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1819 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1932 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1820 } | 1933 } |
1821 | 1934 |
1822 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) { | 1935 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) { |
1823 #if defined(ENABLE_EXTENSIONS) | 1936 #if defined(ENABLE_EXTENSIONS) |
(...skipping 26 matching lines...) Expand all Loading... |
1850 | 1963 |
1851 EXPECT_EQ(removal_data.remove_mask, | 1964 EXPECT_EQ(removal_data.remove_mask, |
1852 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 1965 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1853 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 1966 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1854 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 1967 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1855 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 1968 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1856 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 1969 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1857 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 1970 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1858 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 1971 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1859 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 1972 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1860 EXPECT_EQ(removal_data.remove_origin, kOrigin1); | |
1861 | 1973 |
1862 // Check OriginMatcherFunction. | 1974 // Check OriginMatcherFunction. |
1863 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), | 1975 EXPECT_EQ(ShouldRemoveForProtectedOriginOne(), |
1864 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 1976 removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1865 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 1977 // Since we use the matcher function to validate origins now, this should |
1866 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 1978 // return false for the origins we're not trying to clear. |
| 1979 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
| 1980 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1867 } | 1981 } |
1868 | 1982 |
1869 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) { | 1983 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) { |
1870 #if defined(ENABLE_EXTENSIONS) | 1984 #if defined(ENABLE_EXTENSIONS) |
1871 MockExtensionSpecialStoragePolicy* policy = CreateMockPolicy(); | 1985 MockExtensionSpecialStoragePolicy* policy = CreateMockPolicy(); |
1872 // Protect kOrigin1. | 1986 // Protect kOrigin1. |
1873 policy->AddProtected(kOrigin1.GetOrigin()); | 1987 policy->AddProtected(kOrigin1.GetOrigin()); |
1874 #endif | 1988 #endif |
1875 | 1989 |
1876 // Try to remove kOrigin1. Expect success. | 1990 // Try to remove kOrigin1. Expect success. |
(...skipping 22 matching lines...) Expand all Loading... |
1899 | 2013 |
1900 EXPECT_EQ(removal_data.remove_mask, | 2014 EXPECT_EQ(removal_data.remove_mask, |
1901 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 2015 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1902 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 2016 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1903 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 2017 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1904 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 2018 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1905 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 2019 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1906 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 2020 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1907 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 2021 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1908 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 2022 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1909 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1910 | 2023 |
1911 // Check OriginMatcherFunction, |kOrigin1| would match mask since we | 2024 // Check OriginMatcherFunction, |kOrigin1| would match mask since we |
1912 // would have 'protected' specified in origin_type_mask. | 2025 // would have 'protected' specified in origin_type_mask. |
1913 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); | 2026 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy())); |
1914 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); | 2027 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy())); |
1915 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); | 2028 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy())); |
1916 } | 2029 } |
1917 | 2030 |
1918 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) { | 2031 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) { |
1919 #if defined(ENABLE_EXTENSIONS) | 2032 #if defined(ENABLE_EXTENSIONS) |
(...skipping 24 matching lines...) Expand all Loading... |
1944 | 2057 |
1945 EXPECT_EQ(removal_data.remove_mask, | 2058 EXPECT_EQ(removal_data.remove_mask, |
1946 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 2059 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
1947 StoragePartition::REMOVE_DATA_MASK_WEBSQL | | 2060 StoragePartition::REMOVE_DATA_MASK_WEBSQL | |
1948 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 2061 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
1949 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | | 2062 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS | |
1950 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | | 2063 StoragePartition::REMOVE_DATA_MASK_CACHE_STORAGE | |
1951 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); | 2064 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); |
1952 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 2065 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
1953 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); | 2066 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); |
1954 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | |
1955 | 2067 |
1956 // Check that extension and devtools data wouldn't be removed, that is, | 2068 // Check that extension and devtools data wouldn't be removed, that is, |
1957 // origin matcher would not match these origin. | 2069 // origin matcher would not match these origin. |
1958 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); | 2070 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy())); |
1959 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginDevTools, mock_policy())); | 2071 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginDevTools, mock_policy())); |
1960 } | 2072 } |
1961 | 2073 |
1962 TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) { | 2074 TEST_F(BrowsingDataRemoverTest, TimeBasedHistoryRemoval) { |
1963 RemoveHistoryTester tester; | 2075 RemoveHistoryTester tester; |
1964 ASSERT_TRUE(tester.Init(GetProfile())); | 2076 ASSERT_TRUE(tester.Init(GetProfile())); |
1965 | 2077 |
1966 base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2); | |
1967 | |
1968 tester.AddHistory(kOrigin1, base::Time::Now()); | |
1969 tester.AddHistory(kOrigin2, two_hours_ago); | |
1970 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); | |
1971 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin2)); | |
1972 | |
1973 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, | |
1974 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2); | |
1975 | |
1976 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); | |
1977 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | |
1978 | |
1979 // Nothing should have been deleted. | |
1980 EXPECT_TRUE(tester.HistoryContainsURL(kOrigin1)); | |
1981 EXPECT_FALSE(tester.HistoryContainsURL(kOrigin2)); | |
1982 } | |
1983 | |
1984 TEST_F(BrowsingDataRemoverTest, OriginAndTimeBasedHistoryRemoval) { | |
1985 RemoveHistoryTester tester; | |
1986 ASSERT_TRUE(tester.Init(GetProfile())); | |
1987 | |
1988 base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2); | 2078 base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2); |
1989 | 2079 |
1990 tester.AddHistory(kOrigin1, base::Time::Now()); | 2080 tester.AddHistory(kOrigin1, base::Time::Now()); |
1991 tester.AddHistory(kOrigin2, two_hours_ago); | 2081 tester.AddHistory(kOrigin2, two_hours_ago); |
1992 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); | 2082 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); |
1993 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin2)); | 2083 ASSERT_TRUE(tester.HistoryContainsURL(kOrigin2)); |
1994 | 2084 |
1995 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, | 2085 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, |
1996 BrowsingDataRemover::REMOVE_HISTORY, kOrigin2); | 2086 BrowsingDataRemover::REMOVE_HISTORY, GURL()); |
1997 | 2087 |
1998 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); | 2088 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
1999 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); | 2089 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
2000 EXPECT_TRUE(tester.HistoryContainsURL(kOrigin1)); | 2090 EXPECT_FALSE(tester.HistoryContainsURL(kOrigin1)); |
2001 EXPECT_TRUE(tester.HistoryContainsURL(kOrigin2)); | 2091 EXPECT_TRUE(tester.HistoryContainsURL(kOrigin2)); |
2002 } | 2092 } |
2003 | 2093 |
2004 // Verify that clearing autofill form data works. | 2094 // Verify that clearing autofill form data works. |
2005 TEST_F(BrowsingDataRemoverTest, AutofillRemovalLastHour) { | 2095 TEST_F(BrowsingDataRemoverTest, AutofillRemovalLastHour) { |
2006 GetProfile()->CreateWebDataService(); | 2096 GetProfile()->CreateWebDataService(); |
2007 RemoveAutofillTester tester(GetProfile()); | 2097 RemoveAutofillTester tester(GetProfile()); |
2008 | 2098 |
2009 ASSERT_FALSE(tester.HasProfile()); | 2099 ASSERT_FALSE(tester.HasProfile()); |
2010 tester.AddProfilesAndCards(); | 2100 tester.AddProfilesAndCards(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 TEST_F(BrowsingDataRemoverTest, DISABLED_DomainReliability_NoMonitor) { | 2311 TEST_F(BrowsingDataRemoverTest, DISABLED_DomainReliability_NoMonitor) { |
2222 BlockUntilBrowsingDataRemoved( | 2312 BlockUntilBrowsingDataRemoved( |
2223 BrowsingDataRemover::EVERYTHING, | 2313 BrowsingDataRemover::EVERYTHING, |
2224 BrowsingDataRemover::REMOVE_HISTORY | | 2314 BrowsingDataRemover::REMOVE_HISTORY | |
2225 BrowsingDataRemover::REMOVE_COOKIES, false); | 2315 BrowsingDataRemover::REMOVE_COOKIES, false); |
2226 } | 2316 } |
2227 | 2317 |
2228 TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByTimeOnly) { | 2318 TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByTimeOnly) { |
2229 RemoveDownloadsTester tester(GetProfile()); | 2319 RemoveDownloadsTester tester(GetProfile()); |
2230 base::Callback<bool(const GURL&)> filter = | 2320 base::Callback<bool(const GURL&)> filter = |
2231 OriginFilterBuilder::BuildNoopFilter(); | 2321 BrowsingDataRemoverFilter::BuildNoopFilter(); |
2232 | 2322 |
2233 EXPECT_CALL( | 2323 EXPECT_CALL( |
2234 *tester.download_manager(), | 2324 *tester.download_manager(), |
2235 RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); | 2325 RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); |
2236 | 2326 |
2237 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 2327 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
2238 BrowsingDataRemover::REMOVE_DOWNLOADS, false); | 2328 BrowsingDataRemover::REMOVE_DOWNLOADS, false); |
2239 } | 2329 } |
2240 | 2330 |
2241 TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByOrigin) { | 2331 TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByOrigin) { |
2242 RemoveDownloadsTester tester(GetProfile()); | 2332 RemoveDownloadsTester tester(GetProfile()); |
2243 OriginFilterBuilder builder(OriginFilterBuilder::WHITELIST); | 2333 BrowsingDataRemoverFilter builder(BrowsingDataRemoverFilter::WHITELIST); |
2244 builder.AddOrigin(url::Origin(kOrigin1)); | 2334 builder.AddOrigin(url::Origin(kOrigin1)); |
2245 base::Callback<bool(const GURL&)> filter = builder.BuildSameOriginFilter(); | 2335 base::Callback<bool(const GURL&)> filter = |
| 2336 builder.BuildSameOriginOrDomainFilter(); |
2246 | 2337 |
2247 EXPECT_CALL( | 2338 EXPECT_CALL( |
2248 *tester.download_manager(), | 2339 *tester.download_manager(), |
2249 RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); | 2340 RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); |
2250 | 2341 |
2251 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, | 2342 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, |
2252 BrowsingDataRemover::REMOVE_DOWNLOADS, kOrigin1); | 2343 BrowsingDataRemover::REMOVE_DOWNLOADS, kOrigin1); |
2253 } | 2344 } |
2254 | 2345 |
2255 TEST_F(BrowsingDataRemoverTest, RemovePasswordStatistics) { | 2346 TEST_F(BrowsingDataRemoverTest, RemovePasswordStatistics) { |
2256 RemovePasswordsTester tester(GetProfile()); | 2347 RemovePasswordsTester tester(GetProfile()); |
2257 | 2348 |
2258 EXPECT_CALL(*tester.store(), RemoveStatisticsCreatedBetweenImpl( | 2349 EXPECT_CALL(*tester.store(), RemoveStatisticsCreatedBetweenImpl( |
2259 base::Time(), base::Time::Max())); | 2350 base::Time(), base::Time::Max())); |
2260 BlockUntilBrowsingDataRemoved( | 2351 BlockUntilBrowsingDataRemoved( |
2261 BrowsingDataRemover::EVERYTHING, | 2352 BrowsingDataRemover::EVERYTHING, |
2262 BrowsingDataRemover::REMOVE_HISTORY, false); | 2353 BrowsingDataRemover::REMOVE_HISTORY, false); |
2263 } | 2354 } |
2264 | 2355 |
2265 TEST_F(BrowsingDataRemoverTest, RemovePasswordsByTimeOnly) { | 2356 TEST_F(BrowsingDataRemoverTest, RemovePasswordsByTimeOnly) { |
2266 RemovePasswordsTester tester(GetProfile()); | 2357 RemovePasswordsTester tester(GetProfile()); |
2267 base::Callback<bool(const GURL&)> filter = | 2358 base::Callback<bool(const GURL&)> filter = |
2268 OriginFilterBuilder::BuildNoopFilter(); | 2359 BrowsingDataRemoverFilter::BuildNoopFilter(); |
2269 | 2360 |
2270 EXPECT_CALL(*tester.store(), | 2361 EXPECT_CALL(*tester.store(), |
2271 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) | 2362 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) |
2272 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2363 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2273 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 2364 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
2274 BrowsingDataRemover::REMOVE_PASSWORDS, false); | 2365 BrowsingDataRemover::REMOVE_PASSWORDS, false); |
2275 } | 2366 } |
2276 | 2367 |
2277 TEST_F(BrowsingDataRemoverTest, RemovePasswordsByOrigin) { | 2368 TEST_F(BrowsingDataRemoverTest, RemovePasswordsByOrigin) { |
2278 RemovePasswordsTester tester(GetProfile()); | 2369 RemovePasswordsTester tester(GetProfile()); |
2279 OriginFilterBuilder builder(OriginFilterBuilder::WHITELIST); | 2370 BrowsingDataRemoverFilter builder(BrowsingDataRemoverFilter::WHITELIST); |
2280 builder.AddOrigin(url::Origin(kOrigin1)); | 2371 builder.AddOrigin(url::Origin(kOrigin1)); |
2281 base::Callback<bool(const GURL&)> filter = builder.BuildSameOriginFilter(); | 2372 base::Callback<bool(const GURL&)> filter = |
| 2373 builder.BuildSameOriginOrDomainFilter(); |
2282 | 2374 |
2283 EXPECT_CALL(*tester.store(), | 2375 EXPECT_CALL(*tester.store(), |
2284 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) | 2376 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) |
2285 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2377 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2286 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, | 2378 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, |
2287 BrowsingDataRemover::REMOVE_PASSWORDS, kOrigin1); | 2379 BrowsingDataRemover::REMOVE_PASSWORDS, kOrigin1); |
2288 } | 2380 } |
2289 | 2381 |
2290 TEST_F(BrowsingDataRemoverTest, DisableAutoSignIn) { | 2382 TEST_F(BrowsingDataRemoverTest, DisableAutoSignIn) { |
2291 RemovePasswordsTester tester(GetProfile()); | 2383 RemovePasswordsTester tester(GetProfile()); |
(...skipping 11 matching lines...) Expand all Loading... |
2303 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) | 2395 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) |
2304 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2396 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2305 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) | 2397 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) |
2306 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2398 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2307 | 2399 |
2308 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 2400 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
2309 BrowsingDataRemover::REMOVE_COOKIES | | 2401 BrowsingDataRemover::REMOVE_COOKIES | |
2310 BrowsingDataRemover::REMOVE_PASSWORDS, | 2402 BrowsingDataRemover::REMOVE_PASSWORDS, |
2311 false); | 2403 false); |
2312 } | 2404 } |
| 2405 |
| 2406 TEST_F(BrowsingDataRemoverTest, RemoveContentSettingsWithBlacklist) { |
| 2407 // Add our settings. |
| 2408 HostContentSettingsMap* host_content_settings_map = |
| 2409 HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 2410 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2411 kOrigin1, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2412 new base::DictionaryValue()); |
| 2413 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2414 kOrigin2, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2415 new base::DictionaryValue()); |
| 2416 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2417 kOrigin3, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2418 new base::DictionaryValue()); |
| 2419 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2420 kOrigin4, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2421 new base::DictionaryValue()); |
| 2422 |
| 2423 // Clear all except for origin1 and origin3. |
| 2424 BrowsingDataRemoverFilter filter(BrowsingDataRemoverFilter::BLACKLIST); |
| 2425 filter.AddOrigin(url::Origin(kOrigin1)); |
| 2426 filter.AddOrigin(url::Origin(kOrigin3)); |
| 2427 BlockUntilOriginDataRemoved(BrowsingDataRemover::LAST_HOUR, |
| 2428 BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, |
| 2429 filter); |
| 2430 |
| 2431 EXPECT_EQ(BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, GetRemovalMask()); |
| 2432 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
| 2433 |
| 2434 // Verify we only have two, and they're origin1 and origin3. |
| 2435 ContentSettingsForOneType host_settings; |
| 2436 host_content_settings_map->GetSettingsForOneType( |
| 2437 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2438 EXPECT_EQ(2u, host_settings.size()); |
| 2439 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(kOrigin1), |
| 2440 host_settings[0].primary_pattern); |
| 2441 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(kOrigin3), |
| 2442 host_settings[1].primary_pattern); |
| 2443 } |
| 2444 |
| 2445 TEST_F(BrowsingDataRemoverTest, ClearWithPredicate) { |
| 2446 HostContentSettingsMap* host_content_settings_map = |
| 2447 HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 2448 ContentSettingsForOneType host_settings; |
| 2449 |
| 2450 // Patterns with wildcards. |
| 2451 ContentSettingsPattern pattern = |
| 2452 ContentSettingsPattern::FromString("[*.]example.org"); |
| 2453 ContentSettingsPattern pattern2 = |
| 2454 ContentSettingsPattern::FromString("[*.]example.net"); |
| 2455 |
| 2456 // Patterns without wildcards. |
| 2457 GURL url1("https://www.google.com/"); |
| 2458 GURL url2("https://www.google.com/maps"); |
| 2459 GURL url3("http://www.google.com/maps"); |
| 2460 GURL url3_origin_only("http://www.google.com/"); |
| 2461 |
| 2462 host_content_settings_map->SetContentSetting( |
| 2463 pattern2, ContentSettingsPattern::Wildcard(), |
| 2464 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
| 2465 host_content_settings_map->SetContentSetting( |
| 2466 pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
| 2467 std::string(), CONTENT_SETTING_BLOCK); |
| 2468 host_content_settings_map->SetWebsiteSettingCustomScope( |
| 2469 pattern2, ContentSettingsPattern::Wildcard(), |
| 2470 CONTENT_SETTINGS_TYPE_APP_BANNER, std::string(), |
| 2471 make_scoped_ptr(new base::DictionaryValue())); |
| 2472 |
| 2473 // First, test that we clear only IMAGES (not APP_BANNER), and pattern2. |
| 2474 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( |
| 2475 host_content_settings_map, CONTENT_SETTINGS_TYPE_IMAGES, |
| 2476 base::Bind(&MatchPrimaryPattern, pattern2)); |
| 2477 host_content_settings_map->GetSettingsForOneType( |
| 2478 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings); |
| 2479 // |host_settings| contains default & block. |
| 2480 EXPECT_EQ(2U, host_settings.size()); |
| 2481 EXPECT_EQ(pattern, host_settings[0].primary_pattern); |
| 2482 EXPECT_EQ("*", host_settings[0].secondary_pattern.ToString()); |
| 2483 EXPECT_EQ("*", host_settings[1].primary_pattern.ToString()); |
| 2484 EXPECT_EQ("*", host_settings[1].secondary_pattern.ToString()); |
| 2485 |
| 2486 host_content_settings_map->GetSettingsForOneType( |
| 2487 CONTENT_SETTINGS_TYPE_APP_BANNER, std::string(), &host_settings); |
| 2488 // |host_settings| contains block. |
| 2489 EXPECT_EQ(1U, host_settings.size()); |
| 2490 EXPECT_EQ(pattern2, host_settings[0].primary_pattern); |
| 2491 EXPECT_EQ("*", host_settings[0].secondary_pattern.ToString()); |
| 2492 |
| 2493 // Next, test that we do correct pattern matching w/ an origin policy item. |
| 2494 // We verify that we have no settings stored. |
| 2495 host_content_settings_map->GetSettingsForOneType( |
| 2496 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2497 EXPECT_EQ(0u, host_settings.size()); |
| 2498 // Add settings. |
| 2499 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2500 url1, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2501 new base::DictionaryValue()); |
| 2502 // This setting should override the one above, as it's the same origin. |
| 2503 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2504 url2, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2505 new base::DictionaryValue()); |
| 2506 host_content_settings_map->SetWebsiteSettingDefaultScope( |
| 2507 url3, GURL(), CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), |
| 2508 new base::DictionaryValue()); |
| 2509 // Verify we only have two. |
| 2510 host_content_settings_map->GetSettingsForOneType( |
| 2511 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2512 EXPECT_EQ(2u, host_settings.size()); |
| 2513 |
| 2514 // Clear the http one, which we should be able to do w/ the origin only, as |
| 2515 // the scope of CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT is |
| 2516 // REQUESTING_ORIGIN_ONLY_SCOPE. |
| 2517 ContentSettingsPattern http_pattern = |
| 2518 ContentSettingsPattern::FromURLNoWildcard(url3_origin_only); |
| 2519 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( |
| 2520 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, |
| 2521 base::Bind(&MatchPrimaryPattern, http_pattern)); |
| 2522 // Verify we only have one, and it's url1. |
| 2523 host_content_settings_map->GetSettingsForOneType( |
| 2524 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
| 2525 EXPECT_EQ(1u, host_settings.size()); |
| 2526 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), |
| 2527 host_settings[0].primary_pattern); |
| 2528 } |
OLD | NEW |