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/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return node->GetDetailedInfo().indexed_db_info->origin_.spec() + | 225 return node->GetDetailedInfo().indexed_db_info->origin_.spec() + |
226 ","; | 226 ","; |
227 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 227 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
228 return node->GetDetailedInfo().file_system_info->origin.spec() + | 228 return node->GetDetailedInfo().file_system_info->origin.spec() + |
229 ","; | 229 ","; |
230 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 230 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
231 return node->GetDetailedInfo().quota_info->host + ","; | 231 return node->GetDetailedInfo().quota_info->host + ","; |
232 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: | 232 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
233 return node->GetDetailedInfo().channel_id->server_identifier() + ","; | 233 return node->GetDetailedInfo().channel_id->server_identifier() + ","; |
234 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: | 234 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: |
235 return node->GetDetailedInfo( | 235 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; |
236 ).service_worker_info->origin.spec() + ","; | |
237 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: | 236 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: |
238 return node->GetDetailedInfo().flash_lso_domain + ","; | 237 return node->GetDetailedInfo().flash_lso_domain + ","; |
239 default: | 238 default: |
240 return std::string(); | 239 return std::string(); |
241 } | 240 } |
242 } | 241 } |
243 | 242 |
244 std::string GetCookiesOfChildren(const CookieTreeNode* node) { | 243 std::string GetCookiesOfChildren(const CookieTreeNode* node) { |
245 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); | 244 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); |
246 } | 245 } |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 GetDisplayedIndexedDBs(&cookies_model)); | 1115 GetDisplayedIndexedDBs(&cookies_model)); |
1117 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1116 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1118 GetDisplayedFileSystems(&cookies_model)); | 1117 GetDisplayedFileSystems(&cookies_model)); |
1119 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1118 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
1120 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1119 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1121 GetDisplayedServiceWorkers(&cookies_model)); | 1120 GetDisplayedServiceWorkers(&cookies_model)); |
1122 } | 1121 } |
1123 } | 1122 } |
1124 | 1123 |
1125 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 1124 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
1126 | |
1127 LocalDataContainer* container = | 1125 LocalDataContainer* container = |
1128 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1126 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1129 mock_browsing_data_database_helper_.get(), | 1127 mock_browsing_data_database_helper_.get(), |
1130 mock_browsing_data_local_storage_helper_.get(), | 1128 mock_browsing_data_local_storage_helper_.get(), |
1131 mock_browsing_data_session_storage_helper_.get(), | 1129 mock_browsing_data_session_storage_helper_.get(), |
1132 mock_browsing_data_appcache_helper_.get(), | 1130 mock_browsing_data_appcache_helper_.get(), |
1133 mock_browsing_data_indexed_db_helper_.get(), | 1131 mock_browsing_data_indexed_db_helper_.get(), |
1134 mock_browsing_data_file_system_helper_.get(), | 1132 mock_browsing_data_file_system_helper_.get(), |
1135 mock_browsing_data_quota_helper_.get(), | 1133 mock_browsing_data_quota_helper_.get(), |
1136 mock_browsing_data_channel_id_helper_.get(), | 1134 mock_browsing_data_channel_id_helper_.get(), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1339 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
1342 | 1340 |
1343 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); | 1341 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); |
1344 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1342 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
1345 | 1343 |
1346 cookies_model.UpdateSearchResults(base::string16()); | 1344 cookies_model.UpdateSearchResults(base::string16()); |
1347 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1345 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1348 } | 1346 } |
1349 | 1347 |
1350 } // namespace | 1348 } // namespace |
OLD | NEW |