Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/browsing_data/cookies_tree_model_unittest.cc

Issue 2359393002: Adds media license nodes to cookie tree model and cookies view. (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h" 12 #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h"
13 #include "chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h " 13 #include "chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h "
14 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h" 14 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h"
15 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" 15 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h"
16 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" 16 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h"
17 #include "chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h" 17 #include "chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h"
18 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" 18 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h"
19 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h" 19 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h"
20 #include "chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h " 20 #include "chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h "
21 #include "chrome/browser/browsing_data/mock_browsing_data_media_license_helper.h "
21 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" 22 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h"
22 #include "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper. h" 23 #include "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper. h"
23 #include "chrome/browser/content_settings/cookie_settings_factory.h" 24 #include "chrome/browser/content_settings/cookie_settings_factory.h"
24 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
25 #include "chrome/browser/content_settings/mock_settings_observer.h" 26 #include "chrome/browser/content_settings/mock_settings_observer.h"
26 #include "chrome/test/base/testing_profile.h" 27 #include "chrome/test/base/testing_profile.h"
27 #include "components/content_settings/core/browser/cookie_settings.h" 28 #include "components/content_settings/core/browser/cookie_settings.h"
28 #include "components/content_settings/core/browser/host_content_settings_map.h" 29 #include "components/content_settings/core/browser/host_content_settings_map.h"
29 #include "components/prefs/pref_service.h" 30 #include "components/prefs/pref_service.h"
30 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 mock_browsing_data_quota_helper_ = 75 mock_browsing_data_quota_helper_ =
75 new MockBrowsingDataQuotaHelper(profile_.get()); 76 new MockBrowsingDataQuotaHelper(profile_.get());
76 mock_browsing_data_channel_id_helper_ = 77 mock_browsing_data_channel_id_helper_ =
77 new MockBrowsingDataChannelIDHelper(); 78 new MockBrowsingDataChannelIDHelper();
78 mock_browsing_data_service_worker_helper_ = 79 mock_browsing_data_service_worker_helper_ =
79 new MockBrowsingDataServiceWorkerHelper(profile_.get()); 80 new MockBrowsingDataServiceWorkerHelper(profile_.get());
80 mock_browsing_data_cache_storage_helper_ = 81 mock_browsing_data_cache_storage_helper_ =
81 new MockBrowsingDataCacheStorageHelper(profile_.get()); 82 new MockBrowsingDataCacheStorageHelper(profile_.get());
82 mock_browsing_data_flash_lso_helper_ = 83 mock_browsing_data_flash_lso_helper_ =
83 new MockBrowsingDataFlashLSOHelper(profile_.get()); 84 new MockBrowsingDataFlashLSOHelper(profile_.get());
85 mock_browsing_data_media_license_helper_ =
86 new MockBrowsingDataMediaLicenseHelper(profile_.get());
84 87
85 #if defined(ENABLE_EXTENSIONS) 88 #if defined(ENABLE_EXTENSIONS)
86 special_storage_policy_ = 89 special_storage_policy_ =
87 new ExtensionSpecialStoragePolicy(profile_.get()); 90 new ExtensionSpecialStoragePolicy(profile_.get());
88 #endif 91 #endif
89 } 92 }
90 93
91 void TearDown() override { 94 void TearDown() override {
92 mock_browsing_data_service_worker_helper_ = nullptr; 95 mock_browsing_data_service_worker_helper_ = nullptr;
93 mock_browsing_data_cache_storage_helper_ = nullptr; 96 mock_browsing_data_cache_storage_helper_ = nullptr;
94 mock_browsing_data_channel_id_helper_ = nullptr; 97 mock_browsing_data_channel_id_helper_ = nullptr;
95 mock_browsing_data_quota_helper_ = nullptr; 98 mock_browsing_data_quota_helper_ = nullptr;
96 mock_browsing_data_file_system_helper_ = nullptr; 99 mock_browsing_data_file_system_helper_ = nullptr;
97 mock_browsing_data_indexed_db_helper_ = nullptr; 100 mock_browsing_data_indexed_db_helper_ = nullptr;
98 mock_browsing_data_appcache_helper_ = nullptr; 101 mock_browsing_data_appcache_helper_ = nullptr;
99 mock_browsing_data_session_storage_helper_ = nullptr; 102 mock_browsing_data_session_storage_helper_ = nullptr;
100 mock_browsing_data_local_storage_helper_ = nullptr; 103 mock_browsing_data_local_storage_helper_ = nullptr;
101 mock_browsing_data_database_helper_ = nullptr; 104 mock_browsing_data_database_helper_ = nullptr;
102 mock_browsing_data_flash_lso_helper_ = nullptr; 105 mock_browsing_data_flash_lso_helper_ = nullptr;
106 mock_browsing_data_media_license_helper_ = nullptr;
103 base::RunLoop().RunUntilIdle(); 107 base::RunLoop().RunUntilIdle();
104 } 108 }
105 std::unique_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { 109 std::unique_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() {
106 LocalDataContainer* container = 110 LocalDataContainer* container =
107 new LocalDataContainer(mock_browsing_data_cookie_helper_, 111 new LocalDataContainer(mock_browsing_data_cookie_helper_,
108 mock_browsing_data_database_helper_, 112 mock_browsing_data_database_helper_,
109 mock_browsing_data_local_storage_helper_, 113 mock_browsing_data_local_storage_helper_,
110 mock_browsing_data_session_storage_helper_, 114 mock_browsing_data_session_storage_helper_,
111 mock_browsing_data_appcache_helper_, 115 mock_browsing_data_appcache_helper_,
112 mock_browsing_data_indexed_db_helper_, 116 mock_browsing_data_indexed_db_helper_,
113 mock_browsing_data_file_system_helper_, 117 mock_browsing_data_file_system_helper_,
114 mock_browsing_data_quota_helper_, 118 mock_browsing_data_quota_helper_,
115 mock_browsing_data_channel_id_helper_, 119 mock_browsing_data_channel_id_helper_,
116 mock_browsing_data_service_worker_helper_, 120 mock_browsing_data_service_worker_helper_,
117 mock_browsing_data_cache_storage_helper_, 121 mock_browsing_data_cache_storage_helper_,
118 mock_browsing_data_flash_lso_helper_); 122 mock_browsing_data_flash_lso_helper_,
123 mock_browsing_data_media_license_helper_);
119 124
120 CookiesTreeModel* cookies_model = 125 CookiesTreeModel* cookies_model =
121 new CookiesTreeModel(container, special_storage_policy()); 126 new CookiesTreeModel(container, special_storage_policy());
122 mock_browsing_data_cookie_helper_-> 127 mock_browsing_data_cookie_helper_->
123 AddCookieSamples(GURL("http://foo1"), "A=1"); 128 AddCookieSamples(GURL("http://foo1"), "A=1");
124 mock_browsing_data_cookie_helper_-> 129 mock_browsing_data_cookie_helper_->
125 AddCookieSamples(GURL("http://foo2"), "B=1"); 130 AddCookieSamples(GURL("http://foo2"), "B=1");
126 mock_browsing_data_cookie_helper_-> 131 mock_browsing_data_cookie_helper_->
127 AddCookieSamples(GURL("http://foo3"), "C=1"); 132 AddCookieSamples(GURL("http://foo3"), "C=1");
128 mock_browsing_data_cookie_helper_->Notify(); 133 mock_browsing_data_cookie_helper_->Notify();
(...skipping 13 matching lines...) Expand all
142 "sbc1"); 147 "sbc1");
143 mock_browsing_data_channel_id_helper_->AddChannelIDSample( 148 mock_browsing_data_channel_id_helper_->AddChannelIDSample(
144 "sbc2"); 149 "sbc2");
145 mock_browsing_data_channel_id_helper_->Notify(); 150 mock_browsing_data_channel_id_helper_->Notify();
146 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); 151 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples();
147 mock_browsing_data_service_worker_helper_->Notify(); 152 mock_browsing_data_service_worker_helper_->Notify();
148 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); 153 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples();
149 mock_browsing_data_cache_storage_helper_->Notify(); 154 mock_browsing_data_cache_storage_helper_->Notify();
150 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); 155 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com");
151 mock_browsing_data_flash_lso_helper_->Notify(); 156 mock_browsing_data_flash_lso_helper_->Notify();
157 mock_browsing_data_media_license_helper_->AddMediaLicenseSamples();
158 mock_browsing_data_media_license_helper_->Notify();
152 159
153 { 160 {
154 SCOPED_TRACE( 161 SCOPED_TRACE(
155 "Initial State 3 cookies, 2 databases, 2 local storages, " 162 "Initial State 3 cookies, 2 databases, 2 local storages, "
156 "2 session storages, 2 indexed DBs, 3 filesystems, " 163 "2 session storages, 2 indexed DBs, 3 filesystems, "
157 "2 quotas, 2 server bound certs, 2 service workers, " 164 "2 quotas, 2 server bound certs, 2 service workers, "
158 "2 cache storages, 1 Flash LSO"); 165 "2 cache storages, 1 Flash LSO, 2 media licenses");
159 // 65 because there's the root, then 166 // 71 because there's the root, then
160 // cshost1 -> cache storage -> https://cshost1:1/ 167 // cshost1 -> cache storage -> https://cshost1:1/
161 // cshost2 -> cache storage -> https://cshost2:2/ 168 // cshost2 -> cache storage -> https://cshost2:2/
162 // foo1 -> cookies -> a, 169 // foo1 -> cookies -> a,
163 // foo2 -> cookies -> b, 170 // foo2 -> cookies -> b,
164 // foo3 -> cookies -> c, 171 // foo3 -> cookies -> c,
165 // dbhost1 -> database -> db1, 172 // gdbhost1 -> database -> db1,
166 // dbhost2 -> database -> db2, 173 // gdbhost2 -> database -> db2,
167 // host1 -> localstorage -> http://host1:1/, 174 // host1 -> localstorage -> http://host1:1/,
168 // -> sessionstorage -> http://host1:1/, 175 // -> sessionstorage -> http://host1:1/,
169 // host2 -> localstorage -> http://host2:2/. 176 // host2 -> localstorage -> http://host2:2/.
170 // -> sessionstorage -> http://host2:2/, 177 // -> sessionstorage -> http://host2:2/,
171 // idbhost1 -> indexeddb -> http://idbhost1:1/, 178 // idbhost1 -> indexeddb -> http://idbhost1:1/,
172 // idbhost2 -> indexeddb -> http://idbhost2:2/, 179 // idbhost2 -> indexeddb -> http://idbhost2:2/,
173 // fshost1 -> filesystem -> http://fshost1:1/, 180 // fshost1 -> filesystem -> http://fshost1:1/,
174 // fshost2 -> filesystem -> http://fshost2:1/, 181 // fshost2 -> filesystem -> http://fshost2:1/,
175 // fshost3 -> filesystem -> http://fshost3:1/, 182 // fshost3 -> filesystem -> http://fshost3:1/,
183 // media1 -> media_licenses -> media_license,
184 // media2 -> media_licenses -> media_license,
176 // quotahost1 -> quotahost1, 185 // quotahost1 -> quotahost1,
177 // quotahost2 -> quotahost2, 186 // quotahost2 -> quotahost2,
178 // sbc1 -> sbcerts -> sbc1, 187 // sbc1 -> sbcerts -> sbc1,
179 // sbc2 -> sbcerts -> sbc2. 188 // sbc2 -> sbcerts -> sbc2.
180 // swhost1 -> service worker -> https://swhost1:1 189 // swhost1 -> service worker -> https://swhost1:1
181 // swhost2 -> service worker -> https://swhost1:2 190 // swhost2 -> service worker -> https://swhost1:2
182 // xyz.com -> flash_lsos 191 // xyz.com -> flash_lsos
183 EXPECT_EQ(65, cookies_model->GetRoot()->GetTotalNodeCount()); 192 EXPECT_EQ(71, cookies_model->GetRoot()->GetTotalNodeCount());
184 EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); 193 EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model));
185 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); 194 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model));
186 EXPECT_EQ("http://host1:1/,http://host2:2/", 195 EXPECT_EQ("http://host1:1/,http://host2:2/",
187 GetDisplayedLocalStorages(cookies_model)); 196 GetDisplayedLocalStorages(cookies_model));
188 EXPECT_EQ("http://host1:1/,http://host2:2/", 197 EXPECT_EQ("http://host1:1/,http://host2:2/",
189 GetDisplayedSessionStorages(cookies_model)); 198 GetDisplayedSessionStorages(cookies_model));
190 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 199 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
191 GetDisplayedIndexedDBs(cookies_model)); 200 GetDisplayedIndexedDBs(cookies_model));
192 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 201 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
193 GetDisplayedFileSystems(cookies_model)); 202 GetDisplayedFileSystems(cookies_model));
194 EXPECT_EQ("quotahost1,quotahost2", 203 EXPECT_EQ("quotahost1,quotahost2",
195 GetDisplayedQuotas(cookies_model)); 204 GetDisplayedQuotas(cookies_model));
196 EXPECT_EQ("sbc1,sbc2", 205 EXPECT_EQ("sbc1,sbc2",
197 GetDisplayedChannelIDs(cookies_model)); 206 GetDisplayedChannelIDs(cookies_model));
198 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 207 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
199 GetDisplayedServiceWorkers(cookies_model)); 208 GetDisplayedServiceWorkers(cookies_model));
200 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 209 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
201 GetDisplayedCacheStorages(cookies_model)); 210 GetDisplayedCacheStorages(cookies_model));
202 EXPECT_EQ("xyz.com", 211 EXPECT_EQ("xyz.com",
203 GetDisplayedFlashLSOs(cookies_model)); 212 GetDisplayedFlashLSOs(cookies_model));
213 EXPECT_EQ("https://media1/,https://media2/",
214 GetDisplayedMediaLicenses(cookies_model));
204 } 215 }
205 return base::WrapUnique(cookies_model); 216 return base::WrapUnique(cookies_model);
206 } 217 }
207 218
208 // Checks that, when setting content settings for host nodes in the 219 // Checks that, when setting content settings for host nodes in the
209 // cookie tree, the content settings are applied to the expected URL. 220 // cookie tree, the content settings are applied to the expected URL.
210 void CheckContentSettingsUrlForHostNodes( 221 void CheckContentSettingsUrlForHostNodes(
211 const CookieTreeNode* node, 222 const CookieTreeNode* node,
212 CookieTreeNode::DetailedInfo::NodeType node_type, 223 CookieTreeNode::DetailedInfo::NodeType node_type,
213 content_settings::CookieSettings* cookie_settings, 224 content_settings::CookieSettings* cookie_settings,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: 287 case CookieTreeNode::DetailedInfo::TYPE_QUOTA:
277 return node->GetDetailedInfo().quota_info->host + ","; 288 return node->GetDetailedInfo().quota_info->host + ",";
278 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: 289 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID:
279 return node->GetDetailedInfo().channel_id->server_identifier() + ","; 290 return node->GetDetailedInfo().channel_id->server_identifier() + ",";
280 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: 291 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER:
281 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; 292 return node->GetDetailedInfo().service_worker_info->origin.spec() + ",";
282 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: 293 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE:
283 return node->GetDetailedInfo().cache_storage_info->origin.spec() + ","; 294 return node->GetDetailedInfo().cache_storage_info->origin.spec() + ",";
284 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: 295 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO:
285 return node->GetDetailedInfo().flash_lso_domain + ","; 296 return node->GetDetailedInfo().flash_lso_domain + ",";
297 case CookieTreeNode::DetailedInfo::TYPE_MEDIA_LICENSE:
298 return node->GetDetailedInfo().media_license_info->origin.spec() + ",";
286 default: 299 default:
287 return std::string(); 300 return std::string();
288 } 301 }
289 } 302 }
290 303
291 std::string GetCookiesOfChildren(const CookieTreeNode* node) { 304 std::string GetCookiesOfChildren(const CookieTreeNode* node) {
292 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); 305 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE);
293 } 306 }
294 307
295 std::string GetDatabasesOfChildren(const CookieTreeNode* node) { 308 std::string GetDatabasesOfChildren(const CookieTreeNode* node) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 std::string GetCacheStoragesOfChildren(const CookieTreeNode* node) { 343 std::string GetCacheStoragesOfChildren(const CookieTreeNode* node) {
331 return GetNodesOfChildren(node, 344 return GetNodesOfChildren(node,
332 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); 345 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE);
333 } 346 }
334 347
335 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) { 348 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) {
336 return GetNodesOfChildren( 349 return GetNodesOfChildren(
337 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); 350 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO);
338 } 351 }
339 352
353 std::string GetMediaLicensesOfChildren(const CookieTreeNode* node) {
354 return GetNodesOfChildren(node,
355 CookieTreeNode::DetailedInfo::TYPE_MEDIA_LICENSE);
356 }
357
340 // Get the nodes names displayed in the view (if we had one) in the order 358 // Get the nodes names displayed in the view (if we had one) in the order
341 // they are displayed, as a comma seperated string. 359 // they are displayed, as a comma seperated string.
342 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); 360 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str());
343 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model, 361 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model,
344 CookieTreeNode::DetailedInfo::NodeType type) { 362 CookieTreeNode::DetailedInfo::NodeType type) {
345 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>( 363 CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(
346 cookies_model->GetRoot()); 364 cookies_model->GetRoot());
347 std::string retval = GetNodesOfChildren(root, type); 365 std::string retval = GetNodesOfChildren(root, type);
348 if (!retval.empty() && retval.back() == ',') 366 if (!retval.empty() && retval.back() == ',')
349 retval.erase(retval.length() - 1); 367 retval.erase(retval.length() - 1);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 std::string GetDisplayedCacheStorages(CookiesTreeModel* cookies_model) { 421 std::string GetDisplayedCacheStorages(CookiesTreeModel* cookies_model) {
404 return GetDisplayedNodes(cookies_model, 422 return GetDisplayedNodes(cookies_model,
405 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); 423 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE);
406 } 424 }
407 425
408 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { 426 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) {
409 return GetDisplayedNodes( 427 return GetDisplayedNodes(
410 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); 428 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO);
411 } 429 }
412 430
431 std::string GetDisplayedMediaLicenses(CookiesTreeModel* cookies_model) {
432 return GetDisplayedNodes(cookies_model,
433 CookieTreeNode::DetailedInfo::TYPE_MEDIA_LICENSE);
434 }
435
413 // Do not call on the root. 436 // Do not call on the root.
414 void DeleteStoredObjects(CookieTreeNode* node) { 437 void DeleteStoredObjects(CookieTreeNode* node) {
415 node->DeleteStoredObjects(); 438 node->DeleteStoredObjects();
416 CookieTreeNode* parent_node = node->parent(); 439 CookieTreeNode* parent_node = node->parent();
417 DCHECK(parent_node); 440 DCHECK(parent_node);
418 parent_node->GetModel()->Remove(parent_node, node); 441 parent_node->GetModel()->Remove(parent_node, node);
419 } 442 }
420 443
421 protected: 444 protected:
422 ExtensionSpecialStoragePolicy* special_storage_policy() { 445 ExtensionSpecialStoragePolicy* special_storage_policy() {
(...skipping 23 matching lines...) Expand all
446 scoped_refptr<MockBrowsingDataQuotaHelper> 469 scoped_refptr<MockBrowsingDataQuotaHelper>
447 mock_browsing_data_quota_helper_; 470 mock_browsing_data_quota_helper_;
448 scoped_refptr<MockBrowsingDataChannelIDHelper> 471 scoped_refptr<MockBrowsingDataChannelIDHelper>
449 mock_browsing_data_channel_id_helper_; 472 mock_browsing_data_channel_id_helper_;
450 scoped_refptr<MockBrowsingDataServiceWorkerHelper> 473 scoped_refptr<MockBrowsingDataServiceWorkerHelper>
451 mock_browsing_data_service_worker_helper_; 474 mock_browsing_data_service_worker_helper_;
452 scoped_refptr<MockBrowsingDataCacheStorageHelper> 475 scoped_refptr<MockBrowsingDataCacheStorageHelper>
453 mock_browsing_data_cache_storage_helper_; 476 mock_browsing_data_cache_storage_helper_;
454 scoped_refptr<MockBrowsingDataFlashLSOHelper> 477 scoped_refptr<MockBrowsingDataFlashLSOHelper>
455 mock_browsing_data_flash_lso_helper_; 478 mock_browsing_data_flash_lso_helper_;
479 scoped_refptr<MockBrowsingDataMediaLicenseHelper>
480 mock_browsing_data_media_license_helper_;
456 481
457 #if defined(ENABLE_EXTENSIONS) 482 #if defined(ENABLE_EXTENSIONS)
458 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; 483 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
459 #endif 484 #endif
460 }; 485 };
461 486
462 TEST_F(CookiesTreeModelTest, RemoveAll) { 487 TEST_F(CookiesTreeModelTest, RemoveAll) {
463 std::unique_ptr<CookiesTreeModel> cookies_model( 488 std::unique_ptr<CookiesTreeModel> cookies_model(
464 CreateCookiesTreeModelWithInitialSample()); 489 CreateCookiesTreeModelWithInitialSample());
465 490
(...skipping 15 matching lines...) Expand all
481 EXPECT_EQ("quotahost1,quotahost2", 506 EXPECT_EQ("quotahost1,quotahost2",
482 GetDisplayedQuotas(cookies_model.get())); 507 GetDisplayedQuotas(cookies_model.get()));
483 EXPECT_EQ("sbc1,sbc2", 508 EXPECT_EQ("sbc1,sbc2",
484 GetDisplayedChannelIDs(cookies_model.get())); 509 GetDisplayedChannelIDs(cookies_model.get()));
485 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 510 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
486 GetDisplayedCacheStorages(cookies_model.get())); 511 GetDisplayedCacheStorages(cookies_model.get()));
487 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 512 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
488 GetDisplayedServiceWorkers(cookies_model.get())); 513 GetDisplayedServiceWorkers(cookies_model.get()));
489 EXPECT_EQ("xyz.com", 514 EXPECT_EQ("xyz.com",
490 GetDisplayedFlashLSOs(cookies_model.get())); 515 GetDisplayedFlashLSOs(cookies_model.get()));
516 EXPECT_EQ("https://media1/,https://media2/",
517 GetDisplayedMediaLicenses(cookies_model.get()));
491 } 518 }
492 519
493 mock_browsing_data_cookie_helper_->Reset(); 520 mock_browsing_data_cookie_helper_->Reset();
494 mock_browsing_data_database_helper_->Reset(); 521 mock_browsing_data_database_helper_->Reset();
495 mock_browsing_data_local_storage_helper_->Reset(); 522 mock_browsing_data_local_storage_helper_->Reset();
496 mock_browsing_data_session_storage_helper_->Reset(); 523 mock_browsing_data_session_storage_helper_->Reset();
497 mock_browsing_data_indexed_db_helper_->Reset(); 524 mock_browsing_data_indexed_db_helper_->Reset();
498 mock_browsing_data_service_worker_helper_->Reset(); 525 mock_browsing_data_service_worker_helper_->Reset();
499 mock_browsing_data_cache_storage_helper_->Reset(); 526 mock_browsing_data_cache_storage_helper_->Reset();
500 mock_browsing_data_file_system_helper_->Reset(); 527 mock_browsing_data_file_system_helper_->Reset();
(...skipping 13 matching lines...) Expand all
514 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); 541 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted());
515 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); 542 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted());
516 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); 543 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted());
517 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); 544 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted());
518 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); 545 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted());
519 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); 546 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted());
520 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); 547 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted());
521 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted()); 548 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted());
522 EXPECT_TRUE(mock_browsing_data_cache_storage_helper_->AllDeleted()); 549 EXPECT_TRUE(mock_browsing_data_cache_storage_helper_->AllDeleted());
523 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); 550 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted());
551 EXPECT_TRUE(mock_browsing_data_media_license_helper_->AllDeleted());
524 } 552 }
525 } 553 }
526 554
527 TEST_F(CookiesTreeModelTest, Remove) { 555 TEST_F(CookiesTreeModelTest, Remove) {
528 std::unique_ptr<CookiesTreeModel> cookies_model( 556 std::unique_ptr<CookiesTreeModel> cookies_model(
529 CreateCookiesTreeModelWithInitialSample()); 557 CreateCookiesTreeModelWithInitialSample());
530 558
531 // Children start out arranged as follows: 559 // Children start out arranged as follows:
532 // 560 //
533 // 0. `cshost1` 561 // 0. `cshost1`
534 // 1. `cshost2` 562 // 1. `cshost2`
535 // 2. `foo1` 563 // 2. `foo1`
536 // 3. `foo2` 564 // 3. `foo2`
537 // 4. `foo3` 565 // 4. `foo3`
538 // 5. `fshost1` 566 // 5. `fshost1`
539 // 6. `fshost2` 567 // 6. `fshost2`
540 // 7. `fshost3` 568 // 7. `fshost3`
541 // 8. `gdbhost1` 569 // 8. `gdbhost1`
542 // 9. `gdbhost2` 570 // 9. `gdbhost2`
543 // 10. `host1` 571 // 10. `host1`
544 // 11. `host2` 572 // 11. `host2`
545 // 12. `idbhost1` 573 // 12. `idbhost1`
546 // 13. `idbhost2` 574 // 13. `idbhost2`
547 // 14. `quotahost1` 575 // 14. `media1`
548 // 15. `quotahost2` 576 // 15. `media2`
549 // 16. `sbc1` 577 // 16. `quotahost1`
550 // 17. `sbc2` 578 // 17. `quotahost2`
551 // 18. `swhost1` 579 // 18. `sbc1`
552 // 19. `swhost2` 580 // 19. `sbc2`
553 // 20. `xyz.com` 581 // 20. `swhost1`
582 // 21. `swhost2`
583 // 22. `xyz.com`
554 // 584 //
555 // Here, we'll remove them one by one, starting from the end, and 585 // Here, we'll remove them one by one, starting from the end, and
556 // check that the state makes sense. 586 // check that the state makes sense. Initially there are 71 total nodes.
557 587
558 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(20)); 588 // xyz.com -> flash_lsos (2 nodes)
589 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(22));
559 { 590 {
560 SCOPED_TRACE("`xyz.com` removed."); 591 SCOPED_TRACE("`xyz.com` removed.");
561 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 592 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
562 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 593 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
563 EXPECT_EQ("http://host1:1/,http://host2:2/", 594 EXPECT_EQ("http://host1:1/,http://host2:2/",
564 GetDisplayedLocalStorages(cookies_model.get())); 595 GetDisplayedLocalStorages(cookies_model.get()));
565 EXPECT_EQ("http://host1:1/,http://host2:2/", 596 EXPECT_EQ("http://host1:1/,http://host2:2/",
566 GetDisplayedSessionStorages(cookies_model.get())); 597 GetDisplayedSessionStorages(cookies_model.get()));
567 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 598 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
568 GetDisplayedFileSystems(cookies_model.get())); 599 GetDisplayedFileSystems(cookies_model.get()));
569 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 600 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
570 GetDisplayedIndexedDBs(cookies_model.get())); 601 GetDisplayedIndexedDBs(cookies_model.get()));
571 EXPECT_EQ("quotahost1,quotahost2", 602 EXPECT_EQ("quotahost1,quotahost2",
572 GetDisplayedQuotas(cookies_model.get())); 603 GetDisplayedQuotas(cookies_model.get()));
573 EXPECT_EQ("sbc1,sbc2", 604 EXPECT_EQ("sbc1,sbc2",
574 GetDisplayedChannelIDs(cookies_model.get())); 605 GetDisplayedChannelIDs(cookies_model.get()));
575 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 606 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
576 GetDisplayedServiceWorkers(cookies_model.get())); 607 GetDisplayedServiceWorkers(cookies_model.get()));
577 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 608 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
578 GetDisplayedCacheStorages(cookies_model.get())); 609 GetDisplayedCacheStorages(cookies_model.get()));
579 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 610 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
580 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); 611 EXPECT_EQ("https://media1/,https://media2/",
612 GetDisplayedMediaLicenses(cookies_model.get()));
613 EXPECT_EQ(69, cookies_model->GetRoot()->GetTotalNodeCount());
581 } 614 }
582 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(19)); 615
616 // swhost2 -> service worker -> https://swhost1:2 (3 objects)
617 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(21));
583 { 618 {
584 SCOPED_TRACE("`swhost2` removed."); 619 SCOPED_TRACE("`swhost2` removed.");
585 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 620 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
586 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 621 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
587 EXPECT_EQ("http://host1:1/,http://host2:2/", 622 EXPECT_EQ("http://host1:1/,http://host2:2/",
588 GetDisplayedLocalStorages(cookies_model.get())); 623 GetDisplayedLocalStorages(cookies_model.get()));
589 EXPECT_EQ("http://host1:1/,http://host2:2/", 624 EXPECT_EQ("http://host1:1/,http://host2:2/",
590 GetDisplayedSessionStorages(cookies_model.get())); 625 GetDisplayedSessionStorages(cookies_model.get()));
591 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 626 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
592 GetDisplayedFileSystems(cookies_model.get())); 627 GetDisplayedFileSystems(cookies_model.get()));
593 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 628 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
594 GetDisplayedIndexedDBs(cookies_model.get())); 629 GetDisplayedIndexedDBs(cookies_model.get()));
595 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 630 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
596 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 631 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
597 EXPECT_EQ("https://swhost1:1/", 632 EXPECT_EQ("https://swhost1:1/",
598 GetDisplayedServiceWorkers(cookies_model.get())); 633 GetDisplayedServiceWorkers(cookies_model.get()));
599 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 634 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
600 GetDisplayedCacheStorages(cookies_model.get())); 635 GetDisplayedCacheStorages(cookies_model.get()));
601 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 636 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
602 EXPECT_EQ(60, cookies_model->GetRoot()->GetTotalNodeCount()); 637 EXPECT_EQ("https://media1/,https://media2/",
638 GetDisplayedMediaLicenses(cookies_model.get()));
639 EXPECT_EQ(66, cookies_model->GetRoot()->GetTotalNodeCount());
603 } 640 }
604 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18)); 641
642 // swhost1 -> service worker -> https://swhost1:1 (3 nodes)
643 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(20));
605 { 644 {
606 SCOPED_TRACE("`swhost1` removed."); 645 SCOPED_TRACE("`swhost1` removed.");
607 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 646 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
608 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 647 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
609 EXPECT_EQ("http://host1:1/,http://host2:2/", 648 EXPECT_EQ("http://host1:1/,http://host2:2/",
610 GetDisplayedLocalStorages(cookies_model.get())); 649 GetDisplayedLocalStorages(cookies_model.get()));
611 EXPECT_EQ("http://host1:1/,http://host2:2/", 650 EXPECT_EQ("http://host1:1/,http://host2:2/",
612 GetDisplayedSessionStorages(cookies_model.get())); 651 GetDisplayedSessionStorages(cookies_model.get()));
613 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 652 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
614 GetDisplayedFileSystems(cookies_model.get())); 653 GetDisplayedFileSystems(cookies_model.get()));
615 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 654 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
616 GetDisplayedIndexedDBs(cookies_model.get())); 655 GetDisplayedIndexedDBs(cookies_model.get()));
617 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 656 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
618 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 657 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
619 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 658 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
620 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 659 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
621 GetDisplayedCacheStorages(cookies_model.get())); 660 GetDisplayedCacheStorages(cookies_model.get()));
622 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 661 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
623 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); 662 EXPECT_EQ("https://media1/,https://media2/",
663 GetDisplayedMediaLicenses(cookies_model.get()));
664 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount());
624 } 665 }
625 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17)); 666
667 // sbc2 -> sbcerts -> sbc2 (3 objects)
668 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(19));
626 { 669 {
627 SCOPED_TRACE("`sbc2` removed."); 670 SCOPED_TRACE("`sbc2` removed.");
628 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 671 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
629 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 672 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
630 EXPECT_EQ("http://host1:1/,http://host2:2/", 673 EXPECT_EQ("http://host1:1/,http://host2:2/",
631 GetDisplayedLocalStorages(cookies_model.get())); 674 GetDisplayedLocalStorages(cookies_model.get()));
632 EXPECT_EQ("http://host1:1/,http://host2:2/", 675 EXPECT_EQ("http://host1:1/,http://host2:2/",
633 GetDisplayedSessionStorages(cookies_model.get())); 676 GetDisplayedSessionStorages(cookies_model.get()));
634 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 677 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
635 GetDisplayedFileSystems(cookies_model.get())); 678 GetDisplayedFileSystems(cookies_model.get()));
636 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 679 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
637 GetDisplayedIndexedDBs(cookies_model.get())); 680 GetDisplayedIndexedDBs(cookies_model.get()));
638 EXPECT_EQ("quotahost1,quotahost2", 681 EXPECT_EQ("quotahost1,quotahost2",
639 GetDisplayedQuotas(cookies_model.get())); 682 GetDisplayedQuotas(cookies_model.get()));
640 EXPECT_EQ("sbc1", 683 EXPECT_EQ("sbc1",
641 GetDisplayedChannelIDs(cookies_model.get())); 684 GetDisplayedChannelIDs(cookies_model.get()));
642 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 685 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
643 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 686 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
644 GetDisplayedCacheStorages(cookies_model.get())); 687 GetDisplayedCacheStorages(cookies_model.get()));
645 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 688 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
646 EXPECT_EQ(54, cookies_model->GetRoot()->GetTotalNodeCount()); 689 EXPECT_EQ("https://media1/,https://media2/",
690 GetDisplayedMediaLicenses(cookies_model.get()));
691 EXPECT_EQ(60, cookies_model->GetRoot()->GetTotalNodeCount());
647 } 692 }
648 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16)); 693
694 // sbc1 -> sbcerts -> sbc1 (3 objects)
695 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18));
649 { 696 {
650 SCOPED_TRACE("`sbc1` removed."); 697 SCOPED_TRACE("`sbc1` removed.");
651 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 698 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
652 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 699 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
653 EXPECT_EQ("http://host1:1/,http://host2:2/", 700 EXPECT_EQ("http://host1:1/,http://host2:2/",
654 GetDisplayedLocalStorages(cookies_model.get())); 701 GetDisplayedLocalStorages(cookies_model.get()));
655 EXPECT_EQ("http://host1:1/,http://host2:2/", 702 EXPECT_EQ("http://host1:1/,http://host2:2/",
656 GetDisplayedSessionStorages(cookies_model.get())); 703 GetDisplayedSessionStorages(cookies_model.get()));
657 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 704 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
658 GetDisplayedFileSystems(cookies_model.get())); 705 GetDisplayedFileSystems(cookies_model.get()));
659 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 706 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
660 GetDisplayedIndexedDBs(cookies_model.get())); 707 GetDisplayedIndexedDBs(cookies_model.get()));
661 EXPECT_EQ("quotahost1,quotahost2", 708 EXPECT_EQ("quotahost1,quotahost2",
662 GetDisplayedQuotas(cookies_model.get())); 709 GetDisplayedQuotas(cookies_model.get()));
663 EXPECT_EQ("", GetDisplayedChannelIDs(cookies_model.get())); 710 EXPECT_EQ("", GetDisplayedChannelIDs(cookies_model.get()));
664 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 711 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
665 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 712 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
666 GetDisplayedCacheStorages(cookies_model.get())); 713 GetDisplayedCacheStorages(cookies_model.get()));
667 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 714 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
668 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); 715 EXPECT_EQ("https://media1/,https://media2/",
716 GetDisplayedMediaLicenses(cookies_model.get()));
717 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount());
669 } 718 }
670 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); 719
720 // quotahost2 -> quotahost2 (2 objects)
721 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17));
671 { 722 {
672 SCOPED_TRACE("`quotahost2` removed."); 723 SCOPED_TRACE("`quotahost2` removed.");
673 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 724 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
674 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 725 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
675 EXPECT_EQ("http://host1:1/,http://host2:2/", 726 EXPECT_EQ("http://host1:1/,http://host2:2/",
676 GetDisplayedLocalStorages(cookies_model.get())); 727 GetDisplayedLocalStorages(cookies_model.get()));
677 EXPECT_EQ("http://host1:1/,http://host2:2/", 728 EXPECT_EQ("http://host1:1/,http://host2:2/",
678 GetDisplayedSessionStorages(cookies_model.get())); 729 GetDisplayedSessionStorages(cookies_model.get()));
679 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 730 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
680 GetDisplayedFileSystems(cookies_model.get())); 731 GetDisplayedFileSystems(cookies_model.get()));
681 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 732 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
682 GetDisplayedIndexedDBs(cookies_model.get())); 733 GetDisplayedIndexedDBs(cookies_model.get()));
683 EXPECT_EQ("quotahost1", 734 EXPECT_EQ("quotahost1",
684 GetDisplayedQuotas(cookies_model.get())); 735 GetDisplayedQuotas(cookies_model.get()));
685 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 736 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
686 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 737 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
687 GetDisplayedCacheStorages(cookies_model.get())); 738 GetDisplayedCacheStorages(cookies_model.get()));
688 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 739 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
689 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); 740 EXPECT_EQ("https://media1/,https://media2/",
741 GetDisplayedMediaLicenses(cookies_model.get()));
742 EXPECT_EQ(55, cookies_model->GetRoot()->GetTotalNodeCount());
690 } 743 }
691 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); 744
745 // quotahost1 -> quotahost1 (2 objects)
746 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16));
692 { 747 {
693 SCOPED_TRACE("`quotahost1` removed."); 748 SCOPED_TRACE("`quotahost1` removed.");
694 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 749 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
695 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 750 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
696 EXPECT_EQ("http://host1:1/,http://host2:2/", 751 EXPECT_EQ("http://host1:1/,http://host2:2/",
697 GetDisplayedLocalStorages(cookies_model.get())); 752 GetDisplayedLocalStorages(cookies_model.get()));
698 EXPECT_EQ("http://host1:1/,http://host2:2/", 753 EXPECT_EQ("http://host1:1/,http://host2:2/",
699 GetDisplayedSessionStorages(cookies_model.get())); 754 GetDisplayedSessionStorages(cookies_model.get()));
700 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 755 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
701 GetDisplayedFileSystems(cookies_model.get())); 756 GetDisplayedFileSystems(cookies_model.get()));
702 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 757 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
703 GetDisplayedIndexedDBs(cookies_model.get())); 758 GetDisplayedIndexedDBs(cookies_model.get()));
704 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 759 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
705 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 760 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
706 GetDisplayedCacheStorages(cookies_model.get())); 761 GetDisplayedCacheStorages(cookies_model.get()));
707 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 762 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
763 EXPECT_EQ("https://media1/,https://media2/",
764 GetDisplayedMediaLicenses(cookies_model.get()));
765 EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount());
766 }
767
768 // media2 -> media_licenses -> media_license (3 objects)
769 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15));
770 {
771 SCOPED_TRACE("`media2` removed.");
772 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
773 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
774 EXPECT_EQ("http://host1:1/,http://host2:2/",
775 GetDisplayedLocalStorages(cookies_model.get()));
776 EXPECT_EQ("http://host1:1/,http://host2:2/",
777 GetDisplayedSessionStorages(cookies_model.get()));
778 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
779 GetDisplayedFileSystems(cookies_model.get()));
780 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
781 GetDisplayedIndexedDBs(cookies_model.get()));
782 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
783 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
784 GetDisplayedCacheStorages(cookies_model.get()));
785 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
786 EXPECT_EQ("https://media1/",
787 GetDisplayedMediaLicenses(cookies_model.get()));
788 EXPECT_EQ(50, cookies_model->GetRoot()->GetTotalNodeCount());
789 }
790
791 // media1 -> media_licenses -> media_license (3 objects)
792 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14));
793 {
794 SCOPED_TRACE("`media1` removed.");
795 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
796 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
797 EXPECT_EQ("http://host1:1/,http://host2:2/",
798 GetDisplayedLocalStorages(cookies_model.get()));
799 EXPECT_EQ("http://host1:1/,http://host2:2/",
800 GetDisplayedSessionStorages(cookies_model.get()));
801 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
802 GetDisplayedFileSystems(cookies_model.get()));
803 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
804 GetDisplayedIndexedDBs(cookies_model.get()));
805 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
806 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
807 GetDisplayedCacheStorages(cookies_model.get()));
808 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
809 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
708 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); 810 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount());
709 } 811 }
812
813 // idbhost2 -> indexeddb -> http://idbhost2:2/ (3 objects)
710 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); 814 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13));
711 { 815 {
712 SCOPED_TRACE("`idbhost2` removed."); 816 SCOPED_TRACE("`idbhost2` removed.");
713 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 817 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
714 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 818 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
715 EXPECT_EQ("http://host1:1/,http://host2:2/", 819 EXPECT_EQ("http://host1:1/,http://host2:2/",
716 GetDisplayedLocalStorages(cookies_model.get())); 820 GetDisplayedLocalStorages(cookies_model.get()));
717 EXPECT_EQ("http://host1:1/,http://host2:2/", 821 EXPECT_EQ("http://host1:1/,http://host2:2/",
718 GetDisplayedSessionStorages(cookies_model.get())); 822 GetDisplayedSessionStorages(cookies_model.get()));
719 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 823 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
720 GetDisplayedFileSystems(cookies_model.get())); 824 GetDisplayedFileSystems(cookies_model.get()));
721 EXPECT_EQ("http://idbhost1:1/", 825 EXPECT_EQ("http://idbhost1:1/",
722 GetDisplayedIndexedDBs(cookies_model.get())); 826 GetDisplayedIndexedDBs(cookies_model.get()));
723 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 827 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
724 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 828 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
725 GetDisplayedCacheStorages(cookies_model.get())); 829 GetDisplayedCacheStorages(cookies_model.get()));
726 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 830 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
831 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
727 EXPECT_EQ(44, cookies_model->GetRoot()->GetTotalNodeCount()); 832 EXPECT_EQ(44, cookies_model->GetRoot()->GetTotalNodeCount());
728 } 833 }
834
835 // idbhost1 -> indexeddb -> http://idbhost1:1/ (3 objects)
729 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); 836 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12));
730 { 837 {
731 SCOPED_TRACE("`idbhost1` removed."); 838 SCOPED_TRACE("`idbhost1` removed.");
732 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 839 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
733 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 840 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
734 EXPECT_EQ("http://host1:1/,http://host2:2/", 841 EXPECT_EQ("http://host1:1/,http://host2:2/",
735 GetDisplayedLocalStorages(cookies_model.get())); 842 GetDisplayedLocalStorages(cookies_model.get()));
736 EXPECT_EQ("http://host1:1/,http://host2:2/", 843 EXPECT_EQ("http://host1:1/,http://host2:2/",
737 GetDisplayedSessionStorages(cookies_model.get())); 844 GetDisplayedSessionStorages(cookies_model.get()));
738 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 845 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
739 GetDisplayedFileSystems(cookies_model.get())); 846 GetDisplayedFileSystems(cookies_model.get()));
740 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 847 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
741 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 848 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
742 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 849 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
743 GetDisplayedCacheStorages(cookies_model.get())); 850 GetDisplayedCacheStorages(cookies_model.get()));
744 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 851 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
852 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
745 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); 853 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount());
746 } 854 }
855
856 // host2 -> localstorage -> http://host2:2/,
857 // -> sessionstorage -> http://host2:2/ (5 objects)
747 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); 858 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11));
748 { 859 {
749 SCOPED_TRACE("`host2` removed."); 860 SCOPED_TRACE("`host2` removed.");
750 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 861 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
751 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 862 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
752 EXPECT_EQ("http://host1:1/", 863 EXPECT_EQ("http://host1:1/",
753 GetDisplayedLocalStorages(cookies_model.get())); 864 GetDisplayedLocalStorages(cookies_model.get()));
754 EXPECT_EQ("http://host1:1/", 865 EXPECT_EQ("http://host1:1/",
755 GetDisplayedSessionStorages(cookies_model.get())); 866 GetDisplayedSessionStorages(cookies_model.get()));
756 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 867 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
757 GetDisplayedFileSystems(cookies_model.get())); 868 GetDisplayedFileSystems(cookies_model.get()));
758 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 869 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
759 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 870 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
760 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 871 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
761 GetDisplayedCacheStorages(cookies_model.get())); 872 GetDisplayedCacheStorages(cookies_model.get()));
762 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 873 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
874 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
763 EXPECT_EQ(36, cookies_model->GetRoot()->GetTotalNodeCount()); 875 EXPECT_EQ(36, cookies_model->GetRoot()->GetTotalNodeCount());
764 } 876 }
877
878 // host1 -> localstorage -> http://host1:1/,
879 // -> sessionstorage -> http://host1:1/ (5 objects)
765 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); 880 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10));
766 { 881 {
767 SCOPED_TRACE("`host1` removed."); 882 SCOPED_TRACE("`host1` removed.");
768 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 883 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
769 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 884 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
770 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 885 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
771 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 886 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
772 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 887 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
773 GetDisplayedFileSystems(cookies_model.get())); 888 GetDisplayedFileSystems(cookies_model.get()));
774 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 889 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
775 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 890 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
776 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 891 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
777 GetDisplayedCacheStorages(cookies_model.get())); 892 GetDisplayedCacheStorages(cookies_model.get()));
778 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 893 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
894 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
779 EXPECT_EQ(31, cookies_model->GetRoot()->GetTotalNodeCount()); 895 EXPECT_EQ(31, cookies_model->GetRoot()->GetTotalNodeCount());
780 } 896 }
897
898 // gdbhost2 -> database -> db2 (3 objects)
781 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); 899 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9));
782 { 900 {
783 SCOPED_TRACE("`gdbhost2` removed."); 901 SCOPED_TRACE("`gdbhost2` removed.");
784 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 902 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
785 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); 903 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get()));
786 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 904 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
787 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 905 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
788 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 906 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
789 GetDisplayedFileSystems(cookies_model.get())); 907 GetDisplayedFileSystems(cookies_model.get()));
790 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 908 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
791 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 909 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
792 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 910 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
793 GetDisplayedCacheStorages(cookies_model.get())); 911 GetDisplayedCacheStorages(cookies_model.get()));
794 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 912 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
913 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
795 EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount()); 914 EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount());
796 } 915 }
916 // gdbhost1 -> database -> db1 (3 objects)
797 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); 917 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8));
798 { 918 {
799 SCOPED_TRACE("`gdbhost1` removed."); 919 SCOPED_TRACE("`gdbhost1` removed.");
800 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 920 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
801 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 921 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
802 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 922 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
803 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 923 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
804 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 924 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
805 GetDisplayedFileSystems(cookies_model.get())); 925 GetDisplayedFileSystems(cookies_model.get()));
806 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 926 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
807 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 927 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
808 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 928 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
809 GetDisplayedCacheStorages(cookies_model.get())); 929 GetDisplayedCacheStorages(cookies_model.get()));
810 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 930 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
931 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
811 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); 932 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount());
812 } 933 }
934
935 // fshost3 -> filesystem -> http://fshost3:1/ (3 objects)
813 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); 936 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7));
814 { 937 {
815 SCOPED_TRACE("`fshost3` removed."); 938 SCOPED_TRACE("`fshost3` removed.");
816 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 939 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
817 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 940 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
818 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 941 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
819 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 942 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
820 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", 943 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/",
821 GetDisplayedFileSystems(cookies_model.get())); 944 GetDisplayedFileSystems(cookies_model.get()));
822 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 945 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
823 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 946 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
824 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 947 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
825 GetDisplayedCacheStorages(cookies_model.get())); 948 GetDisplayedCacheStorages(cookies_model.get()));
826 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 949 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
950 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
827 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); 951 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount());
828 } 952 }
953
954 // fshost2 -> filesystem -> http://fshost2:1/ (3 objects)
829 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); 955 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6));
830 { 956 {
831 SCOPED_TRACE("`fshost2` removed."); 957 SCOPED_TRACE("`fshost2` removed.");
832 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 958 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
833 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 959 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
834 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 960 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
835 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 961 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
836 EXPECT_EQ("http://fshost1:1/", 962 EXPECT_EQ("http://fshost1:1/",
837 GetDisplayedFileSystems(cookies_model.get())); 963 GetDisplayedFileSystems(cookies_model.get()));
838 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 964 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
839 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 965 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
840 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 966 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
841 GetDisplayedCacheStorages(cookies_model.get())); 967 GetDisplayedCacheStorages(cookies_model.get()));
842 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 968 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
969 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
843 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); 970 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount());
844 } 971 }
972
973 // fshost1 -> filesystem -> http://fshost1:1/ (3 objects)
845 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); 974 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5));
846 { 975 {
847 SCOPED_TRACE("`fshost1` removed."); 976 SCOPED_TRACE("`fshost1` removed.");
848 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 977 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str());
849 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 978 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
850 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 979 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
851 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 980 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
852 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 981 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
853 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 982 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
854 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 983 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
855 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 984 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
856 GetDisplayedCacheStorages(cookies_model.get())); 985 GetDisplayedCacheStorages(cookies_model.get()));
857 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 986 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
987 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
858 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); 988 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount());
859 } 989 }
990
991 // foo3 -> cookies -> c (3 objects)
860 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); 992 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4));
861 { 993 {
862 SCOPED_TRACE("`foo3` removed."); 994 SCOPED_TRACE("`foo3` removed.");
863 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); 995 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str());
864 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 996 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
865 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 997 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
866 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 998 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
867 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 999 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
868 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 1000 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
869 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 1001 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
870 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1002 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
871 GetDisplayedCacheStorages(cookies_model.get())); 1003 GetDisplayedCacheStorages(cookies_model.get()));
872 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 1004 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
1005 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
873 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); 1006 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount());
874 } 1007 }
1008
1009 // foo2 -> cookies -> b (3 objects)
875 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); 1010 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3));
876 { 1011 {
877 SCOPED_TRACE("`foo2` removed."); 1012 SCOPED_TRACE("`foo2` removed.");
878 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); 1013 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str());
879 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 1014 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
880 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 1015 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
881 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 1016 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
882 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 1017 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
883 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 1018 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
884 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 1019 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
885 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1020 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
886 GetDisplayedCacheStorages(cookies_model.get())); 1021 GetDisplayedCacheStorages(cookies_model.get()));
887 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 1022 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
1023 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
888 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); 1024 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount());
889 } 1025 }
1026
1027 // foo1 -> cookies -> a (3 objects)
890 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); 1028 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2));
891 { 1029 {
892 SCOPED_TRACE("`foo1` removed."); 1030 SCOPED_TRACE("`foo1` removed.");
893 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); 1031 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str());
894 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 1032 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
895 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 1033 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
896 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 1034 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
897 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 1035 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
898 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 1036 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
899 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 1037 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
900 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1038 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
901 GetDisplayedCacheStorages(cookies_model.get())); 1039 GetDisplayedCacheStorages(cookies_model.get()));
902 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 1040 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
1041 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
903 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); 1042 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount());
904 } 1043 }
1044
1045 // cshost2 -> cache storage -> https://cshost2:2/ (3 objects)
905 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); 1046 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1));
906 { 1047 {
907 SCOPED_TRACE("`cshost2` removed."); 1048 SCOPED_TRACE("`cshost2` removed.");
908 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); 1049 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str());
909 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 1050 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
910 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 1051 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
911 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 1052 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
912 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 1053 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
913 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 1054 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
914 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 1055 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
915 EXPECT_EQ("https://cshost1:1/", 1056 EXPECT_EQ("https://cshost1:1/",
916 GetDisplayedCacheStorages(cookies_model.get())); 1057 GetDisplayedCacheStorages(cookies_model.get()));
917 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 1058 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
1059 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
918 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); 1060 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount());
919 } 1061 }
1062
1063 // cshost1 -> cache storage -> https://cshost1:1/ (3 objects)
920 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); 1064 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0));
921 { 1065 {
922 SCOPED_TRACE("`cshost1` removed."); 1066 SCOPED_TRACE("`cshost1` removed.");
923 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); 1067 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str());
924 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); 1068 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get()));
925 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); 1069 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get()));
926 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); 1070 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get()));
927 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); 1071 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get()));
928 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); 1072 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get()));
929 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); 1073 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get()));
930 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get())); 1074 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get()));
931 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); 1075 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get()));
1076 EXPECT_EQ("", GetDisplayedMediaLicenses(cookies_model.get()));
932 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); 1077 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount());
933 } 1078 }
934 } 1079 }
935 1080
936 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { 1081 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
937 std::unique_ptr<CookiesTreeModel> cookies_model( 1082 std::unique_ptr<CookiesTreeModel> cookies_model(
938 CreateCookiesTreeModelWithInitialSample()); 1083 CreateCookiesTreeModelWithInitialSample());
939 1084
940 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)->GetChild(0)); 1085 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)->GetChild(0));
941 { 1086 {
942 SCOPED_TRACE("First cookies origin removed"); 1087 SCOPED_TRACE("First cookies origin removed");
943 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1088 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
944 // 63 because in this case, the origin remains, although the COOKIES 1089 // 69 because in this case, the origin remains, although the COOKIES
945 // node beneath it has been deleted. 1090 // node beneath it has been deleted.
946 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); 1091 EXPECT_EQ(69, cookies_model->GetRoot()->GetTotalNodeCount());
947 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 1092 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
948 EXPECT_EQ("http://host1:1/,http://host2:2/", 1093 EXPECT_EQ("http://host1:1/,http://host2:2/",
949 GetDisplayedLocalStorages(cookies_model.get())); 1094 GetDisplayedLocalStorages(cookies_model.get()));
950 EXPECT_EQ("http://host1:1/,http://host2:2/", 1095 EXPECT_EQ("http://host1:1/,http://host2:2/",
951 GetDisplayedSessionStorages(cookies_model.get())); 1096 GetDisplayedSessionStorages(cookies_model.get()));
952 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1097 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
953 GetDisplayedIndexedDBs(cookies_model.get())); 1098 GetDisplayedIndexedDBs(cookies_model.get()));
954 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1099 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
955 GetDisplayedFileSystems(cookies_model.get())); 1100 GetDisplayedFileSystems(cookies_model.get()));
956 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1101 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
957 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1102 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
958 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1103 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
959 GetDisplayedServiceWorkers(cookies_model.get())); 1104 GetDisplayedServiceWorkers(cookies_model.get()));
960 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1105 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
961 GetDisplayedCacheStorages(cookies_model.get())); 1106 GetDisplayedCacheStorages(cookies_model.get()));
1107 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1108 EXPECT_EQ("https://media1/,https://media2/",
1109 GetDisplayedMediaLicenses(cookies_model.get()));
962 } 1110 }
963 1111
964 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); 1112 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0));
965 { 1113 {
966 SCOPED_TRACE("First database origin removed"); 1114 SCOPED_TRACE("First database origin removed");
967 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1115 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
968 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); 1116 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
969 EXPECT_EQ("http://host1:1/,http://host2:2/", 1117 EXPECT_EQ("http://host1:1/,http://host2:2/",
970 GetDisplayedLocalStorages(cookies_model.get())); 1118 GetDisplayedLocalStorages(cookies_model.get()));
971 EXPECT_EQ("http://host1:1/,http://host2:2/", 1119 EXPECT_EQ("http://host1:1/,http://host2:2/",
972 GetDisplayedSessionStorages(cookies_model.get())); 1120 GetDisplayedSessionStorages(cookies_model.get()));
973 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1121 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
974 GetDisplayedIndexedDBs(cookies_model.get())); 1122 GetDisplayedIndexedDBs(cookies_model.get()));
975 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1123 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
976 GetDisplayedFileSystems(cookies_model.get())); 1124 GetDisplayedFileSystems(cookies_model.get()));
977 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1125 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
978 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1126 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
979 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1127 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
980 GetDisplayedServiceWorkers(cookies_model.get())); 1128 GetDisplayedServiceWorkers(cookies_model.get()));
981 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1129 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
982 GetDisplayedCacheStorages(cookies_model.get())); 1130 GetDisplayedCacheStorages(cookies_model.get()));
983 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); 1131 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1132 EXPECT_EQ("https://media1/,https://media2/",
1133 GetDisplayedMediaLicenses(cookies_model.get()));
1134 EXPECT_EQ(67, cookies_model->GetRoot()->GetTotalNodeCount());
984 } 1135 }
985 1136
986 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); 1137 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0));
987 { 1138 {
988 SCOPED_TRACE("First local storage origin removed"); 1139 SCOPED_TRACE("First local storage origin removed");
989 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1140 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
990 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); 1141 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
991 EXPECT_EQ("http://host2:2/", 1142 EXPECT_EQ("http://host2:2/",
992 GetDisplayedLocalStorages(cookies_model.get())); 1143 GetDisplayedLocalStorages(cookies_model.get()));
993 EXPECT_EQ("http://host1:1/,http://host2:2/", 1144 EXPECT_EQ("http://host1:1/,http://host2:2/",
994 GetDisplayedSessionStorages(cookies_model.get())); 1145 GetDisplayedSessionStorages(cookies_model.get()));
995 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1146 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
996 GetDisplayedIndexedDBs(cookies_model.get())); 1147 GetDisplayedIndexedDBs(cookies_model.get()));
997 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1148 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
998 GetDisplayedFileSystems(cookies_model.get())); 1149 GetDisplayedFileSystems(cookies_model.get()));
999 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1150 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
1000 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1151 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
1001 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1152 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
1002 GetDisplayedServiceWorkers(cookies_model.get())); 1153 GetDisplayedServiceWorkers(cookies_model.get()));
1003 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1154 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
1004 GetDisplayedCacheStorages(cookies_model.get())); 1155 GetDisplayedCacheStorages(cookies_model.get()));
1005 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); 1156 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1157 EXPECT_EQ("https://media1/,https://media2/",
1158 GetDisplayedMediaLicenses(cookies_model.get()));
1159 EXPECT_EQ(65, cookies_model->GetRoot()->GetTotalNodeCount());
1006 } 1160 }
1007 } 1161 }
1008 1162
1009 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { 1163 TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
1010 std::unique_ptr<CookiesTreeModel> cookies_model( 1164 std::unique_ptr<CookiesTreeModel> cookies_model(
1011 CreateCookiesTreeModelWithInitialSample()); 1165 CreateCookiesTreeModelWithInitialSample());
1012 1166
1013 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0)); 1167 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0));
1014 { 1168 {
1015 SCOPED_TRACE("Second origin COOKIES node removed"); 1169 SCOPED_TRACE("Second origin COOKIES node removed");
1016 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1170 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str());
1017 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); 1171 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
1018 EXPECT_EQ("http://host1:1/,http://host2:2/", 1172 EXPECT_EQ("http://host1:1/,http://host2:2/",
1019 GetDisplayedLocalStorages(cookies_model.get())); 1173 GetDisplayedLocalStorages(cookies_model.get()));
1020 EXPECT_EQ("http://host1:1/,http://host2:2/", 1174 EXPECT_EQ("http://host1:1/,http://host2:2/",
1021 GetDisplayedSessionStorages(cookies_model.get())); 1175 GetDisplayedSessionStorages(cookies_model.get()));
1022 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1176 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
1023 GetDisplayedIndexedDBs(cookies_model.get())); 1177 GetDisplayedIndexedDBs(cookies_model.get()));
1024 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1178 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
1025 GetDisplayedFileSystems(cookies_model.get())); 1179 GetDisplayedFileSystems(cookies_model.get()));
1026 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1180 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
1027 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1181 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
1028 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1182 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
1029 GetDisplayedServiceWorkers(cookies_model.get())); 1183 GetDisplayedServiceWorkers(cookies_model.get()));
1030 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1184 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
1031 GetDisplayedCacheStorages(cookies_model.get())); 1185 GetDisplayedCacheStorages(cookies_model.get()));
1032 // 63 because in this case, the origin remains, although the COOKIES 1186 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1187 EXPECT_EQ("https://media1/,https://media2/",
1188 GetDisplayedMediaLicenses(cookies_model.get()));
1189 // 69 because in this case, the origin remains, although the COOKIES
1033 // node beneath it has been deleted. 1190 // node beneath it has been deleted.
1034 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); 1191 EXPECT_EQ(69, cookies_model->GetRoot()->GetTotalNodeCount());
1035 } 1192 }
1036 1193
1037 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); 1194 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0));
1038 { 1195 {
1039 SCOPED_TRACE("First database origin removed"); 1196 SCOPED_TRACE("First database origin removed");
1040 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1197 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str());
1041 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); 1198 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
1042 EXPECT_EQ("http://host1:1/,http://host2:2/", 1199 EXPECT_EQ("http://host1:1/,http://host2:2/",
1043 GetDisplayedLocalStorages(cookies_model.get())); 1200 GetDisplayedLocalStorages(cookies_model.get()));
1044 EXPECT_EQ("http://host1:1/,http://host2:2/", 1201 EXPECT_EQ("http://host1:1/,http://host2:2/",
1045 GetDisplayedSessionStorages(cookies_model.get())); 1202 GetDisplayedSessionStorages(cookies_model.get()));
1046 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1203 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
1047 GetDisplayedIndexedDBs(cookies_model.get())); 1204 GetDisplayedIndexedDBs(cookies_model.get()));
1048 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1205 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
1049 GetDisplayedFileSystems(cookies_model.get())); 1206 GetDisplayedFileSystems(cookies_model.get()));
1050 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1207 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
1051 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1208 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
1052 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1209 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
1053 GetDisplayedServiceWorkers(cookies_model.get())); 1210 GetDisplayedServiceWorkers(cookies_model.get()));
1054 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1211 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
1055 GetDisplayedCacheStorages(cookies_model.get())); 1212 GetDisplayedCacheStorages(cookies_model.get()));
1056 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); 1213 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1214 EXPECT_EQ("https://media1/,https://media2/",
1215 GetDisplayedMediaLicenses(cookies_model.get()));
1216 EXPECT_EQ(67, cookies_model->GetRoot()->GetTotalNodeCount());
1057 } 1217 }
1058 1218
1059 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); 1219 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0));
1060 { 1220 {
1061 SCOPED_TRACE("First local storage origin removed"); 1221 SCOPED_TRACE("First local storage origin removed");
1062 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); 1222 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str());
1063 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); 1223 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
1064 EXPECT_EQ("http://host2:2/", 1224 EXPECT_EQ("http://host2:2/",
1065 GetDisplayedLocalStorages(cookies_model.get())); 1225 GetDisplayedLocalStorages(cookies_model.get()));
1066 EXPECT_EQ("http://host1:1/,http://host2:2/", 1226 EXPECT_EQ("http://host1:1/,http://host2:2/",
1067 GetDisplayedSessionStorages(cookies_model.get())); 1227 GetDisplayedSessionStorages(cookies_model.get()));
1068 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", 1228 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
1069 GetDisplayedIndexedDBs(cookies_model.get())); 1229 GetDisplayedIndexedDBs(cookies_model.get()));
1070 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", 1230 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/",
1071 GetDisplayedFileSystems(cookies_model.get())); 1231 GetDisplayedFileSystems(cookies_model.get()));
1072 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); 1232 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get()));
1073 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); 1233 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get()));
1074 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", 1234 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/",
1075 GetDisplayedServiceWorkers(cookies_model.get())); 1235 GetDisplayedServiceWorkers(cookies_model.get()));
1076 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", 1236 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/",
1077 GetDisplayedCacheStorages(cookies_model.get())); 1237 GetDisplayedCacheStorages(cookies_model.get()));
1078 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); 1238 EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model.get()));
1239 EXPECT_EQ("https://media1/,https://media2/",
1240 GetDisplayedMediaLicenses(cookies_model.get()));
1241 EXPECT_EQ(65, cookies_model->GetRoot()->GetTotalNodeCount());
1079 } 1242 }
1080 } 1243 }
1081 1244
1082 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { 1245 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
1083 LocalDataContainer* container = 1246 LocalDataContainer* container =
1084 new LocalDataContainer(mock_browsing_data_cookie_helper_, 1247 new LocalDataContainer(mock_browsing_data_cookie_helper_,
1085 mock_browsing_data_database_helper_, 1248 mock_browsing_data_database_helper_,
1086 mock_browsing_data_local_storage_helper_, 1249 mock_browsing_data_local_storage_helper_,
1087 mock_browsing_data_session_storage_helper_, 1250 mock_browsing_data_session_storage_helper_,
1088 mock_browsing_data_appcache_helper_, 1251 mock_browsing_data_appcache_helper_,
1089 mock_browsing_data_indexed_db_helper_, 1252 mock_browsing_data_indexed_db_helper_,
1090 mock_browsing_data_file_system_helper_, 1253 mock_browsing_data_file_system_helper_,
1091 mock_browsing_data_quota_helper_, 1254 mock_browsing_data_quota_helper_,
1092 mock_browsing_data_channel_id_helper_, 1255 mock_browsing_data_channel_id_helper_,
1093 mock_browsing_data_service_worker_helper_, 1256 mock_browsing_data_service_worker_helper_,
1094 mock_browsing_data_cache_storage_helper_, 1257 mock_browsing_data_cache_storage_helper_,
1095 mock_browsing_data_flash_lso_helper_); 1258 mock_browsing_data_flash_lso_helper_,
1259 mock_browsing_data_media_license_helper_);
1096 CookiesTreeModel cookies_model(container, special_storage_policy()); 1260 CookiesTreeModel cookies_model(container, special_storage_policy());
1097 1261
1098 mock_browsing_data_cookie_helper_-> 1262 mock_browsing_data_cookie_helper_->
1099 AddCookieSamples(GURL("http://foo1"), "A=1"); 1263 AddCookieSamples(GURL("http://foo1"), "A=1");
1100 mock_browsing_data_cookie_helper_-> 1264 mock_browsing_data_cookie_helper_->
1101 AddCookieSamples(GURL("http://foo2"), "B=1"); 1265 AddCookieSamples(GURL("http://foo2"), "B=1");
1102 mock_browsing_data_cookie_helper_-> 1266 mock_browsing_data_cookie_helper_->
1103 AddCookieSamples(GURL("http://foo3"), "C=1"); 1267 AddCookieSamples(GURL("http://foo3"), "C=1");
1104 mock_browsing_data_cookie_helper_-> 1268 mock_browsing_data_cookie_helper_->
1105 AddCookieSamples(GURL("http://foo3"), "D=1"); 1269 AddCookieSamples(GURL("http://foo3"), "D=1");
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 mock_browsing_data_database_helper_, 1356 mock_browsing_data_database_helper_,
1193 mock_browsing_data_local_storage_helper_, 1357 mock_browsing_data_local_storage_helper_,
1194 mock_browsing_data_session_storage_helper_, 1358 mock_browsing_data_session_storage_helper_,
1195 mock_browsing_data_appcache_helper_, 1359 mock_browsing_data_appcache_helper_,
1196 mock_browsing_data_indexed_db_helper_, 1360 mock_browsing_data_indexed_db_helper_,
1197 mock_browsing_data_file_system_helper_, 1361 mock_browsing_data_file_system_helper_,
1198 mock_browsing_data_quota_helper_, 1362 mock_browsing_data_quota_helper_,
1199 mock_browsing_data_channel_id_helper_, 1363 mock_browsing_data_channel_id_helper_,
1200 mock_browsing_data_service_worker_helper_, 1364 mock_browsing_data_service_worker_helper_,
1201 mock_browsing_data_cache_storage_helper_, 1365 mock_browsing_data_cache_storage_helper_,
1202 mock_browsing_data_flash_lso_helper_); 1366 mock_browsing_data_flash_lso_helper_,
1367 mock_browsing_data_media_license_helper_);
1203 CookiesTreeModel cookies_model(container, special_storage_policy()); 1368 CookiesTreeModel cookies_model(container, special_storage_policy());
1204 1369
1205 mock_browsing_data_cookie_helper_-> 1370 mock_browsing_data_cookie_helper_->
1206 AddCookieSamples(GURL("http://foo1"), "A=1"); 1371 AddCookieSamples(GURL("http://foo1"), "A=1");
1207 mock_browsing_data_cookie_helper_-> 1372 mock_browsing_data_cookie_helper_->
1208 AddCookieSamples(GURL("http://foo2"), "B=1"); 1373 AddCookieSamples(GURL("http://foo2"), "B=1");
1209 mock_browsing_data_cookie_helper_-> 1374 mock_browsing_data_cookie_helper_->
1210 AddCookieSamples(GURL("http://foo3"), "C=1"); 1375 AddCookieSamples(GURL("http://foo3"), "C=1");
1211 mock_browsing_data_cookie_helper_-> 1376 mock_browsing_data_cookie_helper_->
1212 AddCookieSamples(GURL("http://foo3"), "D=1"); 1377 AddCookieSamples(GURL("http://foo3"), "D=1");
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 mock_browsing_data_database_helper_, 1467 mock_browsing_data_database_helper_,
1303 mock_browsing_data_local_storage_helper_, 1468 mock_browsing_data_local_storage_helper_,
1304 mock_browsing_data_session_storage_helper_, 1469 mock_browsing_data_session_storage_helper_,
1305 mock_browsing_data_appcache_helper_, 1470 mock_browsing_data_appcache_helper_,
1306 mock_browsing_data_indexed_db_helper_, 1471 mock_browsing_data_indexed_db_helper_,
1307 mock_browsing_data_file_system_helper_, 1472 mock_browsing_data_file_system_helper_,
1308 mock_browsing_data_quota_helper_, 1473 mock_browsing_data_quota_helper_,
1309 mock_browsing_data_channel_id_helper_, 1474 mock_browsing_data_channel_id_helper_,
1310 mock_browsing_data_service_worker_helper_, 1475 mock_browsing_data_service_worker_helper_,
1311 mock_browsing_data_cache_storage_helper_, 1476 mock_browsing_data_cache_storage_helper_,
1312 mock_browsing_data_flash_lso_helper_); 1477 mock_browsing_data_flash_lso_helper_,
1478 mock_browsing_data_media_license_helper_);
1313 CookiesTreeModel cookies_model(container, special_storage_policy()); 1479 CookiesTreeModel cookies_model(container, special_storage_policy());
1314 1480
1315 mock_browsing_data_cookie_helper_-> 1481 mock_browsing_data_cookie_helper_->
1316 AddCookieSamples(GURL("http://foo1"), "A=1"); 1482 AddCookieSamples(GURL("http://foo1"), "A=1");
1317 mock_browsing_data_cookie_helper_-> 1483 mock_browsing_data_cookie_helper_->
1318 AddCookieSamples(GURL("http://foo2"), "B=1"); 1484 AddCookieSamples(GURL("http://foo2"), "B=1");
1319 mock_browsing_data_cookie_helper_-> 1485 mock_browsing_data_cookie_helper_->
1320 AddCookieSamples(GURL("http://foo3"), "C=1"); 1486 AddCookieSamples(GURL("http://foo3"), "C=1");
1321 mock_browsing_data_cookie_helper_-> 1487 mock_browsing_data_cookie_helper_->
1322 AddCookieSamples(GURL("http://foo3"), "D=1"); 1488 AddCookieSamples(GURL("http://foo3"), "D=1");
(...skipping 23 matching lines...) Expand all
1346 mock_browsing_data_database_helper_, 1512 mock_browsing_data_database_helper_,
1347 mock_browsing_data_local_storage_helper_, 1513 mock_browsing_data_local_storage_helper_,
1348 mock_browsing_data_session_storage_helper_, 1514 mock_browsing_data_session_storage_helper_,
1349 mock_browsing_data_appcache_helper_, 1515 mock_browsing_data_appcache_helper_,
1350 mock_browsing_data_indexed_db_helper_, 1516 mock_browsing_data_indexed_db_helper_,
1351 mock_browsing_data_file_system_helper_, 1517 mock_browsing_data_file_system_helper_,
1352 mock_browsing_data_quota_helper_, 1518 mock_browsing_data_quota_helper_,
1353 mock_browsing_data_channel_id_helper_, 1519 mock_browsing_data_channel_id_helper_,
1354 mock_browsing_data_service_worker_helper_, 1520 mock_browsing_data_service_worker_helper_,
1355 mock_browsing_data_cache_storage_helper_, 1521 mock_browsing_data_cache_storage_helper_,
1356 mock_browsing_data_flash_lso_helper_); 1522 mock_browsing_data_flash_lso_helper_,
1523 mock_browsing_data_media_license_helper_);
1357 CookiesTreeModel cookies_model(container, special_storage_policy()); 1524 CookiesTreeModel cookies_model(container, special_storage_policy());
1358 1525
1359 mock_browsing_data_cookie_helper_-> 1526 mock_browsing_data_cookie_helper_->
1360 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); 1527 AddCookieSamples(GURL("http://a.foo2.com"), "A=1");
1361 mock_browsing_data_cookie_helper_-> 1528 mock_browsing_data_cookie_helper_->
1362 AddCookieSamples(GURL("http://foo2.com"), "B=1"); 1529 AddCookieSamples(GURL("http://foo2.com"), "B=1");
1363 mock_browsing_data_cookie_helper_-> 1530 mock_browsing_data_cookie_helper_->
1364 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); 1531 AddCookieSamples(GURL("http://b.foo1.com"), "C=1");
1365 // Leading dot on the foo4 1532 // Leading dot on the foo4
1366 mock_browsing_data_cookie_helper_->AddCookieSamples( 1533 mock_browsing_data_cookie_helper_->AddCookieSamples(
(...skipping 28 matching lines...) Expand all
1395 mock_browsing_data_database_helper_, 1562 mock_browsing_data_database_helper_,
1396 mock_browsing_data_local_storage_helper_, 1563 mock_browsing_data_local_storage_helper_,
1397 mock_browsing_data_session_storage_helper_, 1564 mock_browsing_data_session_storage_helper_,
1398 mock_browsing_data_appcache_helper_, 1565 mock_browsing_data_appcache_helper_,
1399 mock_browsing_data_indexed_db_helper_, 1566 mock_browsing_data_indexed_db_helper_,
1400 mock_browsing_data_file_system_helper_, 1567 mock_browsing_data_file_system_helper_,
1401 mock_browsing_data_quota_helper_, 1568 mock_browsing_data_quota_helper_,
1402 mock_browsing_data_channel_id_helper_, 1569 mock_browsing_data_channel_id_helper_,
1403 mock_browsing_data_service_worker_helper_, 1570 mock_browsing_data_service_worker_helper_,
1404 mock_browsing_data_cache_storage_helper_, 1571 mock_browsing_data_cache_storage_helper_,
1405 mock_browsing_data_flash_lso_helper_); 1572 mock_browsing_data_flash_lso_helper_,
1573 mock_browsing_data_media_license_helper_);
1406 CookiesTreeModel cookies_model(container, special_storage_policy()); 1574 CookiesTreeModel cookies_model(container, special_storage_policy());
1407 1575
1408 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); 1576 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1");
1409 mock_browsing_data_cookie_helper_->Notify(); 1577 mock_browsing_data_cookie_helper_->Notify();
1410 1578
1411 TestingProfile profile; 1579 TestingProfile profile;
1412 HostContentSettingsMap* content_settings = 1580 HostContentSettingsMap* content_settings =
1413 HostContentSettingsMapFactory::GetForProfile(&profile); 1581 HostContentSettingsMapFactory::GetForProfile(&profile);
1414 content_settings::CookieSettings* cookie_settings = 1582 content_settings::CookieSettings* cookie_settings =
1415 CookieSettingsFactory::GetForProfile(&profile).get(); 1583 CookieSettingsFactory::GetForProfile(&profile).get();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 mock_browsing_data_database_helper_, 1668 mock_browsing_data_database_helper_,
1501 mock_browsing_data_local_storage_helper_, 1669 mock_browsing_data_local_storage_helper_,
1502 mock_browsing_data_session_storage_helper_, 1670 mock_browsing_data_session_storage_helper_,
1503 mock_browsing_data_appcache_helper_, 1671 mock_browsing_data_appcache_helper_,
1504 mock_browsing_data_indexed_db_helper_, 1672 mock_browsing_data_indexed_db_helper_,
1505 mock_browsing_data_file_system_helper_, 1673 mock_browsing_data_file_system_helper_,
1506 mock_browsing_data_quota_helper_, 1674 mock_browsing_data_quota_helper_,
1507 mock_browsing_data_channel_id_helper_, 1675 mock_browsing_data_channel_id_helper_,
1508 mock_browsing_data_service_worker_helper_, 1676 mock_browsing_data_service_worker_helper_,
1509 mock_browsing_data_cache_storage_helper_, 1677 mock_browsing_data_cache_storage_helper_,
1510 mock_browsing_data_flash_lso_helper_); 1678 mock_browsing_data_flash_lso_helper_,
1679 mock_browsing_data_media_license_helper_);
1511 CookiesTreeModel cookies_model(container, special_storage_policy()); 1680 CookiesTreeModel cookies_model(container, special_storage_policy());
1512 1681
1513 mock_browsing_data_cookie_helper_-> 1682 mock_browsing_data_cookie_helper_->
1514 AddCookieSamples(GURL("http://123.com"), "A=1"); 1683 AddCookieSamples(GURL("http://123.com"), "A=1");
1515 mock_browsing_data_cookie_helper_-> 1684 mock_browsing_data_cookie_helper_->
1516 AddCookieSamples(GURL("http://foo1.com"), "B=1"); 1685 AddCookieSamples(GURL("http://foo1.com"), "B=1");
1517 mock_browsing_data_cookie_helper_-> 1686 mock_browsing_data_cookie_helper_->
1518 AddCookieSamples(GURL("http://foo2.com"), "C=1"); 1687 AddCookieSamples(GURL("http://foo2.com"), "C=1");
1519 mock_browsing_data_cookie_helper_-> 1688 mock_browsing_data_cookie_helper_->
1520 AddCookieSamples(GURL("http://foo3.com"), "D=1"); 1689 AddCookieSamples(GURL("http://foo3.com"), "D=1");
(...skipping 21 matching lines...) Expand all
1542 mock_browsing_data_database_helper_, 1711 mock_browsing_data_database_helper_,
1543 mock_browsing_data_local_storage_helper_, 1712 mock_browsing_data_local_storage_helper_,
1544 mock_browsing_data_session_storage_helper_, 1713 mock_browsing_data_session_storage_helper_,
1545 mock_browsing_data_appcache_helper_, 1714 mock_browsing_data_appcache_helper_,
1546 mock_browsing_data_indexed_db_helper_, 1715 mock_browsing_data_indexed_db_helper_,
1547 mock_browsing_data_file_system_helper_, 1716 mock_browsing_data_file_system_helper_,
1548 mock_browsing_data_quota_helper_, 1717 mock_browsing_data_quota_helper_,
1549 mock_browsing_data_channel_id_helper_, 1718 mock_browsing_data_channel_id_helper_,
1550 mock_browsing_data_service_worker_helper_, 1719 mock_browsing_data_service_worker_helper_,
1551 mock_browsing_data_cache_storage_helper_, 1720 mock_browsing_data_cache_storage_helper_,
1552 mock_browsing_data_flash_lso_helper_); 1721 mock_browsing_data_flash_lso_helper_,
1722 mock_browsing_data_media_license_helper_);
1553 CookiesTreeModel cookies_model(container, special_storage_policy()); 1723 CookiesTreeModel cookies_model(container, special_storage_policy());
1554 1724
1555 mock_browsing_data_cookie_helper_->AddCookieSamples( 1725 mock_browsing_data_cookie_helper_->AddCookieSamples(
1556 GURL("file:///tmp/test.html"), "A=1"); 1726 GURL("file:///tmp/test.html"), "A=1");
1557 mock_browsing_data_cookie_helper_->AddCookieSamples( 1727 mock_browsing_data_cookie_helper_->AddCookieSamples(
1558 GURL("http://example.com"), "B=1"); 1728 GURL("http://example.com"), "B=1");
1559 mock_browsing_data_cookie_helper_->AddCookieSamples( 1729 mock_browsing_data_cookie_helper_->AddCookieSamples(
1560 GURL("http://example.com/"), "C=1"); 1730 GURL("http://example.com/"), "C=1");
1561 mock_browsing_data_cookie_helper_->AddCookieSamples( 1731 mock_browsing_data_cookie_helper_->AddCookieSamples(
1562 GURL("http://example.com/test"), "D=1"); 1732 GURL("http://example.com/test"), "D=1");
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 mock_browsing_data_database_helper_, 1800 mock_browsing_data_database_helper_,
1631 mock_browsing_data_local_storage_helper_, 1801 mock_browsing_data_local_storage_helper_,
1632 mock_browsing_data_session_storage_helper_, 1802 mock_browsing_data_session_storage_helper_,
1633 mock_browsing_data_appcache_helper_, 1803 mock_browsing_data_appcache_helper_,
1634 mock_browsing_data_indexed_db_helper_, 1804 mock_browsing_data_indexed_db_helper_,
1635 mock_browsing_data_file_system_helper_, 1805 mock_browsing_data_file_system_helper_,
1636 mock_browsing_data_quota_helper_, 1806 mock_browsing_data_quota_helper_,
1637 mock_browsing_data_channel_id_helper_, 1807 mock_browsing_data_channel_id_helper_,
1638 mock_browsing_data_service_worker_helper_, 1808 mock_browsing_data_service_worker_helper_,
1639 mock_browsing_data_cache_storage_helper_, 1809 mock_browsing_data_cache_storage_helper_,
1640 mock_browsing_data_flash_lso_helper_); 1810 mock_browsing_data_flash_lso_helper_,
1811 mock_browsing_data_media_license_helper_);
1641 CookiesTreeModel cookies_model(container, special_storage_policy()); 1812 CookiesTreeModel cookies_model(container, special_storage_policy());
1642 1813
1643 mock_browsing_data_cookie_helper_-> 1814 mock_browsing_data_cookie_helper_->
1644 AddCookieSamples(GURL(), "A=1"); 1815 AddCookieSamples(GURL(), "A=1");
1645 mock_browsing_data_cookie_helper_->Notify(); 1816 mock_browsing_data_cookie_helper_->Notify();
1646 EXPECT_EQ("A", GetDisplayedCookies(&cookies_model)); 1817 EXPECT_EQ("A", GetDisplayedCookies(&cookies_model));
1647 } 1818 }
1648 1819
1649 TEST_F(CookiesTreeModelTest, Suborigins) { 1820 TEST_F(CookiesTreeModelTest, Suborigins) {
1650 LocalDataContainer* container = 1821 LocalDataContainer* container =
1651 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), 1822 new LocalDataContainer(mock_browsing_data_cookie_helper_,
1652 mock_browsing_data_database_helper_.get(), 1823 mock_browsing_data_database_helper_,
1653 mock_browsing_data_local_storage_helper_.get(), 1824 mock_browsing_data_local_storage_helper_,
1654 mock_browsing_data_session_storage_helper_.get(), 1825 mock_browsing_data_session_storage_helper_,
1655 mock_browsing_data_appcache_helper_.get(), 1826 mock_browsing_data_appcache_helper_,
1656 mock_browsing_data_indexed_db_helper_.get(), 1827 mock_browsing_data_indexed_db_helper_,
1657 mock_browsing_data_file_system_helper_.get(), 1828 mock_browsing_data_file_system_helper_,
1658 mock_browsing_data_quota_helper_.get(), 1829 mock_browsing_data_quota_helper_,
1659 mock_browsing_data_channel_id_helper_.get(), 1830 mock_browsing_data_channel_id_helper_,
1660 mock_browsing_data_service_worker_helper_.get(), 1831 mock_browsing_data_service_worker_helper_,
1661 mock_browsing_data_cache_storage_helper_.get(), 1832 mock_browsing_data_cache_storage_helper_,
1662 mock_browsing_data_flash_lso_helper_.get()); 1833 mock_browsing_data_flash_lso_helper_,
1834 mock_browsing_data_media_license_helper_);
1663 CookiesTreeModel cookies_model(container, special_storage_policy()); 1835 CookiesTreeModel cookies_model(container, special_storage_policy());
1664 1836
1665 mock_browsing_data_local_storage_helper_ 1837 mock_browsing_data_local_storage_helper_
1666 ->AddLocalStorageSamplesWithSuborigins(); 1838 ->AddLocalStorageSamplesWithSuborigins();
1667 mock_browsing_data_local_storage_helper_->Notify(); 1839 mock_browsing_data_local_storage_helper_->Notify();
1668 { 1840 {
1669 SCOPED_TRACE( 1841 SCOPED_TRACE(
1670 "Suborigins get their own storage partitions and are folded into their " 1842 "Suborigins get their own storage partitions and are folded into their "
1671 "respective hosts"); 1843 "respective hosts");
1672 // root 1844 // root
1673 // host4 -> local storage -> http-so://foobar.host4:4 1845 // host4 -> local storage -> http-so://foobar.host4:4
1674 // -> http://host4:4 1846 // -> http://host4:4
1675 // host3 -> local storage -> http-so://foobar.host3:3 1847 // host3 -> local storage -> http-so://foobar.host3:3
1676 // host2 -> local storage -> http://host2:2 1848 // host2 -> local storage -> http://host2:2
1677 // host1 -> local storage -> http://host1:1 1849 // host1 -> local storage -> http://host1:1
1678 EXPECT_EQ(14, cookies_model.GetRoot()->GetTotalNodeCount()); 1850 EXPECT_EQ(14, cookies_model.GetRoot()->GetTotalNodeCount());
1679 EXPECT_EQ( 1851 EXPECT_EQ(
1680 "http://host1:1/,http://host2:2/,http-so://foobar.host3:3/," 1852 "http://host1:1/,http://host2:2/,http-so://foobar.host3:3/,"
1681 "http-so://foobar.host4:4/,http://host4:4/", 1853 "http-so://foobar.host4:4/,http://host4:4/",
1682 GetDisplayedLocalStorages(&cookies_model)); 1854 GetDisplayedLocalStorages(&cookies_model));
1683 // Delete host4, which should delete foobar_host4:4 in addition to host4:4 1855 // Delete host4, which should delete foobar_host4:4 in addition to host4:4
1684 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(3)); 1856 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(3));
1685 EXPECT_EQ(10, cookies_model.GetRoot()->GetTotalNodeCount()); 1857 EXPECT_EQ(10, cookies_model.GetRoot()->GetTotalNodeCount());
1686 } 1858 }
1687 } 1859 }
1688 1860
1689 } // namespace 1861 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/cookies_tree_model.cc ('k') | chrome/browser/browsing_data/local_data_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698