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 "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_channel_id_helper.h" | 14 #include "chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h" |
14 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" | 15 #include "chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h" |
15 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" | 16 #include "chrome/browser/browsing_data/mock_browsing_data_database_helper.h" |
16 #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" |
17 #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" |
18 #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" |
19 #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
" |
20 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" | 21 #include "chrome/browser/browsing_data/mock_browsing_data_quota_helper.h" |
21 #include "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.
h" | 22 #include "chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.
h" |
22 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 23 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 mock_browsing_data_indexed_db_helper_ = | 68 mock_browsing_data_indexed_db_helper_ = |
68 new MockBrowsingDataIndexedDBHelper(profile_.get()); | 69 new MockBrowsingDataIndexedDBHelper(profile_.get()); |
69 mock_browsing_data_file_system_helper_ = | 70 mock_browsing_data_file_system_helper_ = |
70 new MockBrowsingDataFileSystemHelper(profile_.get()); | 71 new MockBrowsingDataFileSystemHelper(profile_.get()); |
71 mock_browsing_data_quota_helper_ = | 72 mock_browsing_data_quota_helper_ = |
72 new MockBrowsingDataQuotaHelper(profile_.get()); | 73 new MockBrowsingDataQuotaHelper(profile_.get()); |
73 mock_browsing_data_channel_id_helper_ = | 74 mock_browsing_data_channel_id_helper_ = |
74 new MockBrowsingDataChannelIDHelper(); | 75 new MockBrowsingDataChannelIDHelper(); |
75 mock_browsing_data_service_worker_helper_ = | 76 mock_browsing_data_service_worker_helper_ = |
76 new MockBrowsingDataServiceWorkerHelper(profile_.get()); | 77 new MockBrowsingDataServiceWorkerHelper(profile_.get()); |
| 78 mock_browsing_data_cache_storage_helper_ = |
| 79 new MockBrowsingDataCacheStorageHelper(profile_.get()); |
77 mock_browsing_data_flash_lso_helper_ = | 80 mock_browsing_data_flash_lso_helper_ = |
78 new MockBrowsingDataFlashLSOHelper(profile_.get()); | 81 new MockBrowsingDataFlashLSOHelper(profile_.get()); |
79 | 82 |
80 const char kExtensionScheme[] = "extensionscheme"; | 83 const char kExtensionScheme[] = "extensionscheme"; |
81 scoped_refptr<content_settings::CookieSettings> cookie_settings = | 84 scoped_refptr<content_settings::CookieSettings> cookie_settings = |
82 new content_settings::CookieSettings( | 85 new content_settings::CookieSettings( |
83 profile_->GetHostContentSettingsMap(), profile_->GetPrefs(), | 86 profile_->GetHostContentSettingsMap(), profile_->GetPrefs(), |
84 kExtensionScheme); | 87 kExtensionScheme); |
85 #if defined(ENABLE_EXTENSIONS) | 88 #if defined(ENABLE_EXTENSIONS) |
86 special_storage_policy_ = | 89 special_storage_policy_ = |
87 new ExtensionSpecialStoragePolicy(cookie_settings.get()); | 90 new ExtensionSpecialStoragePolicy(cookie_settings.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; |
| 96 mock_browsing_data_cache_storage_helper_ = nullptr; |
93 mock_browsing_data_channel_id_helper_ = nullptr; | 97 mock_browsing_data_channel_id_helper_ = nullptr; |
94 mock_browsing_data_quota_helper_ = nullptr; | 98 mock_browsing_data_quota_helper_ = nullptr; |
95 mock_browsing_data_file_system_helper_ = nullptr; | 99 mock_browsing_data_file_system_helper_ = nullptr; |
96 mock_browsing_data_indexed_db_helper_ = nullptr; | 100 mock_browsing_data_indexed_db_helper_ = nullptr; |
97 mock_browsing_data_appcache_helper_ = nullptr; | 101 mock_browsing_data_appcache_helper_ = nullptr; |
98 mock_browsing_data_session_storage_helper_ = nullptr; | 102 mock_browsing_data_session_storage_helper_ = nullptr; |
99 mock_browsing_data_local_storage_helper_ = nullptr; | 103 mock_browsing_data_local_storage_helper_ = nullptr; |
100 mock_browsing_data_database_helper_ = nullptr; | 104 mock_browsing_data_database_helper_ = nullptr; |
101 mock_browsing_data_flash_lso_helper_ = nullptr; | 105 mock_browsing_data_flash_lso_helper_ = nullptr; |
102 base::MessageLoop::current()->RunUntilIdle(); | 106 base::MessageLoop::current()->RunUntilIdle(); |
103 } | 107 } |
104 | 108 |
105 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { | 109 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { |
106 LocalDataContainer* container = new LocalDataContainer( | 110 LocalDataContainer* container = |
107 mock_browsing_data_cookie_helper_.get(), | 111 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
108 mock_browsing_data_database_helper_.get(), | 112 mock_browsing_data_database_helper_.get(), |
109 mock_browsing_data_local_storage_helper_.get(), | 113 mock_browsing_data_local_storage_helper_.get(), |
110 mock_browsing_data_session_storage_helper_.get(), | 114 mock_browsing_data_session_storage_helper_.get(), |
111 mock_browsing_data_appcache_helper_.get(), | 115 mock_browsing_data_appcache_helper_.get(), |
112 mock_browsing_data_indexed_db_helper_.get(), | 116 mock_browsing_data_indexed_db_helper_.get(), |
113 mock_browsing_data_file_system_helper_.get(), | 117 mock_browsing_data_file_system_helper_.get(), |
114 mock_browsing_data_quota_helper_.get(), | 118 mock_browsing_data_quota_helper_.get(), |
115 mock_browsing_data_channel_id_helper_.get(), | 119 mock_browsing_data_channel_id_helper_.get(), |
116 mock_browsing_data_service_worker_helper_.get(), | 120 mock_browsing_data_service_worker_helper_.get(), |
117 mock_browsing_data_flash_lso_helper_.get()); | 121 mock_browsing_data_cache_storage_helper_.get(), |
| 122 mock_browsing_data_flash_lso_helper_.get()); |
118 | 123 |
119 CookiesTreeModel* cookies_model = | 124 CookiesTreeModel* cookies_model = |
120 new CookiesTreeModel(container, special_storage_policy(), false); | 125 new CookiesTreeModel(container, special_storage_policy(), false); |
121 mock_browsing_data_cookie_helper_-> | 126 mock_browsing_data_cookie_helper_-> |
122 AddCookieSamples(GURL("http://foo1"), "A=1"); | 127 AddCookieSamples(GURL("http://foo1"), "A=1"); |
123 mock_browsing_data_cookie_helper_-> | 128 mock_browsing_data_cookie_helper_-> |
124 AddCookieSamples(GURL("http://foo2"), "B=1"); | 129 AddCookieSamples(GURL("http://foo2"), "B=1"); |
125 mock_browsing_data_cookie_helper_-> | 130 mock_browsing_data_cookie_helper_-> |
126 AddCookieSamples(GURL("http://foo3"), "C=1"); | 131 AddCookieSamples(GURL("http://foo3"), "C=1"); |
127 mock_browsing_data_cookie_helper_->Notify(); | 132 mock_browsing_data_cookie_helper_->Notify(); |
128 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 133 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
129 mock_browsing_data_database_helper_->Notify(); | 134 mock_browsing_data_database_helper_->Notify(); |
130 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 135 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
131 mock_browsing_data_local_storage_helper_->Notify(); | 136 mock_browsing_data_local_storage_helper_->Notify(); |
132 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 137 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
133 mock_browsing_data_session_storage_helper_->Notify(); | 138 mock_browsing_data_session_storage_helper_->Notify(); |
134 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 139 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
135 mock_browsing_data_indexed_db_helper_->Notify(); | 140 mock_browsing_data_indexed_db_helper_->Notify(); |
136 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 141 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
137 mock_browsing_data_file_system_helper_->Notify(); | 142 mock_browsing_data_file_system_helper_->Notify(); |
138 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 143 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
139 mock_browsing_data_quota_helper_->Notify(); | 144 mock_browsing_data_quota_helper_->Notify(); |
140 mock_browsing_data_channel_id_helper_->AddChannelIDSample( | 145 mock_browsing_data_channel_id_helper_->AddChannelIDSample( |
141 "sbc1"); | 146 "sbc1"); |
142 mock_browsing_data_channel_id_helper_->AddChannelIDSample( | 147 mock_browsing_data_channel_id_helper_->AddChannelIDSample( |
143 "sbc2"); | 148 "sbc2"); |
144 mock_browsing_data_channel_id_helper_->Notify(); | 149 mock_browsing_data_channel_id_helper_->Notify(); |
145 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); | 150 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); |
146 mock_browsing_data_service_worker_helper_->Notify(); | 151 mock_browsing_data_service_worker_helper_->Notify(); |
| 152 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); |
| 153 mock_browsing_data_cache_storage_helper_->Notify(); |
147 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); | 154 mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); |
148 mock_browsing_data_flash_lso_helper_->Notify(); | 155 mock_browsing_data_flash_lso_helper_->Notify(); |
149 | 156 |
150 { | 157 { |
151 SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " | 158 SCOPED_TRACE( |
152 "2 session storages, 2 indexed DBs, 3 filesystems, " | 159 "Initial State 3 cookies, 2 databases, 2 local storages, " |
153 "2 quotas, 2 server bound certs, 2 service workers, " | 160 "2 session storages, 2 indexed DBs, 3 filesystems, " |
154 "1 Flash LSO"); | 161 "2 quotas, 2 server bound certs, 2 service workers, " |
155 // 59 because there's the root, then | 162 "2 cache storages, 1 Flash LSO"); |
| 163 // 65 because there's the root, then |
| 164 // cshost1 -> cache storage -> https://cshost1:1/ |
| 165 // cshost2 -> cache storage -> https://cshost2:2/ |
156 // foo1 -> cookies -> a, | 166 // foo1 -> cookies -> a, |
157 // foo2 -> cookies -> b, | 167 // foo2 -> cookies -> b, |
158 // foo3 -> cookies -> c, | 168 // foo3 -> cookies -> c, |
159 // dbhost1 -> database -> db1, | 169 // dbhost1 -> database -> db1, |
160 // dbhost2 -> database -> db2, | 170 // dbhost2 -> database -> db2, |
161 // host1 -> localstorage -> http://host1:1/, | 171 // host1 -> localstorage -> http://host1:1/, |
162 // -> sessionstorage -> http://host1:1/, | 172 // -> sessionstorage -> http://host1:1/, |
163 // host2 -> localstorage -> http://host2:2/. | 173 // host2 -> localstorage -> http://host2:2/. |
164 // -> sessionstorage -> http://host2:2/, | 174 // -> sessionstorage -> http://host2:2/, |
165 // idbhost1 -> indexeddb -> http://idbhost1:1/, | 175 // idbhost1 -> indexeddb -> http://idbhost1:1/, |
166 // idbhost2 -> indexeddb -> http://idbhost2:2/, | 176 // idbhost2 -> indexeddb -> http://idbhost2:2/, |
167 // fshost1 -> filesystem -> http://fshost1:1/, | 177 // fshost1 -> filesystem -> http://fshost1:1/, |
168 // fshost2 -> filesystem -> http://fshost2:1/, | 178 // fshost2 -> filesystem -> http://fshost2:1/, |
169 // fshost3 -> filesystem -> http://fshost3:1/, | 179 // fshost3 -> filesystem -> http://fshost3:1/, |
170 // quotahost1 -> quotahost1, | 180 // quotahost1 -> quotahost1, |
171 // quotahost2 -> quotahost2, | 181 // quotahost2 -> quotahost2, |
172 // sbc1 -> sbcerts -> sbc1, | 182 // sbc1 -> sbcerts -> sbc1, |
173 // sbc2 -> sbcerts -> sbc2. | 183 // sbc2 -> sbcerts -> sbc2. |
174 // swhost1 -> service worker -> https://swhost1:1 | 184 // swhost1 -> service worker -> https://swhost1:1 |
175 // swhost2 -> service worker -> https://swhost1:2 | 185 // swhost2 -> service worker -> https://swhost1:2 |
176 // xyz.com -> flash_lsos | 186 // xyz.com -> flash_lsos |
177 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); | 187 EXPECT_EQ(65, cookies_model->GetRoot()->GetTotalNodeCount()); |
178 EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); | 188 EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); |
179 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); | 189 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); |
180 EXPECT_EQ("http://host1:1/,http://host2:2/", | 190 EXPECT_EQ("http://host1:1/,http://host2:2/", |
181 GetDisplayedLocalStorages(cookies_model)); | 191 GetDisplayedLocalStorages(cookies_model)); |
182 EXPECT_EQ("http://host1:1/,http://host2:2/", | 192 EXPECT_EQ("http://host1:1/,http://host2:2/", |
183 GetDisplayedSessionStorages(cookies_model)); | 193 GetDisplayedSessionStorages(cookies_model)); |
184 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 194 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
185 GetDisplayedIndexedDBs(cookies_model)); | 195 GetDisplayedIndexedDBs(cookies_model)); |
186 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 196 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
187 GetDisplayedFileSystems(cookies_model)); | 197 GetDisplayedFileSystems(cookies_model)); |
188 EXPECT_EQ("quotahost1,quotahost2", | 198 EXPECT_EQ("quotahost1,quotahost2", |
189 GetDisplayedQuotas(cookies_model)); | 199 GetDisplayedQuotas(cookies_model)); |
190 EXPECT_EQ("sbc1,sbc2", | 200 EXPECT_EQ("sbc1,sbc2", |
191 GetDisplayedChannelIDs(cookies_model)); | 201 GetDisplayedChannelIDs(cookies_model)); |
192 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 202 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
193 GetDisplayedServiceWorkers(cookies_model)); | 203 GetDisplayedServiceWorkers(cookies_model)); |
| 204 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 205 GetDisplayedCacheStorages(cookies_model)); |
194 EXPECT_EQ("xyz.com", | 206 EXPECT_EQ("xyz.com", |
195 GetDisplayedFlashLSOs(cookies_model)); | 207 GetDisplayedFlashLSOs(cookies_model)); |
196 } | 208 } |
197 return make_scoped_ptr(cookies_model); | 209 return make_scoped_ptr(cookies_model); |
198 } | 210 } |
199 | 211 |
200 std::string GetNodesOfChildren( | 212 std::string GetNodesOfChildren( |
201 const CookieTreeNode* node, | 213 const CookieTreeNode* node, |
202 CookieTreeNode::DetailedInfo::NodeType node_type) { | 214 CookieTreeNode::DetailedInfo::NodeType node_type) { |
203 if (!node->empty()) { | 215 if (!node->empty()) { |
(...skipping 26 matching lines...) Expand all Loading... |
230 ","; | 242 ","; |
231 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 243 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
232 return node->GetDetailedInfo().file_system_info->origin.spec() + | 244 return node->GetDetailedInfo().file_system_info->origin.spec() + |
233 ","; | 245 ","; |
234 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 246 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
235 return node->GetDetailedInfo().quota_info->host + ","; | 247 return node->GetDetailedInfo().quota_info->host + ","; |
236 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: | 248 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
237 return node->GetDetailedInfo().channel_id->server_identifier() + ","; | 249 return node->GetDetailedInfo().channel_id->server_identifier() + ","; |
238 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: | 250 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: |
239 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; | 251 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; |
| 252 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: |
| 253 return node->GetDetailedInfo().cache_storage_info->origin.spec() + ","; |
240 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: | 254 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: |
241 return node->GetDetailedInfo().flash_lso_domain + ","; | 255 return node->GetDetailedInfo().flash_lso_domain + ","; |
242 default: | 256 default: |
243 return std::string(); | 257 return std::string(); |
244 } | 258 } |
245 } | 259 } |
246 | 260 |
247 std::string GetCookiesOfChildren(const CookieTreeNode* node) { | 261 std::string GetCookiesOfChildren(const CookieTreeNode* node) { |
248 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); | 262 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); |
249 } | 263 } |
(...skipping 26 matching lines...) Expand all Loading... |
276 std::string GetFileQuotaOfChildren(const CookieTreeNode* node) { | 290 std::string GetFileQuotaOfChildren(const CookieTreeNode* node) { |
277 return GetNodesOfChildren( | 291 return GetNodesOfChildren( |
278 node, CookieTreeNode::DetailedInfo::TYPE_QUOTA); | 292 node, CookieTreeNode::DetailedInfo::TYPE_QUOTA); |
279 } | 293 } |
280 | 294 |
281 std::string GetServiceWorkersOfChildren(const CookieTreeNode* node) { | 295 std::string GetServiceWorkersOfChildren(const CookieTreeNode* node) { |
282 return GetNodesOfChildren( | 296 return GetNodesOfChildren( |
283 node, CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); | 297 node, CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); |
284 } | 298 } |
285 | 299 |
| 300 std::string GetCacheStoragesOfChildren(const CookieTreeNode* node) { |
| 301 return GetNodesOfChildren(node, |
| 302 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); |
| 303 } |
| 304 |
286 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) { | 305 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) { |
287 return GetNodesOfChildren( | 306 return GetNodesOfChildren( |
288 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); | 307 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); |
289 } | 308 } |
290 | 309 |
291 // Get the nodes names displayed in the view (if we had one) in the order | 310 // Get the nodes names displayed in the view (if we had one) in the order |
292 // they are displayed, as a comma seperated string. | 311 // they are displayed, as a comma seperated string. |
293 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); | 312 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); |
294 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model, | 313 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model, |
295 CookieTreeNode::DetailedInfo::NodeType type) { | 314 CookieTreeNode::DetailedInfo::NodeType type) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 std::string GetDisplayedChannelIDs(CookiesTreeModel* cookies_model) { | 363 std::string GetDisplayedChannelIDs(CookiesTreeModel* cookies_model) { |
345 return GetDisplayedNodes( | 364 return GetDisplayedNodes( |
346 cookies_model, CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID); | 365 cookies_model, CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID); |
347 } | 366 } |
348 | 367 |
349 std::string GetDisplayedServiceWorkers(CookiesTreeModel* cookies_model) { | 368 std::string GetDisplayedServiceWorkers(CookiesTreeModel* cookies_model) { |
350 return GetDisplayedNodes(cookies_model, | 369 return GetDisplayedNodes(cookies_model, |
351 CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); | 370 CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); |
352 } | 371 } |
353 | 372 |
| 373 std::string GetDisplayedCacheStorages(CookiesTreeModel* cookies_model) { |
| 374 return GetDisplayedNodes(cookies_model, |
| 375 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); |
| 376 } |
| 377 |
354 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { | 378 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { |
355 return GetDisplayedNodes( | 379 return GetDisplayedNodes( |
356 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); | 380 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); |
357 } | 381 } |
358 | 382 |
359 // Do not call on the root. | 383 // Do not call on the root. |
360 void DeleteStoredObjects(CookieTreeNode* node) { | 384 void DeleteStoredObjects(CookieTreeNode* node) { |
361 node->DeleteStoredObjects(); | 385 node->DeleteStoredObjects(); |
362 CookieTreeNode* parent_node = node->parent(); | 386 CookieTreeNode* parent_node = node->parent(); |
363 DCHECK(parent_node); | 387 DCHECK(parent_node); |
(...skipping 24 matching lines...) Expand all Loading... |
388 scoped_refptr<MockBrowsingDataIndexedDBHelper> | 412 scoped_refptr<MockBrowsingDataIndexedDBHelper> |
389 mock_browsing_data_indexed_db_helper_; | 413 mock_browsing_data_indexed_db_helper_; |
390 scoped_refptr<MockBrowsingDataFileSystemHelper> | 414 scoped_refptr<MockBrowsingDataFileSystemHelper> |
391 mock_browsing_data_file_system_helper_; | 415 mock_browsing_data_file_system_helper_; |
392 scoped_refptr<MockBrowsingDataQuotaHelper> | 416 scoped_refptr<MockBrowsingDataQuotaHelper> |
393 mock_browsing_data_quota_helper_; | 417 mock_browsing_data_quota_helper_; |
394 scoped_refptr<MockBrowsingDataChannelIDHelper> | 418 scoped_refptr<MockBrowsingDataChannelIDHelper> |
395 mock_browsing_data_channel_id_helper_; | 419 mock_browsing_data_channel_id_helper_; |
396 scoped_refptr<MockBrowsingDataServiceWorkerHelper> | 420 scoped_refptr<MockBrowsingDataServiceWorkerHelper> |
397 mock_browsing_data_service_worker_helper_; | 421 mock_browsing_data_service_worker_helper_; |
| 422 scoped_refptr<MockBrowsingDataCacheStorageHelper> |
| 423 mock_browsing_data_cache_storage_helper_; |
398 scoped_refptr<MockBrowsingDataFlashLSOHelper> | 424 scoped_refptr<MockBrowsingDataFlashLSOHelper> |
399 mock_browsing_data_flash_lso_helper_; | 425 mock_browsing_data_flash_lso_helper_; |
400 | 426 |
401 #if defined(ENABLE_EXTENSIONS) | 427 #if defined(ENABLE_EXTENSIONS) |
402 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; | 428 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
403 #endif | 429 #endif |
404 }; | 430 }; |
405 | 431 |
406 TEST_F(CookiesTreeModelTest, RemoveAll) { | 432 TEST_F(CookiesTreeModelTest, RemoveAll) { |
407 scoped_ptr<CookiesTreeModel> cookies_model( | 433 scoped_ptr<CookiesTreeModel> cookies_model( |
(...skipping 11 matching lines...) Expand all Loading... |
419 EXPECT_EQ("http://host1:1/,http://host2:2/", | 445 EXPECT_EQ("http://host1:1/,http://host2:2/", |
420 GetDisplayedSessionStorages(cookies_model.get())); | 446 GetDisplayedSessionStorages(cookies_model.get())); |
421 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 447 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
422 GetDisplayedIndexedDBs(cookies_model.get())); | 448 GetDisplayedIndexedDBs(cookies_model.get())); |
423 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 449 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
424 GetDisplayedFileSystems(cookies_model.get())); | 450 GetDisplayedFileSystems(cookies_model.get())); |
425 EXPECT_EQ("quotahost1,quotahost2", | 451 EXPECT_EQ("quotahost1,quotahost2", |
426 GetDisplayedQuotas(cookies_model.get())); | 452 GetDisplayedQuotas(cookies_model.get())); |
427 EXPECT_EQ("sbc1,sbc2", | 453 EXPECT_EQ("sbc1,sbc2", |
428 GetDisplayedChannelIDs(cookies_model.get())); | 454 GetDisplayedChannelIDs(cookies_model.get())); |
| 455 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 456 GetDisplayedCacheStorages(cookies_model.get())); |
429 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 457 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
430 GetDisplayedServiceWorkers(cookies_model.get())); | 458 GetDisplayedServiceWorkers(cookies_model.get())); |
431 EXPECT_EQ("xyz.com", | 459 EXPECT_EQ("xyz.com", |
432 GetDisplayedFlashLSOs(cookies_model.get())); | 460 GetDisplayedFlashLSOs(cookies_model.get())); |
433 } | 461 } |
434 | 462 |
435 mock_browsing_data_cookie_helper_->Reset(); | 463 mock_browsing_data_cookie_helper_->Reset(); |
436 mock_browsing_data_database_helper_->Reset(); | 464 mock_browsing_data_database_helper_->Reset(); |
437 mock_browsing_data_local_storage_helper_->Reset(); | 465 mock_browsing_data_local_storage_helper_->Reset(); |
438 mock_browsing_data_session_storage_helper_->Reset(); | 466 mock_browsing_data_session_storage_helper_->Reset(); |
439 mock_browsing_data_indexed_db_helper_->Reset(); | 467 mock_browsing_data_indexed_db_helper_->Reset(); |
440 mock_browsing_data_service_worker_helper_->Reset(); | 468 mock_browsing_data_service_worker_helper_->Reset(); |
| 469 mock_browsing_data_cache_storage_helper_->Reset(); |
441 mock_browsing_data_file_system_helper_->Reset(); | 470 mock_browsing_data_file_system_helper_->Reset(); |
442 | 471 |
443 cookies_model->DeleteAllStoredObjects(); | 472 cookies_model->DeleteAllStoredObjects(); |
444 | 473 |
445 // Make sure the nodes are also deleted from the model's cache. | 474 // Make sure the nodes are also deleted from the model's cache. |
446 // http://crbug.com/43249 | 475 // http://crbug.com/43249 |
447 cookies_model->UpdateSearchResults(base::string16()); | 476 cookies_model->UpdateSearchResults(base::string16()); |
448 | 477 |
449 { | 478 { |
450 // 2 nodes - root and app | 479 // 2 nodes - root and app |
451 SCOPED_TRACE("After removing"); | 480 SCOPED_TRACE("After removing"); |
452 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 481 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
453 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); | 482 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); |
454 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); | 483 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); |
455 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); | 484 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); |
456 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); | 485 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); |
457 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); | 486 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); |
458 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); | 487 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); |
459 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); | 488 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); |
460 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); | 489 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); |
461 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); | 490 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); |
462 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted()); | 491 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted()); |
| 492 EXPECT_TRUE(mock_browsing_data_cache_storage_helper_->AllDeleted()); |
463 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); | 493 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); |
464 } | 494 } |
465 } | 495 } |
466 | 496 |
467 TEST_F(CookiesTreeModelTest, Remove) { | 497 TEST_F(CookiesTreeModelTest, Remove) { |
468 scoped_ptr<CookiesTreeModel> cookies_model( | 498 scoped_ptr<CookiesTreeModel> cookies_model( |
469 CreateCookiesTreeModelWithInitialSample()); | 499 CreateCookiesTreeModelWithInitialSample()); |
470 | 500 |
471 // Children start out arranged as follows: | 501 // Children start out arranged as follows: |
472 // | 502 // |
473 // 0. `foo1` | 503 // 0. `cshost1` |
474 // 1. `foo2` | 504 // 1. `cshost2` |
475 // 2. `foo3` | 505 // 2. `foo1` |
476 // 3. `fshost1` | 506 // 3. `foo2` |
477 // 4. `fshost2` | 507 // 4. `foo3` |
478 // 5. `fshost3` | 508 // 5. `fshost1` |
479 // 6. `gdbhost1` | 509 // 6. `fshost2` |
480 // 7. `gdbhost2` | 510 // 7. `fshost3` |
481 // 8. `host1` | 511 // 8. `gdbhost1` |
482 // 9. `host2` | 512 // 9. `gdbhost2` |
483 // 10. `idbhost1` | 513 // 10. `host1` |
484 // 11. `idbhost2` | 514 // 11. `host2` |
485 // 12. `quotahost1` | 515 // 12. `idbhost1` |
486 // 13. `quotahost2` | 516 // 13. `idbhost2` |
487 // 14. `sbc1` | 517 // 14. `quotahost1` |
488 // 15. `sbc2` | 518 // 15. `quotahost2` |
489 // 16. 'swhost1' | 519 // 16. `sbc1` |
490 // 17. 'swhost2' | 520 // 17. `sbc2` |
491 // 18. `xyz.com` | 521 // 18. `swhost1` |
| 522 // 19. `swhost2` |
| 523 // 20. `xyz.com` |
492 // | 524 // |
493 // Here, we'll remove them one by one, starting from the end, and | 525 // Here, we'll remove them one by one, starting from the end, and |
494 // check that the state makes sense. | 526 // check that the state makes sense. |
495 | 527 |
496 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18)); | 528 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(20)); |
497 { | 529 { |
498 SCOPED_TRACE("`xyz.com` removed."); | 530 SCOPED_TRACE("`xyz.com` removed."); |
499 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 531 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
500 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 532 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
501 EXPECT_EQ("http://host1:1/,http://host2:2/", | 533 EXPECT_EQ("http://host1:1/,http://host2:2/", |
502 GetDisplayedLocalStorages(cookies_model.get())); | 534 GetDisplayedLocalStorages(cookies_model.get())); |
503 EXPECT_EQ("http://host1:1/,http://host2:2/", | 535 EXPECT_EQ("http://host1:1/,http://host2:2/", |
504 GetDisplayedSessionStorages(cookies_model.get())); | 536 GetDisplayedSessionStorages(cookies_model.get())); |
505 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 537 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
506 GetDisplayedFileSystems(cookies_model.get())); | 538 GetDisplayedFileSystems(cookies_model.get())); |
507 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 539 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
508 GetDisplayedIndexedDBs(cookies_model.get())); | 540 GetDisplayedIndexedDBs(cookies_model.get())); |
509 EXPECT_EQ("quotahost1,quotahost2", | 541 EXPECT_EQ("quotahost1,quotahost2", |
510 GetDisplayedQuotas(cookies_model.get())); | 542 GetDisplayedQuotas(cookies_model.get())); |
511 EXPECT_EQ("sbc1,sbc2", | 543 EXPECT_EQ("sbc1,sbc2", |
512 GetDisplayedChannelIDs(cookies_model.get())); | 544 GetDisplayedChannelIDs(cookies_model.get())); |
513 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 545 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
514 GetDisplayedServiceWorkers(cookies_model.get())); | 546 GetDisplayedServiceWorkers(cookies_model.get())); |
515 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 547 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 548 GetDisplayedCacheStorages(cookies_model.get())); |
| 549 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 550 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
516 } | 551 } |
517 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17)); | 552 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(19)); |
518 { | 553 { |
519 SCOPED_TRACE("`swhost2` removed."); | 554 SCOPED_TRACE("`swhost2` removed."); |
520 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 555 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
521 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 556 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
522 EXPECT_EQ("http://host1:1/,http://host2:2/", | 557 EXPECT_EQ("http://host1:1/,http://host2:2/", |
523 GetDisplayedLocalStorages(cookies_model.get())); | 558 GetDisplayedLocalStorages(cookies_model.get())); |
524 EXPECT_EQ("http://host1:1/,http://host2:2/", | 559 EXPECT_EQ("http://host1:1/,http://host2:2/", |
525 GetDisplayedSessionStorages(cookies_model.get())); | 560 GetDisplayedSessionStorages(cookies_model.get())); |
526 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 561 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
527 GetDisplayedFileSystems(cookies_model.get())); | 562 GetDisplayedFileSystems(cookies_model.get())); |
528 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 563 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
529 GetDisplayedIndexedDBs(cookies_model.get())); | 564 GetDisplayedIndexedDBs(cookies_model.get())); |
530 EXPECT_EQ("quotahost1,quotahost2", | 565 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
531 GetDisplayedQuotas(cookies_model.get())); | 566 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
532 EXPECT_EQ("sbc1,sbc2", | |
533 GetDisplayedChannelIDs(cookies_model.get())); | |
534 EXPECT_EQ("https://swhost1:1/", | 567 EXPECT_EQ("https://swhost1:1/", |
535 GetDisplayedServiceWorkers(cookies_model.get())); | 568 GetDisplayedServiceWorkers(cookies_model.get())); |
536 EXPECT_EQ(54, cookies_model->GetRoot()->GetTotalNodeCount()); | 569 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 570 GetDisplayedCacheStorages(cookies_model.get())); |
| 571 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 572 EXPECT_EQ(60, cookies_model->GetRoot()->GetTotalNodeCount()); |
537 } | 573 } |
538 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16)); | 574 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18)); |
539 { | 575 { |
540 SCOPED_TRACE("`swhost1` removed."); | 576 SCOPED_TRACE("`swhost1` removed."); |
541 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 577 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
542 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 578 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
543 EXPECT_EQ("http://host1:1/,http://host2:2/", | 579 EXPECT_EQ("http://host1:1/,http://host2:2/", |
544 GetDisplayedLocalStorages(cookies_model.get())); | 580 GetDisplayedLocalStorages(cookies_model.get())); |
545 EXPECT_EQ("http://host1:1/,http://host2:2/", | 581 EXPECT_EQ("http://host1:1/,http://host2:2/", |
546 GetDisplayedSessionStorages(cookies_model.get())); | 582 GetDisplayedSessionStorages(cookies_model.get())); |
547 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 583 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
548 GetDisplayedFileSystems(cookies_model.get())); | 584 GetDisplayedFileSystems(cookies_model.get())); |
549 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 585 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
550 GetDisplayedIndexedDBs(cookies_model.get())); | 586 GetDisplayedIndexedDBs(cookies_model.get())); |
551 EXPECT_EQ("quotahost1,quotahost2", | 587 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
552 GetDisplayedQuotas(cookies_model.get())); | 588 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
553 EXPECT_EQ("sbc1,sbc2", | |
554 GetDisplayedChannelIDs(cookies_model.get())); | |
555 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 589 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
556 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); | 590 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 591 GetDisplayedCacheStorages(cookies_model.get())); |
| 592 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 593 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); |
557 } | 594 } |
558 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); | 595 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17)); |
559 { | 596 { |
560 SCOPED_TRACE("`sbc2` removed."); | 597 SCOPED_TRACE("`sbc2` removed."); |
561 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 598 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
562 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 599 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
563 EXPECT_EQ("http://host1:1/,http://host2:2/", | 600 EXPECT_EQ("http://host1:1/,http://host2:2/", |
564 GetDisplayedLocalStorages(cookies_model.get())); | 601 GetDisplayedLocalStorages(cookies_model.get())); |
565 EXPECT_EQ("http://host1:1/,http://host2:2/", | 602 EXPECT_EQ("http://host1:1/,http://host2:2/", |
566 GetDisplayedSessionStorages(cookies_model.get())); | 603 GetDisplayedSessionStorages(cookies_model.get())); |
567 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 604 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
568 GetDisplayedFileSystems(cookies_model.get())); | 605 GetDisplayedFileSystems(cookies_model.get())); |
569 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 606 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
570 GetDisplayedIndexedDBs(cookies_model.get())); | 607 GetDisplayedIndexedDBs(cookies_model.get())); |
571 EXPECT_EQ("quotahost1,quotahost2", | 608 EXPECT_EQ("quotahost1,quotahost2", |
572 GetDisplayedQuotas(cookies_model.get())); | 609 GetDisplayedQuotas(cookies_model.get())); |
573 EXPECT_EQ("sbc1", | 610 EXPECT_EQ("sbc1", |
574 GetDisplayedChannelIDs(cookies_model.get())); | 611 GetDisplayedChannelIDs(cookies_model.get())); |
575 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 612 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
576 EXPECT_EQ(48, cookies_model->GetRoot()->GetTotalNodeCount()); | 613 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 614 GetDisplayedCacheStorages(cookies_model.get())); |
| 615 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 616 EXPECT_EQ(54, cookies_model->GetRoot()->GetTotalNodeCount()); |
577 } | 617 } |
578 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); | 618 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16)); |
579 { | 619 { |
580 SCOPED_TRACE("`sbc1` removed."); | 620 SCOPED_TRACE("`sbc1` removed."); |
581 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 621 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
582 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 622 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
583 EXPECT_EQ("http://host1:1/,http://host2:2/", | 623 EXPECT_EQ("http://host1:1/,http://host2:2/", |
584 GetDisplayedLocalStorages(cookies_model.get())); | 624 GetDisplayedLocalStorages(cookies_model.get())); |
585 EXPECT_EQ("http://host1:1/,http://host2:2/", | 625 EXPECT_EQ("http://host1:1/,http://host2:2/", |
586 GetDisplayedSessionStorages(cookies_model.get())); | 626 GetDisplayedSessionStorages(cookies_model.get())); |
587 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 627 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
588 GetDisplayedFileSystems(cookies_model.get())); | 628 GetDisplayedFileSystems(cookies_model.get())); |
589 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 629 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
590 GetDisplayedIndexedDBs(cookies_model.get())); | 630 GetDisplayedIndexedDBs(cookies_model.get())); |
591 EXPECT_EQ("quotahost1,quotahost2", | 631 EXPECT_EQ("quotahost1,quotahost2", |
592 GetDisplayedQuotas(cookies_model.get())); | 632 GetDisplayedQuotas(cookies_model.get())); |
| 633 EXPECT_EQ("", GetDisplayedChannelIDs(cookies_model.get())); |
593 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 634 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
594 EXPECT_EQ(45, cookies_model->GetRoot()->GetTotalNodeCount()); | 635 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 636 GetDisplayedCacheStorages(cookies_model.get())); |
| 637 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 638 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); |
595 } | 639 } |
596 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); | 640 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); |
597 { | 641 { |
598 SCOPED_TRACE("`quotahost2` removed."); | 642 SCOPED_TRACE("`quotahost2` removed."); |
599 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 643 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
600 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 644 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
601 EXPECT_EQ("http://host1:1/,http://host2:2/", | 645 EXPECT_EQ("http://host1:1/,http://host2:2/", |
602 GetDisplayedLocalStorages(cookies_model.get())); | 646 GetDisplayedLocalStorages(cookies_model.get())); |
603 EXPECT_EQ("http://host1:1/,http://host2:2/", | 647 EXPECT_EQ("http://host1:1/,http://host2:2/", |
604 GetDisplayedSessionStorages(cookies_model.get())); | 648 GetDisplayedSessionStorages(cookies_model.get())); |
605 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 649 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
606 GetDisplayedFileSystems(cookies_model.get())); | 650 GetDisplayedFileSystems(cookies_model.get())); |
607 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 651 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
608 GetDisplayedIndexedDBs(cookies_model.get())); | 652 GetDisplayedIndexedDBs(cookies_model.get())); |
609 EXPECT_EQ("quotahost1", | 653 EXPECT_EQ("quotahost1", |
610 GetDisplayedQuotas(cookies_model.get())); | 654 GetDisplayedQuotas(cookies_model.get())); |
611 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 655 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
612 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); | 656 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 657 GetDisplayedCacheStorages(cookies_model.get())); |
| 658 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 659 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); |
613 } | 660 } |
614 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); | 661 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); |
615 { | 662 { |
616 SCOPED_TRACE("`quotahost1` removed."); | 663 SCOPED_TRACE("`quotahost1` removed."); |
617 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 664 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
618 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 665 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
619 EXPECT_EQ("http://host1:1/,http://host2:2/", | 666 EXPECT_EQ("http://host1:1/,http://host2:2/", |
620 GetDisplayedLocalStorages(cookies_model.get())); | 667 GetDisplayedLocalStorages(cookies_model.get())); |
621 EXPECT_EQ("http://host1:1/,http://host2:2/", | 668 EXPECT_EQ("http://host1:1/,http://host2:2/", |
622 GetDisplayedSessionStorages(cookies_model.get())); | 669 GetDisplayedSessionStorages(cookies_model.get())); |
623 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 670 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
624 GetDisplayedFileSystems(cookies_model.get())); | 671 GetDisplayedFileSystems(cookies_model.get())); |
625 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 672 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
626 GetDisplayedIndexedDBs(cookies_model.get())); | 673 GetDisplayedIndexedDBs(cookies_model.get())); |
627 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 674 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
628 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); | 675 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 676 GetDisplayedCacheStorages(cookies_model.get())); |
| 677 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 678 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); |
629 } | 679 } |
630 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); | 680 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); |
631 { | 681 { |
632 SCOPED_TRACE("`idbhost2` removed."); | 682 SCOPED_TRACE("`idbhost2` removed."); |
633 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 683 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
634 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 684 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
635 EXPECT_EQ("http://host1:1/,http://host2:2/", | 685 EXPECT_EQ("http://host1:1/,http://host2:2/", |
636 GetDisplayedLocalStorages(cookies_model.get())); | 686 GetDisplayedLocalStorages(cookies_model.get())); |
637 EXPECT_EQ("http://host1:1/,http://host2:2/", | 687 EXPECT_EQ("http://host1:1/,http://host2:2/", |
638 GetDisplayedSessionStorages(cookies_model.get())); | 688 GetDisplayedSessionStorages(cookies_model.get())); |
639 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 689 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
640 GetDisplayedFileSystems(cookies_model.get())); | 690 GetDisplayedFileSystems(cookies_model.get())); |
641 EXPECT_EQ("http://idbhost1:1/", | 691 EXPECT_EQ("http://idbhost1:1/", |
642 GetDisplayedIndexedDBs(cookies_model.get())); | 692 GetDisplayedIndexedDBs(cookies_model.get())); |
643 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 693 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
644 EXPECT_EQ(38, cookies_model->GetRoot()->GetTotalNodeCount()); | 694 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 695 GetDisplayedCacheStorages(cookies_model.get())); |
| 696 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 697 EXPECT_EQ(44, cookies_model->GetRoot()->GetTotalNodeCount()); |
645 } | 698 } |
646 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); | 699 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); |
647 { | 700 { |
648 SCOPED_TRACE("`idbhost1` removed."); | 701 SCOPED_TRACE("`idbhost1` removed."); |
649 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 702 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
650 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 703 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
651 EXPECT_EQ("http://host1:1/,http://host2:2/", | 704 EXPECT_EQ("http://host1:1/,http://host2:2/", |
652 GetDisplayedLocalStorages(cookies_model.get())); | 705 GetDisplayedLocalStorages(cookies_model.get())); |
653 EXPECT_EQ("http://host1:1/,http://host2:2/", | 706 EXPECT_EQ("http://host1:1/,http://host2:2/", |
654 GetDisplayedSessionStorages(cookies_model.get())); | 707 GetDisplayedSessionStorages(cookies_model.get())); |
655 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 708 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
656 GetDisplayedFileSystems(cookies_model.get())); | 709 GetDisplayedFileSystems(cookies_model.get())); |
657 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 710 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
658 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 711 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
659 EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); | 712 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 713 GetDisplayedCacheStorages(cookies_model.get())); |
| 714 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 715 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); |
660 } | 716 } |
661 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); | 717 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); |
662 { | 718 { |
663 SCOPED_TRACE("`host2` removed."); | 719 SCOPED_TRACE("`host2` removed."); |
664 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 720 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
665 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 721 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
666 EXPECT_EQ("http://host1:1/", | 722 EXPECT_EQ("http://host1:1/", |
667 GetDisplayedLocalStorages(cookies_model.get())); | 723 GetDisplayedLocalStorages(cookies_model.get())); |
668 EXPECT_EQ("http://host1:1/", | 724 EXPECT_EQ("http://host1:1/", |
669 GetDisplayedSessionStorages(cookies_model.get())); | 725 GetDisplayedSessionStorages(cookies_model.get())); |
670 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 726 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
671 GetDisplayedFileSystems(cookies_model.get())); | 727 GetDisplayedFileSystems(cookies_model.get())); |
672 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 728 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
673 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 729 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
674 EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount()); | 730 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 731 GetDisplayedCacheStorages(cookies_model.get())); |
| 732 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 733 EXPECT_EQ(36, cookies_model->GetRoot()->GetTotalNodeCount()); |
675 } | 734 } |
676 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); | 735 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); |
677 { | 736 { |
678 SCOPED_TRACE("`host1` removed."); | 737 SCOPED_TRACE("`host1` removed."); |
679 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 738 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
680 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 739 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
681 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 740 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
682 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 741 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
683 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 742 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
684 GetDisplayedFileSystems(cookies_model.get())); | 743 GetDisplayedFileSystems(cookies_model.get())); |
685 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 744 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
686 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 745 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
687 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); | 746 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 747 GetDisplayedCacheStorages(cookies_model.get())); |
| 748 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 749 EXPECT_EQ(31, cookies_model->GetRoot()->GetTotalNodeCount()); |
688 } | 750 } |
689 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); | 751 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); |
690 { | 752 { |
691 SCOPED_TRACE("`gdbhost2` removed."); | 753 SCOPED_TRACE("`gdbhost2` removed."); |
692 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 754 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
693 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); | 755 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); |
694 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 756 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
695 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 757 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
696 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 758 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
697 GetDisplayedFileSystems(cookies_model.get())); | 759 GetDisplayedFileSystems(cookies_model.get())); |
698 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 760 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
699 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 761 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
700 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); | 762 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 763 GetDisplayedCacheStorages(cookies_model.get())); |
| 764 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 765 EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount()); |
701 } | 766 } |
702 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); | 767 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); |
703 { | 768 { |
704 SCOPED_TRACE("`gdbhost1` removed."); | 769 SCOPED_TRACE("`gdbhost1` removed."); |
705 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 770 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
706 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 771 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
707 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 772 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
708 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 773 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
709 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 774 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
710 GetDisplayedFileSystems(cookies_model.get())); | 775 GetDisplayedFileSystems(cookies_model.get())); |
711 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 776 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
712 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 777 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
713 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); | 778 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 779 GetDisplayedCacheStorages(cookies_model.get())); |
| 780 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 781 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); |
714 } | 782 } |
715 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); | 783 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); |
716 { | 784 { |
717 SCOPED_TRACE("`fshost3` removed."); | 785 SCOPED_TRACE("`fshost3` removed."); |
718 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 786 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
719 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 787 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
720 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 788 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
721 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 789 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
722 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", | 790 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", |
723 GetDisplayedFileSystems(cookies_model.get())); | 791 GetDisplayedFileSystems(cookies_model.get())); |
724 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 792 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
725 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 793 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
726 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); | 794 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 795 GetDisplayedCacheStorages(cookies_model.get())); |
| 796 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 797 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); |
727 } | 798 } |
728 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); | 799 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); |
729 { | 800 { |
730 SCOPED_TRACE("`fshost2` removed."); | 801 SCOPED_TRACE("`fshost2` removed."); |
731 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 802 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
732 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 803 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
733 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 804 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
734 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 805 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
735 EXPECT_EQ("http://fshost1:1/", | 806 EXPECT_EQ("http://fshost1:1/", |
736 GetDisplayedFileSystems(cookies_model.get())); | 807 GetDisplayedFileSystems(cookies_model.get())); |
737 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 808 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
738 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 809 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
739 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); | 810 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 811 GetDisplayedCacheStorages(cookies_model.get())); |
| 812 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 813 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); |
740 } | 814 } |
741 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); | 815 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); |
742 { | 816 { |
743 SCOPED_TRACE("`fshost1` removed."); | 817 SCOPED_TRACE("`fshost1` removed."); |
744 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 818 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
745 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 819 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
746 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 820 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
747 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 821 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
748 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 822 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
749 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 823 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
750 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 824 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
751 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); | 825 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 826 GetDisplayedCacheStorages(cookies_model.get())); |
| 827 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 828 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); |
752 } | 829 } |
753 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); | 830 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); |
754 { | 831 { |
755 SCOPED_TRACE("`foo3` removed."); | 832 SCOPED_TRACE("`foo3` removed."); |
756 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); | 833 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); |
757 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 834 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
758 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 835 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
759 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 836 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
760 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 837 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
761 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 838 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
762 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 839 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
763 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); | 840 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 841 GetDisplayedCacheStorages(cookies_model.get())); |
| 842 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 843 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); |
764 } | 844 } |
765 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); | 845 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); |
766 { | 846 { |
767 SCOPED_TRACE("`foo2` removed."); | 847 SCOPED_TRACE("`foo2` removed."); |
768 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); | 848 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); |
769 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 849 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
770 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 850 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
771 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 851 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
772 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 852 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
773 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 853 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
774 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 854 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
775 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); | 855 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 856 GetDisplayedCacheStorages(cookies_model.get())); |
| 857 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 858 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); |
776 } | 859 } |
777 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); | 860 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); |
778 { | 861 { |
779 SCOPED_TRACE("`foo1` removed."); | 862 SCOPED_TRACE("`foo1` removed."); |
780 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); | 863 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
781 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 864 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
782 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 865 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 866 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 867 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 868 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 869 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 870 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 871 GetDisplayedCacheStorages(cookies_model.get())); |
| 872 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 873 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 874 } |
| 875 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); |
| 876 { |
| 877 SCOPED_TRACE("`cshost2` removed."); |
| 878 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 879 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 880 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 881 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 882 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 883 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 884 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 885 EXPECT_EQ("https://cshost1:1/", |
| 886 GetDisplayedCacheStorages(cookies_model.get())); |
| 887 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 888 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 889 } |
| 890 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); |
| 891 { |
| 892 SCOPED_TRACE("`cshost1` removed."); |
| 893 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 894 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 895 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
783 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 896 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
784 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 897 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
785 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 898 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
786 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 899 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 900 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get())); |
| 901 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
787 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 902 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
788 } | 903 } |
789 } | 904 } |
790 | 905 |
791 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { | 906 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { |
792 scoped_ptr<CookiesTreeModel> cookies_model( | 907 scoped_ptr<CookiesTreeModel> cookies_model( |
793 CreateCookiesTreeModelWithInitialSample()); | 908 CreateCookiesTreeModelWithInitialSample()); |
794 | 909 |
795 DeleteStoredObjects( | 910 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)->GetChild(0)); |
796 cookies_model->GetRoot()->GetChild(0)->GetChild(0)); | |
797 { | 911 { |
798 SCOPED_TRACE("First origin removed"); | 912 SCOPED_TRACE("First cookies origin removed"); |
799 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 913 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
800 // 57 because in this case, the origin remains, although the COOKIES | 914 // 63 because in this case, the origin remains, although the COOKIES |
801 // node beneath it has been deleted. | 915 // node beneath it has been deleted. |
802 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 916 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
803 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 917 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
804 EXPECT_EQ("http://host1:1/,http://host2:2/", | 918 EXPECT_EQ("http://host1:1/,http://host2:2/", |
805 GetDisplayedLocalStorages(cookies_model.get())); | 919 GetDisplayedLocalStorages(cookies_model.get())); |
806 EXPECT_EQ("http://host1:1/,http://host2:2/", | 920 EXPECT_EQ("http://host1:1/,http://host2:2/", |
807 GetDisplayedSessionStorages(cookies_model.get())); | 921 GetDisplayedSessionStorages(cookies_model.get())); |
808 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 922 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
809 GetDisplayedIndexedDBs(cookies_model.get())); | 923 GetDisplayedIndexedDBs(cookies_model.get())); |
810 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 924 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
811 GetDisplayedFileSystems(cookies_model.get())); | 925 GetDisplayedFileSystems(cookies_model.get())); |
812 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 926 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
813 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 927 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
814 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 928 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
815 GetDisplayedServiceWorkers(cookies_model.get())); | 929 GetDisplayedServiceWorkers(cookies_model.get())); |
| 930 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 931 GetDisplayedCacheStorages(cookies_model.get())); |
816 } | 932 } |
817 | 933 |
818 DeleteStoredObjects( | 934 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
819 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | |
820 { | 935 { |
821 SCOPED_TRACE("First database removed"); | 936 SCOPED_TRACE("First database origin removed"); |
822 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 937 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
823 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 938 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
824 EXPECT_EQ("http://host1:1/,http://host2:2/", | 939 EXPECT_EQ("http://host1:1/,http://host2:2/", |
825 GetDisplayedLocalStorages(cookies_model.get())); | 940 GetDisplayedLocalStorages(cookies_model.get())); |
826 EXPECT_EQ("http://host1:1/,http://host2:2/", | 941 EXPECT_EQ("http://host1:1/,http://host2:2/", |
827 GetDisplayedSessionStorages(cookies_model.get())); | 942 GetDisplayedSessionStorages(cookies_model.get())); |
828 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 943 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
829 GetDisplayedIndexedDBs(cookies_model.get())); | 944 GetDisplayedIndexedDBs(cookies_model.get())); |
830 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 945 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
831 GetDisplayedFileSystems(cookies_model.get())); | 946 GetDisplayedFileSystems(cookies_model.get())); |
832 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 947 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
833 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 948 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
834 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 949 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
835 GetDisplayedServiceWorkers(cookies_model.get())); | 950 GetDisplayedServiceWorkers(cookies_model.get())); |
836 EXPECT_EQ(55, cookies_model->GetRoot()->GetTotalNodeCount()); | 951 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 952 GetDisplayedCacheStorages(cookies_model.get())); |
| 953 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); |
837 } | 954 } |
838 | 955 |
839 DeleteStoredObjects( | 956 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); |
840 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | |
841 { | 957 { |
842 SCOPED_TRACE("First origin removed"); | 958 SCOPED_TRACE("First local storage origin removed"); |
843 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 959 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
844 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 960 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
845 EXPECT_EQ("http://host2:2/", | 961 EXPECT_EQ("http://host2:2/", |
846 GetDisplayedLocalStorages(cookies_model.get())); | 962 GetDisplayedLocalStorages(cookies_model.get())); |
847 EXPECT_EQ("http://host1:1/,http://host2:2/", | 963 EXPECT_EQ("http://host1:1/,http://host2:2/", |
848 GetDisplayedSessionStorages(cookies_model.get())); | 964 GetDisplayedSessionStorages(cookies_model.get())); |
849 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 965 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
850 GetDisplayedIndexedDBs(cookies_model.get())); | 966 GetDisplayedIndexedDBs(cookies_model.get())); |
851 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 967 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
852 GetDisplayedFileSystems(cookies_model.get())); | 968 GetDisplayedFileSystems(cookies_model.get())); |
853 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 969 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
854 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 970 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
855 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 971 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
856 GetDisplayedServiceWorkers(cookies_model.get())); | 972 GetDisplayedServiceWorkers(cookies_model.get())); |
857 EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); | 973 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 974 GetDisplayedCacheStorages(cookies_model.get())); |
| 975 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); |
858 } | 976 } |
859 } | 977 } |
860 | 978 |
861 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { | 979 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { |
862 scoped_ptr<CookiesTreeModel> cookies_model( | 980 scoped_ptr<CookiesTreeModel> cookies_model( |
863 CreateCookiesTreeModelWithInitialSample()); | 981 CreateCookiesTreeModelWithInitialSample()); |
864 | 982 |
865 DeleteStoredObjects( | 983 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0)); |
866 cookies_model->GetRoot()->GetChild(1)->GetChild(0)); | |
867 { | 984 { |
868 SCOPED_TRACE("Second origin COOKIES node removed"); | 985 SCOPED_TRACE("Second origin COOKIES node removed"); |
869 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 986 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
870 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 987 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
871 EXPECT_EQ("http://host1:1/,http://host2:2/", | 988 EXPECT_EQ("http://host1:1/,http://host2:2/", |
872 GetDisplayedLocalStorages(cookies_model.get())); | 989 GetDisplayedLocalStorages(cookies_model.get())); |
873 EXPECT_EQ("http://host1:1/,http://host2:2/", | 990 EXPECT_EQ("http://host1:1/,http://host2:2/", |
874 GetDisplayedSessionStorages(cookies_model.get())); | 991 GetDisplayedSessionStorages(cookies_model.get())); |
875 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 992 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
876 GetDisplayedIndexedDBs(cookies_model.get())); | 993 GetDisplayedIndexedDBs(cookies_model.get())); |
877 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 994 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
878 GetDisplayedFileSystems(cookies_model.get())); | 995 GetDisplayedFileSystems(cookies_model.get())); |
879 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 996 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
880 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 997 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
881 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 998 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
882 GetDisplayedServiceWorkers(cookies_model.get())); | 999 GetDisplayedServiceWorkers(cookies_model.get())); |
883 // 57 because in this case, the origin remains, although the COOKIES | 1000 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1001 GetDisplayedCacheStorages(cookies_model.get())); |
| 1002 // 63 because in this case, the origin remains, although the COOKIES |
884 // node beneath it has been deleted. | 1003 // node beneath it has been deleted. |
885 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 1004 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
886 } | 1005 } |
887 | 1006 |
888 DeleteStoredObjects( | 1007 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
889 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | |
890 { | 1008 { |
891 SCOPED_TRACE("First database removed"); | 1009 SCOPED_TRACE("First database origin removed"); |
892 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 1010 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
893 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 1011 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
894 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1012 EXPECT_EQ("http://host1:1/,http://host2:2/", |
895 GetDisplayedLocalStorages(cookies_model.get())); | 1013 GetDisplayedLocalStorages(cookies_model.get())); |
896 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1014 EXPECT_EQ("http://host1:1/,http://host2:2/", |
897 GetDisplayedSessionStorages(cookies_model.get())); | 1015 GetDisplayedSessionStorages(cookies_model.get())); |
898 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1016 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
899 GetDisplayedIndexedDBs(cookies_model.get())); | 1017 GetDisplayedIndexedDBs(cookies_model.get())); |
900 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1018 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
901 GetDisplayedFileSystems(cookies_model.get())); | 1019 GetDisplayedFileSystems(cookies_model.get())); |
902 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1020 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
903 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1021 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
904 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1022 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
905 GetDisplayedServiceWorkers(cookies_model.get())); | 1023 GetDisplayedServiceWorkers(cookies_model.get())); |
906 EXPECT_EQ(55, cookies_model->GetRoot()->GetTotalNodeCount()); | 1024 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1025 GetDisplayedCacheStorages(cookies_model.get())); |
| 1026 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); |
907 } | 1027 } |
908 | 1028 |
909 DeleteStoredObjects( | 1029 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); |
910 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | |
911 { | 1030 { |
912 SCOPED_TRACE("First origin removed"); | 1031 SCOPED_TRACE("First local storage origin removed"); |
913 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 1032 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
914 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 1033 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
915 EXPECT_EQ("http://host2:2/", | 1034 EXPECT_EQ("http://host2:2/", |
916 GetDisplayedLocalStorages(cookies_model.get())); | 1035 GetDisplayedLocalStorages(cookies_model.get())); |
917 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1036 EXPECT_EQ("http://host1:1/,http://host2:2/", |
918 GetDisplayedSessionStorages(cookies_model.get())); | 1037 GetDisplayedSessionStorages(cookies_model.get())); |
919 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1038 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
920 GetDisplayedIndexedDBs(cookies_model.get())); | 1039 GetDisplayedIndexedDBs(cookies_model.get())); |
921 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1040 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
922 GetDisplayedFileSystems(cookies_model.get())); | 1041 GetDisplayedFileSystems(cookies_model.get())); |
923 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1042 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
924 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1043 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
925 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1044 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
926 GetDisplayedServiceWorkers(cookies_model.get())); | 1045 GetDisplayedServiceWorkers(cookies_model.get())); |
927 EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); | 1046 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1047 GetDisplayedCacheStorages(cookies_model.get())); |
| 1048 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); |
928 } | 1049 } |
929 } | 1050 } |
930 | 1051 |
931 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { | 1052 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { |
932 LocalDataContainer* container = | 1053 LocalDataContainer* container = |
933 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1054 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
934 mock_browsing_data_database_helper_.get(), | 1055 mock_browsing_data_database_helper_.get(), |
935 mock_browsing_data_local_storage_helper_.get(), | 1056 mock_browsing_data_local_storage_helper_.get(), |
936 mock_browsing_data_session_storage_helper_.get(), | 1057 mock_browsing_data_session_storage_helper_.get(), |
937 mock_browsing_data_appcache_helper_.get(), | 1058 mock_browsing_data_appcache_helper_.get(), |
938 mock_browsing_data_indexed_db_helper_.get(), | 1059 mock_browsing_data_indexed_db_helper_.get(), |
939 mock_browsing_data_file_system_helper_.get(), | 1060 mock_browsing_data_file_system_helper_.get(), |
940 mock_browsing_data_quota_helper_.get(), | 1061 mock_browsing_data_quota_helper_.get(), |
941 mock_browsing_data_channel_id_helper_.get(), | 1062 mock_browsing_data_channel_id_helper_.get(), |
942 mock_browsing_data_service_worker_helper_.get(), | 1063 mock_browsing_data_service_worker_helper_.get(), |
| 1064 mock_browsing_data_cache_storage_helper_.get(), |
943 mock_browsing_data_flash_lso_helper_.get()); | 1065 mock_browsing_data_flash_lso_helper_.get()); |
944 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1066 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
945 | 1067 |
946 mock_browsing_data_cookie_helper_-> | 1068 mock_browsing_data_cookie_helper_-> |
947 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1069 AddCookieSamples(GURL("http://foo1"), "A=1"); |
948 mock_browsing_data_cookie_helper_-> | 1070 mock_browsing_data_cookie_helper_-> |
949 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1071 AddCookieSamples(GURL("http://foo2"), "B=1"); |
950 mock_browsing_data_cookie_helper_-> | 1072 mock_browsing_data_cookie_helper_-> |
951 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1073 AddCookieSamples(GURL("http://foo3"), "C=1"); |
952 mock_browsing_data_cookie_helper_-> | 1074 mock_browsing_data_cookie_helper_-> |
953 AddCookieSamples(GURL("http://foo3"), "D=1"); | 1075 AddCookieSamples(GURL("http://foo3"), "D=1"); |
954 mock_browsing_data_cookie_helper_->Notify(); | 1076 mock_browsing_data_cookie_helper_->Notify(); |
955 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 1077 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
956 mock_browsing_data_database_helper_->Notify(); | 1078 mock_browsing_data_database_helper_->Notify(); |
957 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 1079 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
958 mock_browsing_data_local_storage_helper_->Notify(); | 1080 mock_browsing_data_local_storage_helper_->Notify(); |
959 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 1081 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
960 mock_browsing_data_session_storage_helper_->Notify(); | 1082 mock_browsing_data_session_storage_helper_->Notify(); |
961 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 1083 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
962 mock_browsing_data_indexed_db_helper_->Notify(); | 1084 mock_browsing_data_indexed_db_helper_->Notify(); |
963 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 1085 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
964 mock_browsing_data_file_system_helper_->Notify(); | 1086 mock_browsing_data_file_system_helper_->Notify(); |
965 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 1087 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
966 mock_browsing_data_quota_helper_->Notify(); | 1088 mock_browsing_data_quota_helper_->Notify(); |
967 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); | 1089 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); |
968 mock_browsing_data_service_worker_helper_->Notify(); | 1090 mock_browsing_data_service_worker_helper_->Notify(); |
| 1091 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); |
| 1092 mock_browsing_data_cache_storage_helper_->Notify(); |
969 | 1093 |
970 { | 1094 { |
971 SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, " | 1095 SCOPED_TRACE( |
972 "2 session storages, 2 indexed DBs, 3 file systems, " | 1096 "Initial State 4 cookies, 2 databases, 2 local storages, " |
973 "2 quotas, 2 service workers."); | 1097 "2 session storages, 2 indexed DBs, 3 file systems, " |
974 // 52 because there's the root, then | 1098 "2 quotas, 2 service workers, 2 caches."); |
| 1099 // 58 because there's the root, then |
| 1100 // cshost1 -> cache storage -> https://cshost1:1/ |
| 1101 // cshost2 -> cache storage -> https://cshost2:2/ |
975 // foo1 -> cookies -> a, | 1102 // foo1 -> cookies -> a, |
976 // foo2 -> cookies -> b, | 1103 // foo2 -> cookies -> b, |
977 // foo3 -> cookies -> c,d | 1104 // foo3 -> cookies -> c,d |
978 // dbhost1 -> database -> db1, | 1105 // dbhost1 -> database -> db1, |
979 // dbhost2 -> database -> db2, | 1106 // dbhost2 -> database -> db2, |
980 // host1 -> localstorage -> http://host1:1/, | 1107 // host1 -> localstorage -> http://host1:1/, |
981 // -> sessionstorage -> http://host1:1/, | 1108 // -> sessionstorage -> http://host1:1/, |
982 // host2 -> localstorage -> http://host2:2/, | 1109 // host2 -> localstorage -> http://host2:2/, |
983 // -> sessionstorage -> http://host2:2/, | 1110 // -> sessionstorage -> http://host2:2/, |
984 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 1111 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
985 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 1112 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
986 // fshost1 -> filesystem -> http://fshost1:1/, | 1113 // fshost1 -> filesystem -> http://fshost1:1/, |
987 // fshost2 -> filesystem -> http://fshost2:1/, | 1114 // fshost2 -> filesystem -> http://fshost2:1/, |
988 // fshost3 -> filesystem -> http://fshost3:1/, | 1115 // fshost3 -> filesystem -> http://fshost3:1/, |
989 // quotahost1 -> quotahost1, | 1116 // quotahost1 -> quotahost1, |
990 // quotahost2 -> quotahost2. | 1117 // quotahost2 -> quotahost2. |
991 // swhost1 -> service worker -> https://swhost1:1 | 1118 // swhost1 -> service worker -> https://swhost1:1 |
992 // swhost2 -> service worker -> https://swhost1:2 | 1119 // swhost2 -> service worker -> https://swhost1:2 |
993 EXPECT_EQ(52, cookies_model.GetRoot()->GetTotalNodeCount()); | 1120 EXPECT_EQ(58, cookies_model.GetRoot()->GetTotalNodeCount()); |
994 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); | 1121 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); |
995 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1122 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
996 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1123 EXPECT_EQ("http://host1:1/,http://host2:2/", |
997 GetDisplayedLocalStorages(&cookies_model)); | 1124 GetDisplayedLocalStorages(&cookies_model)); |
998 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1125 EXPECT_EQ("http://host1:1/,http://host2:2/", |
999 GetDisplayedSessionStorages(&cookies_model)); | 1126 GetDisplayedSessionStorages(&cookies_model)); |
1000 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1127 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
1001 GetDisplayedIndexedDBs(&cookies_model)); | 1128 GetDisplayedIndexedDBs(&cookies_model)); |
1002 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1129 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1003 GetDisplayedFileSystems(&cookies_model)); | 1130 GetDisplayedFileSystems(&cookies_model)); |
1004 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1131 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
1005 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1132 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1006 GetDisplayedServiceWorkers(&cookies_model)); | 1133 GetDisplayedServiceWorkers(&cookies_model)); |
| 1134 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1135 GetDisplayedCacheStorages(&cookies_model)); |
1007 } | 1136 } |
1008 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)); | 1137 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(4)); |
1009 { | 1138 { |
1010 SCOPED_TRACE("Third origin removed"); | 1139 SCOPED_TRACE("Third cookie origin removed"); |
1011 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); | 1140 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); |
1012 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1141 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
1013 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1142 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1014 GetDisplayedLocalStorages(&cookies_model)); | 1143 GetDisplayedLocalStorages(&cookies_model)); |
1015 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1144 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1016 GetDisplayedSessionStorages(&cookies_model)); | 1145 GetDisplayedSessionStorages(&cookies_model)); |
1017 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1146 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
1018 GetDisplayedIndexedDBs(&cookies_model)); | 1147 GetDisplayedIndexedDBs(&cookies_model)); |
1019 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1148 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1020 GetDisplayedFileSystems(&cookies_model)); | 1149 GetDisplayedFileSystems(&cookies_model)); |
1021 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1150 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
1022 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1151 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1023 GetDisplayedServiceWorkers(&cookies_model)); | 1152 GetDisplayedServiceWorkers(&cookies_model)); |
1024 EXPECT_EQ(48, cookies_model.GetRoot()->GetTotalNodeCount()); | 1153 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1154 GetDisplayedCacheStorages(&cookies_model)); |
| 1155 EXPECT_EQ(54, cookies_model.GetRoot()->GetTotalNodeCount()); |
1025 } | 1156 } |
1026 } | 1157 } |
1027 | 1158 |
1028 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { | 1159 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { |
1029 LocalDataContainer* container = | 1160 LocalDataContainer* container = |
1030 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1161 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1031 mock_browsing_data_database_helper_.get(), | 1162 mock_browsing_data_database_helper_.get(), |
1032 mock_browsing_data_local_storage_helper_.get(), | 1163 mock_browsing_data_local_storage_helper_.get(), |
1033 mock_browsing_data_session_storage_helper_.get(), | 1164 mock_browsing_data_session_storage_helper_.get(), |
1034 mock_browsing_data_appcache_helper_.get(), | 1165 mock_browsing_data_appcache_helper_.get(), |
1035 mock_browsing_data_indexed_db_helper_.get(), | 1166 mock_browsing_data_indexed_db_helper_.get(), |
1036 mock_browsing_data_file_system_helper_.get(), | 1167 mock_browsing_data_file_system_helper_.get(), |
1037 mock_browsing_data_quota_helper_.get(), | 1168 mock_browsing_data_quota_helper_.get(), |
1038 mock_browsing_data_channel_id_helper_.get(), | 1169 mock_browsing_data_channel_id_helper_.get(), |
1039 mock_browsing_data_service_worker_helper_.get(), | 1170 mock_browsing_data_service_worker_helper_.get(), |
| 1171 mock_browsing_data_cache_storage_helper_.get(), |
1040 mock_browsing_data_flash_lso_helper_.get()); | 1172 mock_browsing_data_flash_lso_helper_.get()); |
1041 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1173 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
1042 | 1174 |
1043 mock_browsing_data_cookie_helper_-> | 1175 mock_browsing_data_cookie_helper_-> |
1044 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1176 AddCookieSamples(GURL("http://foo1"), "A=1"); |
1045 mock_browsing_data_cookie_helper_-> | 1177 mock_browsing_data_cookie_helper_-> |
1046 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1178 AddCookieSamples(GURL("http://foo2"), "B=1"); |
1047 mock_browsing_data_cookie_helper_-> | 1179 mock_browsing_data_cookie_helper_-> |
1048 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1180 AddCookieSamples(GURL("http://foo3"), "C=1"); |
1049 mock_browsing_data_cookie_helper_-> | 1181 mock_browsing_data_cookie_helper_-> |
1050 AddCookieSamples(GURL("http://foo3"), "D=1"); | 1182 AddCookieSamples(GURL("http://foo3"), "D=1"); |
1051 mock_browsing_data_cookie_helper_-> | 1183 mock_browsing_data_cookie_helper_-> |
1052 AddCookieSamples(GURL("http://foo3"), "E=1"); | 1184 AddCookieSamples(GURL("http://foo3"), "E=1"); |
1053 mock_browsing_data_cookie_helper_->Notify(); | 1185 mock_browsing_data_cookie_helper_->Notify(); |
1054 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 1186 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
1055 mock_browsing_data_database_helper_->Notify(); | 1187 mock_browsing_data_database_helper_->Notify(); |
1056 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 1188 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
1057 mock_browsing_data_local_storage_helper_->Notify(); | 1189 mock_browsing_data_local_storage_helper_->Notify(); |
1058 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 1190 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
1059 mock_browsing_data_session_storage_helper_->Notify(); | 1191 mock_browsing_data_session_storage_helper_->Notify(); |
1060 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 1192 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
1061 mock_browsing_data_indexed_db_helper_->Notify(); | 1193 mock_browsing_data_indexed_db_helper_->Notify(); |
1062 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 1194 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
1063 mock_browsing_data_file_system_helper_->Notify(); | 1195 mock_browsing_data_file_system_helper_->Notify(); |
1064 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 1196 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
1065 mock_browsing_data_quota_helper_->Notify(); | 1197 mock_browsing_data_quota_helper_->Notify(); |
1066 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); | 1198 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); |
1067 mock_browsing_data_service_worker_helper_->Notify(); | 1199 mock_browsing_data_service_worker_helper_->Notify(); |
| 1200 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); |
| 1201 mock_browsing_data_cache_storage_helper_->Notify(); |
1068 | 1202 |
1069 { | 1203 { |
1070 SCOPED_TRACE("Initial State 5 cookies, 2 databases, 2 local storages, " | 1204 SCOPED_TRACE( |
1071 "2 session storages, 2 indexed DBs, 3 filesystems, " | 1205 "Initial State 5 cookies, 2 databases, 2 local storages, " |
1072 "2 quotas, 2 service workers."); | 1206 "2 session storages, 2 indexed DBs, 3 filesystems, " |
1073 // 53 because there's the root, then | 1207 "2 quotas, 2 service workers, 2 caches."); |
| 1208 // 59 because there's the root, then |
| 1209 // cshost1 -> cache storage -> https://cshost1:1/ |
| 1210 // cshost2 -> cache storage -> https://cshost2:2/ |
1074 // foo1 -> cookies -> a, | 1211 // foo1 -> cookies -> a, |
1075 // foo2 -> cookies -> b, | 1212 // foo2 -> cookies -> b, |
1076 // foo3 -> cookies -> c,d,e | 1213 // foo3 -> cookies -> c,d,e |
1077 // dbhost1 -> database -> db1, | 1214 // dbhost1 -> database -> db1, |
1078 // dbhost2 -> database -> db2, | 1215 // dbhost2 -> database -> db2, |
1079 // host1 -> localstorage -> http://host1:1/, | 1216 // host1 -> localstorage -> http://host1:1/, |
1080 // -> sessionstorage -> http://host1:1/, | 1217 // -> sessionstorage -> http://host1:1/, |
1081 // host2 -> localstorage -> http://host2:2/, | 1218 // host2 -> localstorage -> http://host2:2/, |
1082 // -> sessionstorage -> http://host2:2/, | 1219 // -> sessionstorage -> http://host2:2/, |
1083 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 1220 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
1084 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 1221 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
1085 // fshost1 -> filesystem -> http://fshost1:1/, | 1222 // fshost1 -> filesystem -> http://fshost1:1/, |
1086 // fshost2 -> filesystem -> http://fshost2:1/, | 1223 // fshost2 -> filesystem -> http://fshost2:1/, |
1087 // fshost3 -> filesystem -> http://fshost3:1/, | 1224 // fshost3 -> filesystem -> http://fshost3:1/, |
1088 // quotahost1 -> quotahost1, | 1225 // quotahost1 -> quotahost1, |
1089 // quotahost2 -> quotahost2. | 1226 // quotahost2 -> quotahost2. |
1090 // swhost1 -> service worker -> https://swhost1:1 | 1227 // swhost1 -> service worker -> https://swhost1:1 |
1091 // swhost2 -> service worker -> https://swhost1:2 | 1228 // swhost2 -> service worker -> https://swhost1:2 |
1092 EXPECT_EQ(53, cookies_model.GetRoot()->GetTotalNodeCount()); | 1229 EXPECT_EQ(59, cookies_model.GetRoot()->GetTotalNodeCount()); |
1093 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 1230 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
1094 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1231 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
1095 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1232 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1096 GetDisplayedLocalStorages(&cookies_model)); | 1233 GetDisplayedLocalStorages(&cookies_model)); |
1097 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1234 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1098 GetDisplayedSessionStorages(&cookies_model)); | 1235 GetDisplayedSessionStorages(&cookies_model)); |
1099 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1236 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
1100 GetDisplayedIndexedDBs(&cookies_model)); | 1237 GetDisplayedIndexedDBs(&cookies_model)); |
1101 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1238 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1102 GetDisplayedFileSystems(&cookies_model)); | 1239 GetDisplayedFileSystems(&cookies_model)); |
1103 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1240 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
1104 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1241 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1105 GetDisplayedServiceWorkers(&cookies_model)); | 1242 GetDisplayedServiceWorkers(&cookies_model)); |
| 1243 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1244 GetDisplayedCacheStorages(&cookies_model)); |
1106 } | 1245 } |
1107 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)-> | 1246 DeleteStoredObjects( |
1108 GetChild(1)); | 1247 cookies_model.GetRoot()->GetChild(4)->GetChild(0)->GetChild(1)); |
1109 { | 1248 { |
1110 SCOPED_TRACE("Middle cookie in third origin removed"); | 1249 SCOPED_TRACE("Middle cookie in third cookie origin removed"); |
1111 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); | 1250 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); |
1112 EXPECT_EQ(52, cookies_model.GetRoot()->GetTotalNodeCount()); | 1251 EXPECT_EQ(58, cookies_model.GetRoot()->GetTotalNodeCount()); |
1113 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1252 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
1114 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1253 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1115 GetDisplayedLocalStorages(&cookies_model)); | 1254 GetDisplayedLocalStorages(&cookies_model)); |
1116 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1255 EXPECT_EQ("http://host1:1/,http://host2:2/", |
1117 GetDisplayedSessionStorages(&cookies_model)); | 1256 GetDisplayedSessionStorages(&cookies_model)); |
1118 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1257 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
1119 GetDisplayedIndexedDBs(&cookies_model)); | 1258 GetDisplayedIndexedDBs(&cookies_model)); |
1120 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1259 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1121 GetDisplayedFileSystems(&cookies_model)); | 1260 GetDisplayedFileSystems(&cookies_model)); |
1122 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1261 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
1123 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1262 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1124 GetDisplayedServiceWorkers(&cookies_model)); | 1263 GetDisplayedServiceWorkers(&cookies_model)); |
| 1264 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1265 GetDisplayedCacheStorages(&cookies_model)); |
1125 } | 1266 } |
1126 } | 1267 } |
1127 | 1268 |
1128 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 1269 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
1129 LocalDataContainer* container = | 1270 LocalDataContainer* container = |
1130 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1271 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1131 mock_browsing_data_database_helper_.get(), | 1272 mock_browsing_data_database_helper_.get(), |
1132 mock_browsing_data_local_storage_helper_.get(), | 1273 mock_browsing_data_local_storage_helper_.get(), |
1133 mock_browsing_data_session_storage_helper_.get(), | 1274 mock_browsing_data_session_storage_helper_.get(), |
1134 mock_browsing_data_appcache_helper_.get(), | 1275 mock_browsing_data_appcache_helper_.get(), |
1135 mock_browsing_data_indexed_db_helper_.get(), | 1276 mock_browsing_data_indexed_db_helper_.get(), |
1136 mock_browsing_data_file_system_helper_.get(), | 1277 mock_browsing_data_file_system_helper_.get(), |
1137 mock_browsing_data_quota_helper_.get(), | 1278 mock_browsing_data_quota_helper_.get(), |
1138 mock_browsing_data_channel_id_helper_.get(), | 1279 mock_browsing_data_channel_id_helper_.get(), |
1139 mock_browsing_data_service_worker_helper_.get(), | 1280 mock_browsing_data_service_worker_helper_.get(), |
| 1281 mock_browsing_data_cache_storage_helper_.get(), |
1140 mock_browsing_data_flash_lso_helper_.get()); | 1282 mock_browsing_data_flash_lso_helper_.get()); |
1141 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1283 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
1142 | 1284 |
1143 mock_browsing_data_cookie_helper_-> | 1285 mock_browsing_data_cookie_helper_-> |
1144 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1286 AddCookieSamples(GURL("http://foo1"), "A=1"); |
1145 mock_browsing_data_cookie_helper_-> | 1287 mock_browsing_data_cookie_helper_-> |
1146 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1288 AddCookieSamples(GURL("http://foo2"), "B=1"); |
1147 mock_browsing_data_cookie_helper_-> | 1289 mock_browsing_data_cookie_helper_-> |
1148 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1290 AddCookieSamples(GURL("http://foo3"), "C=1"); |
1149 mock_browsing_data_cookie_helper_-> | 1291 mock_browsing_data_cookie_helper_-> |
(...skipping 23 matching lines...) Expand all Loading... |
1173 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1315 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1174 mock_browsing_data_database_helper_.get(), | 1316 mock_browsing_data_database_helper_.get(), |
1175 mock_browsing_data_local_storage_helper_.get(), | 1317 mock_browsing_data_local_storage_helper_.get(), |
1176 mock_browsing_data_session_storage_helper_.get(), | 1318 mock_browsing_data_session_storage_helper_.get(), |
1177 mock_browsing_data_appcache_helper_.get(), | 1319 mock_browsing_data_appcache_helper_.get(), |
1178 mock_browsing_data_indexed_db_helper_.get(), | 1320 mock_browsing_data_indexed_db_helper_.get(), |
1179 mock_browsing_data_file_system_helper_.get(), | 1321 mock_browsing_data_file_system_helper_.get(), |
1180 mock_browsing_data_quota_helper_.get(), | 1322 mock_browsing_data_quota_helper_.get(), |
1181 mock_browsing_data_channel_id_helper_.get(), | 1323 mock_browsing_data_channel_id_helper_.get(), |
1182 mock_browsing_data_service_worker_helper_.get(), | 1324 mock_browsing_data_service_worker_helper_.get(), |
| 1325 mock_browsing_data_cache_storage_helper_.get(), |
1183 mock_browsing_data_flash_lso_helper_.get()); | 1326 mock_browsing_data_flash_lso_helper_.get()); |
1184 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1327 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
1185 | 1328 |
1186 mock_browsing_data_cookie_helper_-> | 1329 mock_browsing_data_cookie_helper_-> |
1187 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); | 1330 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); |
1188 mock_browsing_data_cookie_helper_-> | 1331 mock_browsing_data_cookie_helper_-> |
1189 AddCookieSamples(GURL("http://foo2.com"), "B=1"); | 1332 AddCookieSamples(GURL("http://foo2.com"), "B=1"); |
1190 mock_browsing_data_cookie_helper_-> | 1333 mock_browsing_data_cookie_helper_-> |
1191 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); | 1334 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); |
1192 // Leading dot on the foo4 | 1335 // Leading dot on the foo4 |
(...skipping 28 matching lines...) Expand all Loading... |
1221 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1364 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1222 mock_browsing_data_database_helper_.get(), | 1365 mock_browsing_data_database_helper_.get(), |
1223 mock_browsing_data_local_storage_helper_.get(), | 1366 mock_browsing_data_local_storage_helper_.get(), |
1224 mock_browsing_data_session_storage_helper_.get(), | 1367 mock_browsing_data_session_storage_helper_.get(), |
1225 mock_browsing_data_appcache_helper_.get(), | 1368 mock_browsing_data_appcache_helper_.get(), |
1226 mock_browsing_data_indexed_db_helper_.get(), | 1369 mock_browsing_data_indexed_db_helper_.get(), |
1227 mock_browsing_data_file_system_helper_.get(), | 1370 mock_browsing_data_file_system_helper_.get(), |
1228 mock_browsing_data_quota_helper_.get(), | 1371 mock_browsing_data_quota_helper_.get(), |
1229 mock_browsing_data_channel_id_helper_.get(), | 1372 mock_browsing_data_channel_id_helper_.get(), |
1230 mock_browsing_data_service_worker_helper_.get(), | 1373 mock_browsing_data_service_worker_helper_.get(), |
| 1374 mock_browsing_data_cache_storage_helper_.get(), |
1231 mock_browsing_data_flash_lso_helper_.get()); | 1375 mock_browsing_data_flash_lso_helper_.get()); |
1232 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1376 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
1233 | 1377 |
1234 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); | 1378 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); |
1235 mock_browsing_data_cookie_helper_->Notify(); | 1379 mock_browsing_data_cookie_helper_->Notify(); |
1236 | 1380 |
1237 TestingProfile profile; | 1381 TestingProfile profile; |
1238 HostContentSettingsMap* content_settings = | 1382 HostContentSettingsMap* content_settings = |
1239 profile.GetHostContentSettingsMap(); | 1383 profile.GetHostContentSettingsMap(); |
1240 content_settings::CookieSettings* cookie_settings = | 1384 content_settings::CookieSettings* cookie_settings = |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 GetDisplayedServiceWorkers(cookies_model.get())); | 1447 GetDisplayedServiceWorkers(cookies_model.get())); |
1304 | 1448 |
1305 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("swhost3")); | 1449 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("swhost3")); |
1306 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 1450 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
1307 | 1451 |
1308 cookies_model->UpdateSearchResults(base::string16()); | 1452 cookies_model->UpdateSearchResults(base::string16()); |
1309 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1453 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
1310 GetDisplayedServiceWorkers(cookies_model.get())); | 1454 GetDisplayedServiceWorkers(cookies_model.get())); |
1311 } | 1455 } |
1312 | 1456 |
| 1457 TEST_F(CookiesTreeModelTest, CacheStorageFilter) { |
| 1458 scoped_ptr<CookiesTreeModel> cookies_model( |
| 1459 CreateCookiesTreeModelWithInitialSample()); |
| 1460 |
| 1461 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost1")); |
| 1462 EXPECT_EQ("https://cshost1:1/", |
| 1463 GetDisplayedCacheStorages(cookies_model.get())); |
| 1464 |
| 1465 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost2")); |
| 1466 EXPECT_EQ("https://cshost2:2/", |
| 1467 GetDisplayedCacheStorages(cookies_model.get())); |
| 1468 |
| 1469 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost3")); |
| 1470 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get())); |
| 1471 |
| 1472 cookies_model->UpdateSearchResults(base::string16()); |
| 1473 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1474 GetDisplayedCacheStorages(cookies_model.get())); |
| 1475 } |
| 1476 |
1313 TEST_F(CookiesTreeModelTest, CookiesFilter) { | 1477 TEST_F(CookiesTreeModelTest, CookiesFilter) { |
1314 LocalDataContainer* container = | 1478 LocalDataContainer* container = |
1315 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1479 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1316 mock_browsing_data_database_helper_.get(), | 1480 mock_browsing_data_database_helper_.get(), |
1317 mock_browsing_data_local_storage_helper_.get(), | 1481 mock_browsing_data_local_storage_helper_.get(), |
1318 mock_browsing_data_session_storage_helper_.get(), | 1482 mock_browsing_data_session_storage_helper_.get(), |
1319 mock_browsing_data_appcache_helper_.get(), | 1483 mock_browsing_data_appcache_helper_.get(), |
1320 mock_browsing_data_indexed_db_helper_.get(), | 1484 mock_browsing_data_indexed_db_helper_.get(), |
1321 mock_browsing_data_file_system_helper_.get(), | 1485 mock_browsing_data_file_system_helper_.get(), |
1322 mock_browsing_data_quota_helper_.get(), | 1486 mock_browsing_data_quota_helper_.get(), |
1323 mock_browsing_data_channel_id_helper_.get(), | 1487 mock_browsing_data_channel_id_helper_.get(), |
1324 mock_browsing_data_service_worker_helper_.get(), | 1488 mock_browsing_data_service_worker_helper_.get(), |
| 1489 mock_browsing_data_cache_storage_helper_.get(), |
1325 mock_browsing_data_flash_lso_helper_.get()); | 1490 mock_browsing_data_flash_lso_helper_.get()); |
1326 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1491 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
1327 | 1492 |
1328 mock_browsing_data_cookie_helper_-> | 1493 mock_browsing_data_cookie_helper_-> |
1329 AddCookieSamples(GURL("http://123.com"), "A=1"); | 1494 AddCookieSamples(GURL("http://123.com"), "A=1"); |
1330 mock_browsing_data_cookie_helper_-> | 1495 mock_browsing_data_cookie_helper_-> |
1331 AddCookieSamples(GURL("http://foo1.com"), "B=1"); | 1496 AddCookieSamples(GURL("http://foo1.com"), "B=1"); |
1332 mock_browsing_data_cookie_helper_-> | 1497 mock_browsing_data_cookie_helper_-> |
1333 AddCookieSamples(GURL("http://foo2.com"), "C=1"); | 1498 AddCookieSamples(GURL("http://foo2.com"), "C=1"); |
1334 mock_browsing_data_cookie_helper_-> | 1499 mock_browsing_data_cookie_helper_-> |
1335 AddCookieSamples(GURL("http://foo3.com"), "D=1"); | 1500 AddCookieSamples(GURL("http://foo3.com"), "D=1"); |
1336 mock_browsing_data_cookie_helper_->Notify(); | 1501 mock_browsing_data_cookie_helper_->Notify(); |
1337 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1502 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1338 | 1503 |
1339 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo"))); | 1504 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo"))); |
1340 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); | 1505 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); |
1341 | 1506 |
1342 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("2"))); | 1507 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("2"))); |
1343 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1508 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
1344 | 1509 |
1345 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); | 1510 cookies_model.UpdateSearchResults(base::string16(base::ASCIIToUTF16("foo3"))); |
1346 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1511 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
1347 | 1512 |
1348 cookies_model.UpdateSearchResults(base::string16()); | 1513 cookies_model.UpdateSearchResults(base::string16()); |
1349 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1514 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1350 } | 1515 } |
1351 | 1516 |
1352 } // namespace | 1517 } // namespace |
OLD | NEW |