OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h" | 11 #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h" |
| 12 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h" |
12 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" | 13 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" |
13 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" | 14 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" |
14 #include "chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h" | 15 #include "chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h" |
15 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" | 16 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" |
16 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h" | 17 #include "chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h" |
17 #include "chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h
" | 18 #include "chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h
" |
18 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" | 19 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" |
19 #include "chrome/browser/browsing_data/mock_browsing_data_server_bound_cert_help
er.h" | |
20 #include "chrome/browser/content_settings/cookie_settings.h" | 20 #include "chrome/browser/content_settings/cookie_settings.h" |
21 #include "chrome/browser/content_settings/host_content_settings_map.h" | 21 #include "chrome/browser/content_settings/host_content_settings_map.h" |
22 #include "chrome/browser/content_settings/mock_settings_observer.h" | 22 #include "chrome/browser/content_settings/mock_settings_observer.h" |
23 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 27 #include "content/public/test/test_browser_thread_bundle.h" |
28 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
29 #include "net/url_request/url_request_context_getter.h" | 29 #include "net/url_request/url_request_context_getter.h" |
(...skipping 26 matching lines...) Expand all Loading... |
56 mock_browsing_data_session_storage_helper_ = | 56 mock_browsing_data_session_storage_helper_ = |
57 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 57 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
58 mock_browsing_data_appcache_helper_ = | 58 mock_browsing_data_appcache_helper_ = |
59 new MockBrowsingDataAppCacheHelper(profile_.get()); | 59 new MockBrowsingDataAppCacheHelper(profile_.get()); |
60 mock_browsing_data_indexed_db_helper_ = | 60 mock_browsing_data_indexed_db_helper_ = |
61 new MockBrowsingDataIndexedDBHelper(profile_.get()); | 61 new MockBrowsingDataIndexedDBHelper(profile_.get()); |
62 mock_browsing_data_file_system_helper_ = | 62 mock_browsing_data_file_system_helper_ = |
63 new MockBrowsingDataFileSystemHelper(profile_.get()); | 63 new MockBrowsingDataFileSystemHelper(profile_.get()); |
64 mock_browsing_data_quota_helper_ = | 64 mock_browsing_data_quota_helper_ = |
65 new MockBrowsingDataQuotaHelper(profile_.get()); | 65 new MockBrowsingDataQuotaHelper(profile_.get()); |
66 mock_browsing_data_server_bound_cert_helper_ = | 66 mock_browsing_data_channel_id_helper_ = |
67 new MockBrowsingDataServerBoundCertHelper(); | 67 new MockBrowsingDataChannelIDHelper(); |
68 mock_browsing_data_flash_lso_helper_ = | 68 mock_browsing_data_flash_lso_helper_ = |
69 new MockBrowsingDataFlashLSOHelper(profile_.get()); | 69 new MockBrowsingDataFlashLSOHelper(profile_.get()); |
70 | 70 |
71 scoped_refptr<CookieSettings> cookie_settings = | 71 scoped_refptr<CookieSettings> cookie_settings = |
72 new CookieSettings(profile_->GetHostContentSettingsMap(), | 72 new CookieSettings(profile_->GetHostContentSettingsMap(), |
73 profile_->GetPrefs()); | 73 profile_->GetPrefs()); |
74 special_storage_policy_ = | 74 special_storage_policy_ = |
75 new ExtensionSpecialStoragePolicy(cookie_settings.get()); | 75 new ExtensionSpecialStoragePolicy(cookie_settings.get()); |
76 } | 76 } |
77 | 77 |
78 virtual void TearDown() OVERRIDE { | 78 virtual void TearDown() OVERRIDE { |
79 mock_browsing_data_server_bound_cert_helper_ = NULL; | 79 mock_browsing_data_channel_id_helper_ = NULL; |
80 mock_browsing_data_quota_helper_ = NULL; | 80 mock_browsing_data_quota_helper_ = NULL; |
81 mock_browsing_data_file_system_helper_ = NULL; | 81 mock_browsing_data_file_system_helper_ = NULL; |
82 mock_browsing_data_indexed_db_helper_ = NULL; | 82 mock_browsing_data_indexed_db_helper_ = NULL; |
83 mock_browsing_data_appcache_helper_ = NULL; | 83 mock_browsing_data_appcache_helper_ = NULL; |
84 mock_browsing_data_session_storage_helper_ = NULL; | 84 mock_browsing_data_session_storage_helper_ = NULL; |
85 mock_browsing_data_local_storage_helper_ = NULL; | 85 mock_browsing_data_local_storage_helper_ = NULL; |
86 mock_browsing_data_database_helper_ = NULL; | 86 mock_browsing_data_database_helper_ = NULL; |
87 mock_browsing_data_flash_lso_helper_ = NULL; | 87 mock_browsing_data_flash_lso_helper_ = NULL; |
88 base::MessageLoop::current()->RunUntilIdle(); | 88 base::MessageLoop::current()->RunUntilIdle(); |
89 } | 89 } |
90 | 90 |
91 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { | 91 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { |
92 LocalDataContainer* container = new LocalDataContainer( | 92 LocalDataContainer* container = new LocalDataContainer( |
93 mock_browsing_data_cookie_helper_.get(), | 93 mock_browsing_data_cookie_helper_.get(), |
94 mock_browsing_data_database_helper_.get(), | 94 mock_browsing_data_database_helper_.get(), |
95 mock_browsing_data_local_storage_helper_.get(), | 95 mock_browsing_data_local_storage_helper_.get(), |
96 mock_browsing_data_session_storage_helper_.get(), | 96 mock_browsing_data_session_storage_helper_.get(), |
97 mock_browsing_data_appcache_helper_.get(), | 97 mock_browsing_data_appcache_helper_.get(), |
98 mock_browsing_data_indexed_db_helper_.get(), | 98 mock_browsing_data_indexed_db_helper_.get(), |
99 mock_browsing_data_file_system_helper_.get(), | 99 mock_browsing_data_file_system_helper_.get(), |
100 mock_browsing_data_quota_helper_.get(), | 100 mock_browsing_data_quota_helper_.get(), |
101 mock_browsing_data_server_bound_cert_helper_.get(), | 101 mock_browsing_data_channel_id_helper_.get(), |
102 mock_browsing_data_flash_lso_helper_.get()); | 102 mock_browsing_data_flash_lso_helper_.get()); |
103 | 103 |
104 CookiesTreeModel* cookies_model = | 104 CookiesTreeModel* cookies_model = |
105 new CookiesTreeModel(container, special_storage_policy_.get(), false); | 105 new CookiesTreeModel(container, special_storage_policy_.get(), false); |
106 mock_browsing_data_cookie_helper_-> | 106 mock_browsing_data_cookie_helper_-> |
107 AddCookieSamples(GURL("http://foo1"), "A=1"); | 107 AddCookieSamples(GURL("http://foo1"), "A=1"); |
108 mock_browsing_data_cookie_helper_-> | 108 mock_browsing_data_cookie_helper_-> |
109 AddCookieSamples(GURL("http://foo2"), "B=1"); | 109 AddCookieSamples(GURL("http://foo2"), "B=1"); |
110 mock_browsing_data_cookie_helper_-> | 110 mock_browsing_data_cookie_helper_-> |
111 AddCookieSamples(GURL("http://foo3"), "C=1"); | 111 AddCookieSamples(GURL("http://foo3"), "C=1"); |
112 mock_browsing_data_cookie_helper_->Notify(); | 112 mock_browsing_data_cookie_helper_->Notify(); |
113 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 113 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
114 mock_browsing_data_database_helper_->Notify(); | 114 mock_browsing_data_database_helper_->Notify(); |
115 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 115 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
116 mock_browsing_data_local_storage_helper_->Notify(); | 116 mock_browsing_data_local_storage_helper_->Notify(); |
117 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 117 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
118 mock_browsing_data_session_storage_helper_->Notify(); | 118 mock_browsing_data_session_storage_helper_->Notify(); |
119 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 119 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
120 mock_browsing_data_indexed_db_helper_->Notify(); | 120 mock_browsing_data_indexed_db_helper_->Notify(); |
121 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 121 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
122 mock_browsing_data_file_system_helper_->Notify(); | 122 mock_browsing_data_file_system_helper_->Notify(); |
123 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 123 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
124 mock_browsing_data_quota_helper_->Notify(); | 124 mock_browsing_data_quota_helper_->Notify(); |
125 mock_browsing_data_server_bound_cert_helper_->AddServerBoundCertSample( | 125 mock_browsing_data_channel_id_helper_->AddChannelIDSample( |
126 "sbc1"); | 126 "sbc1"); |
127 mock_browsing_data_server_bound_cert_helper_->AddServerBoundCertSample( | 127 mock_browsing_data_channel_id_helper_->AddChannelIDSample( |
128 "sbc2"); | 128 "sbc2"); |
129 mock_browsing_data_server_bound_cert_helper_->Notify(); | 129 mock_browsing_data_channel_id_helper_->Notify(); |
130 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); | 130 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); |
131 mock_browsing_data_flash_lso_helper_->Notify(); | 131 mock_browsing_data_flash_lso_helper_->Notify(); |
132 | 132 |
133 { | 133 { |
134 SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " | 134 SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " |
135 "2 session storages, 2 indexed DBs, 3 filesystems, " | 135 "2 session storages, 2 indexed DBs, 3 filesystems, " |
136 "2 quotas, 2 server bound certs, 1 Flash LSO"); | 136 "2 quotas, 2 server bound certs, 1 Flash LSO"); |
137 // 51 because there's the root, then | 137 // 51 because there's the root, then |
138 // foo1 -> cookies -> a, | 138 // foo1 -> cookies -> a, |
139 // foo2 -> cookies -> b, | 139 // foo2 -> cookies -> b, |
(...skipping 21 matching lines...) Expand all Loading... |
161 GetDisplayedLocalStorages(cookies_model)); | 161 GetDisplayedLocalStorages(cookies_model)); |
162 EXPECT_EQ("http://host1:1/,http://host2:2/", | 162 EXPECT_EQ("http://host1:1/,http://host2:2/", |
163 GetDisplayedSessionStorages(cookies_model)); | 163 GetDisplayedSessionStorages(cookies_model)); |
164 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 164 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
165 GetDisplayedIndexedDBs(cookies_model)); | 165 GetDisplayedIndexedDBs(cookies_model)); |
166 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 166 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
167 GetDisplayedFileSystems(cookies_model)); | 167 GetDisplayedFileSystems(cookies_model)); |
168 EXPECT_EQ("quotahost1,quotahost2", | 168 EXPECT_EQ("quotahost1,quotahost2", |
169 GetDisplayedQuotas(cookies_model)); | 169 GetDisplayedQuotas(cookies_model)); |
170 EXPECT_EQ("sbc1,sbc2", | 170 EXPECT_EQ("sbc1,sbc2", |
171 GetDisplayedServerBoundCerts(cookies_model)); | 171 GetDisplayedChannelIDs(cookies_model)); |
172 EXPECT_EQ("xyz.com", | 172 EXPECT_EQ("xyz.com", |
173 GetDisplayedFlashLSOs(cookies_model)); | 173 GetDisplayedFlashLSOs(cookies_model)); |
174 } | 174 } |
175 return make_scoped_ptr(cookies_model); | 175 return make_scoped_ptr(cookies_model); |
176 } | 176 } |
177 | 177 |
178 std::string GetNodesOfChildren( | 178 std::string GetNodesOfChildren( |
179 const CookieTreeNode* node, | 179 const CookieTreeNode* node, |
180 CookieTreeNode::DetailedInfo::NodeType node_type) { | 180 CookieTreeNode::DetailedInfo::NodeType node_type) { |
181 if (!node->empty()) { | 181 if (!node->empty()) { |
(...skipping 22 matching lines...) Expand all Loading... |
204 return node->GetDetailedInfo().appcache_info->manifest_url.spec() + | 204 return node->GetDetailedInfo().appcache_info->manifest_url.spec() + |
205 ","; | 205 ","; |
206 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: | 206 case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: |
207 return node->GetDetailedInfo().indexed_db_info->origin_.spec() + | 207 return node->GetDetailedInfo().indexed_db_info->origin_.spec() + |
208 ","; | 208 ","; |
209 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 209 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
210 return node->GetDetailedInfo().file_system_info->origin.spec() + | 210 return node->GetDetailedInfo().file_system_info->origin.spec() + |
211 ","; | 211 ","; |
212 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 212 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
213 return node->GetDetailedInfo().quota_info->host + ","; | 213 return node->GetDetailedInfo().quota_info->host + ","; |
214 case CookieTreeNode::DetailedInfo::TYPE_SERVER_BOUND_CERT: | 214 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
215 return node->GetDetailedInfo( | 215 return node->GetDetailedInfo( |
216 ).server_bound_cert->server_identifier() + ","; | 216 ).channel_id->server_identifier() + ","; |
217 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: | 217 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: |
218 return node->GetDetailedInfo().flash_lso_domain + ","; | 218 return node->GetDetailedInfo().flash_lso_domain + ","; |
219 default: | 219 default: |
220 return std::string(); | 220 return std::string(); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 std::string GetCookiesOfChildren(const CookieTreeNode* node) { | 224 std::string GetCookiesOfChildren(const CookieTreeNode* node) { |
225 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); | 225 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); |
226 } | 226 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 std::string GetDisplayedFileSystems(CookiesTreeModel* cookies_model) { | 306 std::string GetDisplayedFileSystems(CookiesTreeModel* cookies_model) { |
307 return GetDisplayedNodes(cookies_model, | 307 return GetDisplayedNodes(cookies_model, |
308 CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM); | 308 CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM); |
309 } | 309 } |
310 | 310 |
311 std::string GetDisplayedQuotas(CookiesTreeModel* cookies_model) { | 311 std::string GetDisplayedQuotas(CookiesTreeModel* cookies_model) { |
312 return GetDisplayedNodes(cookies_model, | 312 return GetDisplayedNodes(cookies_model, |
313 CookieTreeNode::DetailedInfo::TYPE_QUOTA); | 313 CookieTreeNode::DetailedInfo::TYPE_QUOTA); |
314 } | 314 } |
315 | 315 |
316 std::string GetDisplayedServerBoundCerts(CookiesTreeModel* cookies_model) { | 316 std::string GetDisplayedChannelIDs(CookiesTreeModel* cookies_model) { |
317 return GetDisplayedNodes( | 317 return GetDisplayedNodes( |
318 cookies_model, CookieTreeNode::DetailedInfo::TYPE_SERVER_BOUND_CERT); | 318 cookies_model, CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID); |
319 } | 319 } |
320 | 320 |
321 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { | 321 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { |
322 return GetDisplayedNodes( | 322 return GetDisplayedNodes( |
323 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); | 323 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); |
324 } | 324 } |
325 | 325 |
326 // Do not call on the root. | 326 // Do not call on the root. |
327 void DeleteStoredObjects(CookieTreeNode* node) { | 327 void DeleteStoredObjects(CookieTreeNode* node) { |
328 node->DeleteStoredObjects(); | 328 node->DeleteStoredObjects(); |
(...skipping 14 matching lines...) Expand all Loading... |
343 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 343 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
344 mock_browsing_data_session_storage_helper_; | 344 mock_browsing_data_session_storage_helper_; |
345 scoped_refptr<MockBrowsingDataAppCacheHelper> | 345 scoped_refptr<MockBrowsingDataAppCacheHelper> |
346 mock_browsing_data_appcache_helper_; | 346 mock_browsing_data_appcache_helper_; |
347 scoped_refptr<MockBrowsingDataIndexedDBHelper> | 347 scoped_refptr<MockBrowsingDataIndexedDBHelper> |
348 mock_browsing_data_indexed_db_helper_; | 348 mock_browsing_data_indexed_db_helper_; |
349 scoped_refptr<MockBrowsingDataFileSystemHelper> | 349 scoped_refptr<MockBrowsingDataFileSystemHelper> |
350 mock_browsing_data_file_system_helper_; | 350 mock_browsing_data_file_system_helper_; |
351 scoped_refptr<MockBrowsingDataQuotaHelper> | 351 scoped_refptr<MockBrowsingDataQuotaHelper> |
352 mock_browsing_data_quota_helper_; | 352 mock_browsing_data_quota_helper_; |
353 scoped_refptr<MockBrowsingDataServerBoundCertHelper> | 353 scoped_refptr<MockBrowsingDataChannelIDHelper> |
354 mock_browsing_data_server_bound_cert_helper_; | 354 mock_browsing_data_channel_id_helper_; |
355 scoped_refptr<MockBrowsingDataFlashLSOHelper> | 355 scoped_refptr<MockBrowsingDataFlashLSOHelper> |
356 mock_browsing_data_flash_lso_helper_; | 356 mock_browsing_data_flash_lso_helper_; |
357 | 357 |
358 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; | 358 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
359 }; | 359 }; |
360 | 360 |
361 TEST_F(CookiesTreeModelTest, RemoveAll) { | 361 TEST_F(CookiesTreeModelTest, RemoveAll) { |
362 scoped_ptr<CookiesTreeModel> cookies_model( | 362 scoped_ptr<CookiesTreeModel> cookies_model( |
363 CreateCookiesTreeModelWithInitialSample()); | 363 CreateCookiesTreeModelWithInitialSample()); |
364 | 364 |
365 // Reset the selection of the first row. | 365 // Reset the selection of the first row. |
366 { | 366 { |
367 SCOPED_TRACE("Before removing"); | 367 SCOPED_TRACE("Before removing"); |
368 EXPECT_EQ("A,B,C", | 368 EXPECT_EQ("A,B,C", |
369 GetDisplayedCookies(cookies_model.get())); | 369 GetDisplayedCookies(cookies_model.get())); |
370 EXPECT_EQ("db1,db2", | 370 EXPECT_EQ("db1,db2", |
371 GetDisplayedDatabases(cookies_model.get())); | 371 GetDisplayedDatabases(cookies_model.get())); |
372 EXPECT_EQ("http://host1:1/,http://host2:2/", | 372 EXPECT_EQ("http://host1:1/,http://host2:2/", |
373 GetDisplayedLocalStorages(cookies_model.get())); | 373 GetDisplayedLocalStorages(cookies_model.get())); |
374 EXPECT_EQ("http://host1:1/,http://host2:2/", | 374 EXPECT_EQ("http://host1:1/,http://host2:2/", |
375 GetDisplayedSessionStorages(cookies_model.get())); | 375 GetDisplayedSessionStorages(cookies_model.get())); |
376 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 376 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
377 GetDisplayedIndexedDBs(cookies_model.get())); | 377 GetDisplayedIndexedDBs(cookies_model.get())); |
378 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 378 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
379 GetDisplayedFileSystems(cookies_model.get())); | 379 GetDisplayedFileSystems(cookies_model.get())); |
380 EXPECT_EQ("quotahost1,quotahost2", | 380 EXPECT_EQ("quotahost1,quotahost2", |
381 GetDisplayedQuotas(cookies_model.get())); | 381 GetDisplayedQuotas(cookies_model.get())); |
382 EXPECT_EQ("sbc1,sbc2", | 382 EXPECT_EQ("sbc1,sbc2", |
383 GetDisplayedServerBoundCerts(cookies_model.get())); | 383 GetDisplayedChannelIDs(cookies_model.get())); |
384 EXPECT_EQ("xyz.com", | 384 EXPECT_EQ("xyz.com", |
385 GetDisplayedFlashLSOs(cookies_model.get())); | 385 GetDisplayedFlashLSOs(cookies_model.get())); |
386 } | 386 } |
387 | 387 |
388 mock_browsing_data_cookie_helper_->Reset(); | 388 mock_browsing_data_cookie_helper_->Reset(); |
389 mock_browsing_data_database_helper_->Reset(); | 389 mock_browsing_data_database_helper_->Reset(); |
390 mock_browsing_data_local_storage_helper_->Reset(); | 390 mock_browsing_data_local_storage_helper_->Reset(); |
391 mock_browsing_data_session_storage_helper_->Reset(); | 391 mock_browsing_data_session_storage_helper_->Reset(); |
392 mock_browsing_data_indexed_db_helper_->Reset(); | 392 mock_browsing_data_indexed_db_helper_->Reset(); |
393 mock_browsing_data_file_system_helper_->Reset(); | 393 mock_browsing_data_file_system_helper_->Reset(); |
394 | 394 |
395 cookies_model->DeleteAllStoredObjects(); | 395 cookies_model->DeleteAllStoredObjects(); |
396 | 396 |
397 // Make sure the nodes are also deleted from the model's cache. | 397 // Make sure the nodes are also deleted from the model's cache. |
398 // http://crbug.com/43249 | 398 // http://crbug.com/43249 |
399 cookies_model->UpdateSearchResults(base::string16()); | 399 cookies_model->UpdateSearchResults(base::string16()); |
400 | 400 |
401 { | 401 { |
402 // 2 nodes - root and app | 402 // 2 nodes - root and app |
403 SCOPED_TRACE("After removing"); | 403 SCOPED_TRACE("After removing"); |
404 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 404 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
405 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); | 405 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); |
406 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); | 406 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); |
407 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); | 407 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); |
408 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); | 408 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); |
409 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); | 409 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); |
410 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); | 410 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); |
411 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); | 411 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); |
412 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); | 412 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); |
413 EXPECT_TRUE(mock_browsing_data_server_bound_cert_helper_->AllDeleted()); | 413 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); |
414 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); | 414 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 TEST_F(CookiesTreeModelTest, Remove) { | 418 TEST_F(CookiesTreeModelTest, Remove) { |
419 scoped_ptr<CookiesTreeModel> cookies_model( | 419 scoped_ptr<CookiesTreeModel> cookies_model( |
420 CreateCookiesTreeModelWithInitialSample()); | 420 CreateCookiesTreeModelWithInitialSample()); |
421 | 421 |
422 // Children start out arranged as follows: | 422 // Children start out arranged as follows: |
423 // | 423 // |
(...skipping 27 matching lines...) Expand all Loading... |
451 GetDisplayedLocalStorages(cookies_model.get())); | 451 GetDisplayedLocalStorages(cookies_model.get())); |
452 EXPECT_EQ("http://host1:1/,http://host2:2/", | 452 EXPECT_EQ("http://host1:1/,http://host2:2/", |
453 GetDisplayedSessionStorages(cookies_model.get())); | 453 GetDisplayedSessionStorages(cookies_model.get())); |
454 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 454 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
455 GetDisplayedFileSystems(cookies_model.get())); | 455 GetDisplayedFileSystems(cookies_model.get())); |
456 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 456 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
457 GetDisplayedIndexedDBs(cookies_model.get())); | 457 GetDisplayedIndexedDBs(cookies_model.get())); |
458 EXPECT_EQ("quotahost1,quotahost2", | 458 EXPECT_EQ("quotahost1,quotahost2", |
459 GetDisplayedQuotas(cookies_model.get())); | 459 GetDisplayedQuotas(cookies_model.get())); |
460 EXPECT_EQ("sbc1,sbc2", | 460 EXPECT_EQ("sbc1,sbc2", |
461 GetDisplayedServerBoundCerts(cookies_model.get())); | 461 GetDisplayedChannelIDs(cookies_model.get())); |
462 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); | 462 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); |
463 } | 463 } |
464 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); | 464 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); |
465 { | 465 { |
466 SCOPED_TRACE("`sbc2` removed."); | 466 SCOPED_TRACE("`sbc2` removed."); |
467 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 467 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
468 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 468 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
469 EXPECT_EQ("http://host1:1/,http://host2:2/", | 469 EXPECT_EQ("http://host1:1/,http://host2:2/", |
470 GetDisplayedLocalStorages(cookies_model.get())); | 470 GetDisplayedLocalStorages(cookies_model.get())); |
471 EXPECT_EQ("http://host1:1/,http://host2:2/", | 471 EXPECT_EQ("http://host1:1/,http://host2:2/", |
472 GetDisplayedSessionStorages(cookies_model.get())); | 472 GetDisplayedSessionStorages(cookies_model.get())); |
473 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 473 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
474 GetDisplayedFileSystems(cookies_model.get())); | 474 GetDisplayedFileSystems(cookies_model.get())); |
475 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 475 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
476 GetDisplayedIndexedDBs(cookies_model.get())); | 476 GetDisplayedIndexedDBs(cookies_model.get())); |
477 EXPECT_EQ("quotahost1,quotahost2", | 477 EXPECT_EQ("quotahost1,quotahost2", |
478 GetDisplayedQuotas(cookies_model.get())); | 478 GetDisplayedQuotas(cookies_model.get())); |
479 EXPECT_EQ("sbc1", | 479 EXPECT_EQ("sbc1", |
480 GetDisplayedServerBoundCerts(cookies_model.get())); | 480 GetDisplayedChannelIDs(cookies_model.get())); |
481 EXPECT_EQ(48, cookies_model->GetRoot()->GetTotalNodeCount()); | 481 EXPECT_EQ(48, cookies_model->GetRoot()->GetTotalNodeCount()); |
482 } | 482 } |
483 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); | 483 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); |
484 { | 484 { |
485 SCOPED_TRACE("`sbc1` removed."); | 485 SCOPED_TRACE("`sbc1` removed."); |
486 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 486 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
487 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 487 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
488 EXPECT_EQ("http://host1:1/,http://host2:2/", | 488 EXPECT_EQ("http://host1:1/,http://host2:2/", |
489 GetDisplayedLocalStorages(cookies_model.get())); | 489 GetDisplayedLocalStorages(cookies_model.get())); |
490 EXPECT_EQ("http://host1:1/,http://host2:2/", | 490 EXPECT_EQ("http://host1:1/,http://host2:2/", |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 693 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
694 EXPECT_EQ("http://host1:1/,http://host2:2/", | 694 EXPECT_EQ("http://host1:1/,http://host2:2/", |
695 GetDisplayedLocalStorages(cookies_model.get())); | 695 GetDisplayedLocalStorages(cookies_model.get())); |
696 EXPECT_EQ("http://host1:1/,http://host2:2/", | 696 EXPECT_EQ("http://host1:1/,http://host2:2/", |
697 GetDisplayedSessionStorages(cookies_model.get())); | 697 GetDisplayedSessionStorages(cookies_model.get())); |
698 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 698 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
699 GetDisplayedIndexedDBs(cookies_model.get())); | 699 GetDisplayedIndexedDBs(cookies_model.get())); |
700 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 700 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
701 GetDisplayedFileSystems(cookies_model.get())); | 701 GetDisplayedFileSystems(cookies_model.get())); |
702 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 702 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
703 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 703 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
704 } | 704 } |
705 | 705 |
706 DeleteStoredObjects( | 706 DeleteStoredObjects( |
707 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | 707 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); |
708 { | 708 { |
709 SCOPED_TRACE("First database removed"); | 709 SCOPED_TRACE("First database removed"); |
710 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 710 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
711 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 711 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
712 EXPECT_EQ("http://host1:1/,http://host2:2/", | 712 EXPECT_EQ("http://host1:1/,http://host2:2/", |
713 GetDisplayedLocalStorages(cookies_model.get())); | 713 GetDisplayedLocalStorages(cookies_model.get())); |
714 EXPECT_EQ("http://host1:1/,http://host2:2/", | 714 EXPECT_EQ("http://host1:1/,http://host2:2/", |
715 GetDisplayedSessionStorages(cookies_model.get())); | 715 GetDisplayedSessionStorages(cookies_model.get())); |
716 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 716 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
717 GetDisplayedIndexedDBs(cookies_model.get())); | 717 GetDisplayedIndexedDBs(cookies_model.get())); |
718 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 718 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
719 GetDisplayedFileSystems(cookies_model.get())); | 719 GetDisplayedFileSystems(cookies_model.get())); |
720 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 720 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
721 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 721 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
722 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); | 722 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); |
723 } | 723 } |
724 | 724 |
725 DeleteStoredObjects( | 725 DeleteStoredObjects( |
726 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | 726 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
727 { | 727 { |
728 SCOPED_TRACE("First origin removed"); | 728 SCOPED_TRACE("First origin removed"); |
729 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 729 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
730 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 730 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
731 EXPECT_EQ("http://host2:2/", | 731 EXPECT_EQ("http://host2:2/", |
732 GetDisplayedLocalStorages(cookies_model.get())); | 732 GetDisplayedLocalStorages(cookies_model.get())); |
733 EXPECT_EQ("http://host1:1/,http://host2:2/", | 733 EXPECT_EQ("http://host1:1/,http://host2:2/", |
734 GetDisplayedSessionStorages(cookies_model.get())); | 734 GetDisplayedSessionStorages(cookies_model.get())); |
735 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 735 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
736 GetDisplayedIndexedDBs(cookies_model.get())); | 736 GetDisplayedIndexedDBs(cookies_model.get())); |
737 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 737 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
738 GetDisplayedFileSystems(cookies_model.get())); | 738 GetDisplayedFileSystems(cookies_model.get())); |
739 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 739 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
740 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 740 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
741 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); | 741 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { | 745 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { |
746 scoped_ptr<CookiesTreeModel> cookies_model( | 746 scoped_ptr<CookiesTreeModel> cookies_model( |
747 CreateCookiesTreeModelWithInitialSample()); | 747 CreateCookiesTreeModelWithInitialSample()); |
748 | 748 |
749 DeleteStoredObjects( | 749 DeleteStoredObjects( |
750 cookies_model->GetRoot()->GetChild(1)->GetChild(0)); | 750 cookies_model->GetRoot()->GetChild(1)->GetChild(0)); |
751 { | 751 { |
752 SCOPED_TRACE("Second origin COOKIES node removed"); | 752 SCOPED_TRACE("Second origin COOKIES node removed"); |
753 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 753 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
754 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 754 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
755 EXPECT_EQ("http://host1:1/,http://host2:2/", | 755 EXPECT_EQ("http://host1:1/,http://host2:2/", |
756 GetDisplayedLocalStorages(cookies_model.get())); | 756 GetDisplayedLocalStorages(cookies_model.get())); |
757 EXPECT_EQ("http://host1:1/,http://host2:2/", | 757 EXPECT_EQ("http://host1:1/,http://host2:2/", |
758 GetDisplayedSessionStorages(cookies_model.get())); | 758 GetDisplayedSessionStorages(cookies_model.get())); |
759 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 759 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
760 GetDisplayedIndexedDBs(cookies_model.get())); | 760 GetDisplayedIndexedDBs(cookies_model.get())); |
761 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 761 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
762 GetDisplayedFileSystems(cookies_model.get())); | 762 GetDisplayedFileSystems(cookies_model.get())); |
763 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 763 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
764 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 764 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
765 // 51 because in this case, the origin remains, although the COOKIES | 765 // 51 because in this case, the origin remains, although the COOKIES |
766 // node beneath it has been deleted. | 766 // node beneath it has been deleted. |
767 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); | 767 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); |
768 } | 768 } |
769 | 769 |
770 DeleteStoredObjects( | 770 DeleteStoredObjects( |
771 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | 771 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); |
772 { | 772 { |
773 SCOPED_TRACE("First database removed"); | 773 SCOPED_TRACE("First database removed"); |
774 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 774 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
775 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 775 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
776 EXPECT_EQ("http://host1:1/,http://host2:2/", | 776 EXPECT_EQ("http://host1:1/,http://host2:2/", |
777 GetDisplayedLocalStorages(cookies_model.get())); | 777 GetDisplayedLocalStorages(cookies_model.get())); |
778 EXPECT_EQ("http://host1:1/,http://host2:2/", | 778 EXPECT_EQ("http://host1:1/,http://host2:2/", |
779 GetDisplayedSessionStorages(cookies_model.get())); | 779 GetDisplayedSessionStorages(cookies_model.get())); |
780 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 780 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
781 GetDisplayedIndexedDBs(cookies_model.get())); | 781 GetDisplayedIndexedDBs(cookies_model.get())); |
782 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 782 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
783 GetDisplayedFileSystems(cookies_model.get())); | 783 GetDisplayedFileSystems(cookies_model.get())); |
784 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 784 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
785 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 785 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
786 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); | 786 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); |
787 } | 787 } |
788 | 788 |
789 DeleteStoredObjects( | 789 DeleteStoredObjects( |
790 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | 790 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
791 { | 791 { |
792 SCOPED_TRACE("First origin removed"); | 792 SCOPED_TRACE("First origin removed"); |
793 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 793 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
794 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 794 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
795 EXPECT_EQ("http://host2:2/", | 795 EXPECT_EQ("http://host2:2/", |
796 GetDisplayedLocalStorages(cookies_model.get())); | 796 GetDisplayedLocalStorages(cookies_model.get())); |
797 EXPECT_EQ("http://host1:1/,http://host2:2/", | 797 EXPECT_EQ("http://host1:1/,http://host2:2/", |
798 GetDisplayedSessionStorages(cookies_model.get())); | 798 GetDisplayedSessionStorages(cookies_model.get())); |
799 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 799 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
800 GetDisplayedIndexedDBs(cookies_model.get())); | 800 GetDisplayedIndexedDBs(cookies_model.get())); |
801 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 801 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
802 GetDisplayedFileSystems(cookies_model.get())); | 802 GetDisplayedFileSystems(cookies_model.get())); |
803 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 803 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
804 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 804 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
805 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); | 805 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); |
806 } | 806 } |
807 } | 807 } |
808 | 808 |
809 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { | 809 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { |
810 LocalDataContainer* container = | 810 LocalDataContainer* container = |
811 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 811 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
812 mock_browsing_data_database_helper_.get(), | 812 mock_browsing_data_database_helper_.get(), |
813 mock_browsing_data_local_storage_helper_.get(), | 813 mock_browsing_data_local_storage_helper_.get(), |
814 mock_browsing_data_session_storage_helper_.get(), | 814 mock_browsing_data_session_storage_helper_.get(), |
815 mock_browsing_data_appcache_helper_.get(), | 815 mock_browsing_data_appcache_helper_.get(), |
816 mock_browsing_data_indexed_db_helper_.get(), | 816 mock_browsing_data_indexed_db_helper_.get(), |
817 mock_browsing_data_file_system_helper_.get(), | 817 mock_browsing_data_file_system_helper_.get(), |
818 mock_browsing_data_quota_helper_.get(), | 818 mock_browsing_data_quota_helper_.get(), |
819 mock_browsing_data_server_bound_cert_helper_.get(), | 819 mock_browsing_data_channel_id_helper_.get(), |
820 mock_browsing_data_flash_lso_helper_.get()); | 820 mock_browsing_data_flash_lso_helper_.get()); |
821 CookiesTreeModel cookies_model( | 821 CookiesTreeModel cookies_model( |
822 container, special_storage_policy_.get(), false); | 822 container, special_storage_policy_.get(), false); |
823 | 823 |
824 mock_browsing_data_cookie_helper_-> | 824 mock_browsing_data_cookie_helper_-> |
825 AddCookieSamples(GURL("http://foo1"), "A=1"); | 825 AddCookieSamples(GURL("http://foo1"), "A=1"); |
826 mock_browsing_data_cookie_helper_-> | 826 mock_browsing_data_cookie_helper_-> |
827 AddCookieSamples(GURL("http://foo2"), "B=1"); | 827 AddCookieSamples(GURL("http://foo2"), "B=1"); |
828 mock_browsing_data_cookie_helper_-> | 828 mock_browsing_data_cookie_helper_-> |
829 AddCookieSamples(GURL("http://foo3"), "C=1"); | 829 AddCookieSamples(GURL("http://foo3"), "C=1"); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { | 898 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { |
899 LocalDataContainer* container = | 899 LocalDataContainer* container = |
900 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 900 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
901 mock_browsing_data_database_helper_.get(), | 901 mock_browsing_data_database_helper_.get(), |
902 mock_browsing_data_local_storage_helper_.get(), | 902 mock_browsing_data_local_storage_helper_.get(), |
903 mock_browsing_data_session_storage_helper_.get(), | 903 mock_browsing_data_session_storage_helper_.get(), |
904 mock_browsing_data_appcache_helper_.get(), | 904 mock_browsing_data_appcache_helper_.get(), |
905 mock_browsing_data_indexed_db_helper_.get(), | 905 mock_browsing_data_indexed_db_helper_.get(), |
906 mock_browsing_data_file_system_helper_.get(), | 906 mock_browsing_data_file_system_helper_.get(), |
907 mock_browsing_data_quota_helper_.get(), | 907 mock_browsing_data_quota_helper_.get(), |
908 mock_browsing_data_server_bound_cert_helper_.get(), | 908 mock_browsing_data_channel_id_helper_.get(), |
909 mock_browsing_data_flash_lso_helper_.get()); | 909 mock_browsing_data_flash_lso_helper_.get()); |
910 CookiesTreeModel cookies_model( | 910 CookiesTreeModel cookies_model( |
911 container, special_storage_policy_.get(), false); | 911 container, special_storage_policy_.get(), false); |
912 | 912 |
913 mock_browsing_data_cookie_helper_-> | 913 mock_browsing_data_cookie_helper_-> |
914 AddCookieSamples(GURL("http://foo1"), "A=1"); | 914 AddCookieSamples(GURL("http://foo1"), "A=1"); |
915 mock_browsing_data_cookie_helper_-> | 915 mock_browsing_data_cookie_helper_-> |
916 AddCookieSamples(GURL("http://foo2"), "B=1"); | 916 AddCookieSamples(GURL("http://foo2"), "B=1"); |
917 mock_browsing_data_cookie_helper_-> | 917 mock_browsing_data_cookie_helper_-> |
918 AddCookieSamples(GURL("http://foo3"), "C=1"); | 918 AddCookieSamples(GURL("http://foo3"), "C=1"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 990 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
991 LocalDataContainer* container = | 991 LocalDataContainer* container = |
992 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 992 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
993 mock_browsing_data_database_helper_.get(), | 993 mock_browsing_data_database_helper_.get(), |
994 mock_browsing_data_local_storage_helper_.get(), | 994 mock_browsing_data_local_storage_helper_.get(), |
995 mock_browsing_data_session_storage_helper_.get(), | 995 mock_browsing_data_session_storage_helper_.get(), |
996 mock_browsing_data_appcache_helper_.get(), | 996 mock_browsing_data_appcache_helper_.get(), |
997 mock_browsing_data_indexed_db_helper_.get(), | 997 mock_browsing_data_indexed_db_helper_.get(), |
998 mock_browsing_data_file_system_helper_.get(), | 998 mock_browsing_data_file_system_helper_.get(), |
999 mock_browsing_data_quota_helper_.get(), | 999 mock_browsing_data_quota_helper_.get(), |
1000 mock_browsing_data_server_bound_cert_helper_.get(), | 1000 mock_browsing_data_channel_id_helper_.get(), |
1001 mock_browsing_data_flash_lso_helper_.get()); | 1001 mock_browsing_data_flash_lso_helper_.get()); |
1002 CookiesTreeModel cookies_model( | 1002 CookiesTreeModel cookies_model( |
1003 container, special_storage_policy_.get(), false); | 1003 container, special_storage_policy_.get(), false); |
1004 | 1004 |
1005 mock_browsing_data_cookie_helper_-> | 1005 mock_browsing_data_cookie_helper_-> |
1006 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1006 AddCookieSamples(GURL("http://foo1"), "A=1"); |
1007 mock_browsing_data_cookie_helper_-> | 1007 mock_browsing_data_cookie_helper_-> |
1008 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1008 AddCookieSamples(GURL("http://foo2"), "B=1"); |
1009 mock_browsing_data_cookie_helper_-> | 1009 mock_browsing_data_cookie_helper_-> |
1010 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1010 AddCookieSamples(GURL("http://foo3"), "C=1"); |
(...skipping 22 matching lines...) Expand all Loading... |
1033 TEST_F(CookiesTreeModelTest, OriginOrdering) { | 1033 TEST_F(CookiesTreeModelTest, OriginOrdering) { |
1034 LocalDataContainer* container = | 1034 LocalDataContainer* container = |
1035 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1035 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1036 mock_browsing_data_database_helper_.get(), | 1036 mock_browsing_data_database_helper_.get(), |
1037 mock_browsing_data_local_storage_helper_.get(), | 1037 mock_browsing_data_local_storage_helper_.get(), |
1038 mock_browsing_data_session_storage_helper_.get(), | 1038 mock_browsing_data_session_storage_helper_.get(), |
1039 mock_browsing_data_appcache_helper_.get(), | 1039 mock_browsing_data_appcache_helper_.get(), |
1040 mock_browsing_data_indexed_db_helper_.get(), | 1040 mock_browsing_data_indexed_db_helper_.get(), |
1041 mock_browsing_data_file_system_helper_.get(), | 1041 mock_browsing_data_file_system_helper_.get(), |
1042 mock_browsing_data_quota_helper_.get(), | 1042 mock_browsing_data_quota_helper_.get(), |
1043 mock_browsing_data_server_bound_cert_helper_.get(), | 1043 mock_browsing_data_channel_id_helper_.get(), |
1044 mock_browsing_data_flash_lso_helper_.get()); | 1044 mock_browsing_data_flash_lso_helper_.get()); |
1045 CookiesTreeModel cookies_model( | 1045 CookiesTreeModel cookies_model( |
1046 container, special_storage_policy_.get(), false); | 1046 container, special_storage_policy_.get(), false); |
1047 | 1047 |
1048 mock_browsing_data_cookie_helper_-> | 1048 mock_browsing_data_cookie_helper_-> |
1049 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); | 1049 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); |
1050 mock_browsing_data_cookie_helper_-> | 1050 mock_browsing_data_cookie_helper_-> |
1051 AddCookieSamples(GURL("http://foo2.com"), "B=1"); | 1051 AddCookieSamples(GURL("http://foo2.com"), "B=1"); |
1052 mock_browsing_data_cookie_helper_-> | 1052 mock_browsing_data_cookie_helper_-> |
1053 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); | 1053 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); |
(...skipping 27 matching lines...) Expand all Loading... |
1081 GURL host("http://xyz.com/"); | 1081 GURL host("http://xyz.com/"); |
1082 LocalDataContainer* container = | 1082 LocalDataContainer* container = |
1083 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1083 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1084 mock_browsing_data_database_helper_.get(), | 1084 mock_browsing_data_database_helper_.get(), |
1085 mock_browsing_data_local_storage_helper_.get(), | 1085 mock_browsing_data_local_storage_helper_.get(), |
1086 mock_browsing_data_session_storage_helper_.get(), | 1086 mock_browsing_data_session_storage_helper_.get(), |
1087 mock_browsing_data_appcache_helper_.get(), | 1087 mock_browsing_data_appcache_helper_.get(), |
1088 mock_browsing_data_indexed_db_helper_.get(), | 1088 mock_browsing_data_indexed_db_helper_.get(), |
1089 mock_browsing_data_file_system_helper_.get(), | 1089 mock_browsing_data_file_system_helper_.get(), |
1090 mock_browsing_data_quota_helper_.get(), | 1090 mock_browsing_data_quota_helper_.get(), |
1091 mock_browsing_data_server_bound_cert_helper_.get(), | 1091 mock_browsing_data_channel_id_helper_.get(), |
1092 mock_browsing_data_flash_lso_helper_.get()); | 1092 mock_browsing_data_flash_lso_helper_.get()); |
1093 CookiesTreeModel cookies_model( | 1093 CookiesTreeModel cookies_model( |
1094 container, special_storage_policy_.get(), false); | 1094 container, special_storage_policy_.get(), false); |
1095 | 1095 |
1096 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); | 1096 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); |
1097 mock_browsing_data_cookie_helper_->Notify(); | 1097 mock_browsing_data_cookie_helper_->Notify(); |
1098 | 1098 |
1099 TestingProfile profile; | 1099 TestingProfile profile; |
1100 HostContentSettingsMap* content_settings = | 1100 HostContentSettingsMap* content_settings = |
1101 profile.GetHostContentSettingsMap(); | 1101 profile.GetHostContentSettingsMap(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 TEST_F(CookiesTreeModelTest, CookiesFilter) { | 1155 TEST_F(CookiesTreeModelTest, CookiesFilter) { |
1156 LocalDataContainer* container = | 1156 LocalDataContainer* container = |
1157 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1157 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1158 mock_browsing_data_database_helper_.get(), | 1158 mock_browsing_data_database_helper_.get(), |
1159 mock_browsing_data_local_storage_helper_.get(), | 1159 mock_browsing_data_local_storage_helper_.get(), |
1160 mock_browsing_data_session_storage_helper_.get(), | 1160 mock_browsing_data_session_storage_helper_.get(), |
1161 mock_browsing_data_appcache_helper_.get(), | 1161 mock_browsing_data_appcache_helper_.get(), |
1162 mock_browsing_data_indexed_db_helper_.get(), | 1162 mock_browsing_data_indexed_db_helper_.get(), |
1163 mock_browsing_data_file_system_helper_.get(), | 1163 mock_browsing_data_file_system_helper_.get(), |
1164 mock_browsing_data_quota_helper_.get(), | 1164 mock_browsing_data_quota_helper_.get(), |
1165 mock_browsing_data_server_bound_cert_helper_.get(), | 1165 mock_browsing_data_channel_id_helper_.get(), |
1166 mock_browsing_data_flash_lso_helper_.get()); | 1166 mock_browsing_data_flash_lso_helper_.get()); |
1167 CookiesTreeModel cookies_model( | 1167 CookiesTreeModel cookies_model( |
1168 container, special_storage_policy_.get(), false); | 1168 container, special_storage_policy_.get(), false); |
1169 | 1169 |
1170 mock_browsing_data_cookie_helper_-> | 1170 mock_browsing_data_cookie_helper_-> |
1171 AddCookieSamples(GURL("http://123.com"), "A=1"); | 1171 AddCookieSamples(GURL("http://123.com"), "A=1"); |
1172 mock_browsing_data_cookie_helper_-> | 1172 mock_browsing_data_cookie_helper_-> |
1173 AddCookieSamples(GURL("http://foo1.com"), "B=1"); | 1173 AddCookieSamples(GURL("http://foo1.com"), "B=1"); |
1174 mock_browsing_data_cookie_helper_-> | 1174 mock_browsing_data_cookie_helper_-> |
1175 AddCookieSamples(GURL("http://foo2.com"), "C=1"); | 1175 AddCookieSamples(GURL("http://foo2.com"), "C=1"); |
1176 mock_browsing_data_cookie_helper_-> | 1176 mock_browsing_data_cookie_helper_-> |
1177 AddCookieSamples(GURL("http://foo3.com"), "D=1"); | 1177 AddCookieSamples(GURL("http://foo3.com"), "D=1"); |
1178 mock_browsing_data_cookie_helper_->Notify(); | 1178 mock_browsing_data_cookie_helper_->Notify(); |
1179 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1179 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1180 | 1180 |
1181 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo"))); | 1181 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo"))); |
1182 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); | 1182 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); |
1183 | 1183 |
1184 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("2"))); | 1184 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("2"))); |
1185 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1185 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
1186 | 1186 |
1187 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); | 1187 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); |
1188 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1188 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
1189 | 1189 |
1190 cookies_model.UpdateSearchResults(base::string16()); | 1190 cookies_model.UpdateSearchResults(base::string16()); |
1191 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1191 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1192 } | 1192 } |
1193 | 1193 |
1194 } // namespace | 1194 } // namespace |
OLD | NEW |