| 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 // Checks that, when setting content settings for host nodes in the | 212 // Checks that, when setting content settings for host nodes in the |
| 201 // cookie tree, the content settings are applied to the expected URL. | 213 // cookie tree, the content settings are applied to the expected URL. |
| 202 void CheckContentSettingsUrlForHostNodes( | 214 void CheckContentSettingsUrlForHostNodes( |
| 203 const CookieTreeNode* node, | 215 const CookieTreeNode* node, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 ","; | 279 ","; |
| 268 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: | 280 case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: |
| 269 return node->GetDetailedInfo().file_system_info->origin.spec() + | 281 return node->GetDetailedInfo().file_system_info->origin.spec() + |
| 270 ","; | 282 ","; |
| 271 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: | 283 case CookieTreeNode::DetailedInfo::TYPE_QUOTA: |
| 272 return node->GetDetailedInfo().quota_info->host + ","; | 284 return node->GetDetailedInfo().quota_info->host + ","; |
| 273 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: | 285 case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID: |
| 274 return node->GetDetailedInfo().channel_id->server_identifier() + ","; | 286 return node->GetDetailedInfo().channel_id->server_identifier() + ","; |
| 275 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: | 287 case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER: |
| 276 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; | 288 return node->GetDetailedInfo().service_worker_info->origin.spec() + ","; |
| 289 case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE: |
| 290 return node->GetDetailedInfo().cache_storage_info->origin.spec() + ","; |
| 277 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: | 291 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: |
| 278 return node->GetDetailedInfo().flash_lso_domain + ","; | 292 return node->GetDetailedInfo().flash_lso_domain + ","; |
| 279 default: | 293 default: |
| 280 return std::string(); | 294 return std::string(); |
| 281 } | 295 } |
| 282 } | 296 } |
| 283 | 297 |
| 284 std::string GetCookiesOfChildren(const CookieTreeNode* node) { | 298 std::string GetCookiesOfChildren(const CookieTreeNode* node) { |
| 285 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); | 299 return GetNodesOfChildren(node, CookieTreeNode::DetailedInfo::TYPE_COOKIE); |
| 286 } | 300 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 313 std::string GetFileQuotaOfChildren(const CookieTreeNode* node) { | 327 std::string GetFileQuotaOfChildren(const CookieTreeNode* node) { |
| 314 return GetNodesOfChildren( | 328 return GetNodesOfChildren( |
| 315 node, CookieTreeNode::DetailedInfo::TYPE_QUOTA); | 329 node, CookieTreeNode::DetailedInfo::TYPE_QUOTA); |
| 316 } | 330 } |
| 317 | 331 |
| 318 std::string GetServiceWorkersOfChildren(const CookieTreeNode* node) { | 332 std::string GetServiceWorkersOfChildren(const CookieTreeNode* node) { |
| 319 return GetNodesOfChildren( | 333 return GetNodesOfChildren( |
| 320 node, CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); | 334 node, CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); |
| 321 } | 335 } |
| 322 | 336 |
| 337 std::string GetCacheStoragesOfChildren(const CookieTreeNode* node) { |
| 338 return GetNodesOfChildren(node, |
| 339 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); |
| 340 } |
| 341 |
| 323 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) { | 342 std::string GetFlashLSOsOfChildren(const CookieTreeNode* node) { |
| 324 return GetNodesOfChildren( | 343 return GetNodesOfChildren( |
| 325 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); | 344 node, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); |
| 326 } | 345 } |
| 327 | 346 |
| 328 // Get the nodes names displayed in the view (if we had one) in the order | 347 // Get the nodes names displayed in the view (if we had one) in the order |
| 329 // they are displayed, as a comma seperated string. | 348 // they are displayed, as a comma seperated string. |
| 330 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); | 349 // Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str()); |
| 331 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model, | 350 std::string GetDisplayedNodes(CookiesTreeModel* cookies_model, |
| 332 CookieTreeNode::DetailedInfo::NodeType type) { | 351 CookieTreeNode::DetailedInfo::NodeType type) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 std::string GetDisplayedChannelIDs(CookiesTreeModel* cookies_model) { | 400 std::string GetDisplayedChannelIDs(CookiesTreeModel* cookies_model) { |
| 382 return GetDisplayedNodes( | 401 return GetDisplayedNodes( |
| 383 cookies_model, CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID); | 402 cookies_model, CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID); |
| 384 } | 403 } |
| 385 | 404 |
| 386 std::string GetDisplayedServiceWorkers(CookiesTreeModel* cookies_model) { | 405 std::string GetDisplayedServiceWorkers(CookiesTreeModel* cookies_model) { |
| 387 return GetDisplayedNodes(cookies_model, | 406 return GetDisplayedNodes(cookies_model, |
| 388 CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); | 407 CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER); |
| 389 } | 408 } |
| 390 | 409 |
| 410 std::string GetDisplayedCacheStorages(CookiesTreeModel* cookies_model) { |
| 411 return GetDisplayedNodes(cookies_model, |
| 412 CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE); |
| 413 } |
| 414 |
| 391 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { | 415 std::string GetDisplayedFlashLSOs(CookiesTreeModel* cookies_model) { |
| 392 return GetDisplayedNodes( | 416 return GetDisplayedNodes( |
| 393 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); | 417 cookies_model, CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO); |
| 394 } | 418 } |
| 395 | 419 |
| 396 // Do not call on the root. | 420 // Do not call on the root. |
| 397 void DeleteStoredObjects(CookieTreeNode* node) { | 421 void DeleteStoredObjects(CookieTreeNode* node) { |
| 398 node->DeleteStoredObjects(); | 422 node->DeleteStoredObjects(); |
| 399 CookieTreeNode* parent_node = node->parent(); | 423 CookieTreeNode* parent_node = node->parent(); |
| 400 DCHECK(parent_node); | 424 DCHECK(parent_node); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 425 scoped_refptr<MockBrowsingDataIndexedDBHelper> | 449 scoped_refptr<MockBrowsingDataIndexedDBHelper> |
| 426 mock_browsing_data_indexed_db_helper_; | 450 mock_browsing_data_indexed_db_helper_; |
| 427 scoped_refptr<MockBrowsingDataFileSystemHelper> | 451 scoped_refptr<MockBrowsingDataFileSystemHelper> |
| 428 mock_browsing_data_file_system_helper_; | 452 mock_browsing_data_file_system_helper_; |
| 429 scoped_refptr<MockBrowsingDataQuotaHelper> | 453 scoped_refptr<MockBrowsingDataQuotaHelper> |
| 430 mock_browsing_data_quota_helper_; | 454 mock_browsing_data_quota_helper_; |
| 431 scoped_refptr<MockBrowsingDataChannelIDHelper> | 455 scoped_refptr<MockBrowsingDataChannelIDHelper> |
| 432 mock_browsing_data_channel_id_helper_; | 456 mock_browsing_data_channel_id_helper_; |
| 433 scoped_refptr<MockBrowsingDataServiceWorkerHelper> | 457 scoped_refptr<MockBrowsingDataServiceWorkerHelper> |
| 434 mock_browsing_data_service_worker_helper_; | 458 mock_browsing_data_service_worker_helper_; |
| 459 scoped_refptr<MockBrowsingDataCacheStorageHelper> |
| 460 mock_browsing_data_cache_storage_helper_; |
| 435 scoped_refptr<MockBrowsingDataFlashLSOHelper> | 461 scoped_refptr<MockBrowsingDataFlashLSOHelper> |
| 436 mock_browsing_data_flash_lso_helper_; | 462 mock_browsing_data_flash_lso_helper_; |
| 437 | 463 |
| 438 #if defined(ENABLE_EXTENSIONS) | 464 #if defined(ENABLE_EXTENSIONS) |
| 439 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; | 465 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
| 440 #endif | 466 #endif |
| 441 }; | 467 }; |
| 442 | 468 |
| 443 TEST_F(CookiesTreeModelTest, RemoveAll) { | 469 TEST_F(CookiesTreeModelTest, RemoveAll) { |
| 444 scoped_ptr<CookiesTreeModel> cookies_model( | 470 scoped_ptr<CookiesTreeModel> cookies_model( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 456 EXPECT_EQ("http://host1:1/,http://host2:2/", | 482 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 457 GetDisplayedSessionStorages(cookies_model.get())); | 483 GetDisplayedSessionStorages(cookies_model.get())); |
| 458 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 484 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 459 GetDisplayedIndexedDBs(cookies_model.get())); | 485 GetDisplayedIndexedDBs(cookies_model.get())); |
| 460 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 486 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 461 GetDisplayedFileSystems(cookies_model.get())); | 487 GetDisplayedFileSystems(cookies_model.get())); |
| 462 EXPECT_EQ("quotahost1,quotahost2", | 488 EXPECT_EQ("quotahost1,quotahost2", |
| 463 GetDisplayedQuotas(cookies_model.get())); | 489 GetDisplayedQuotas(cookies_model.get())); |
| 464 EXPECT_EQ("sbc1,sbc2", | 490 EXPECT_EQ("sbc1,sbc2", |
| 465 GetDisplayedChannelIDs(cookies_model.get())); | 491 GetDisplayedChannelIDs(cookies_model.get())); |
| 492 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 493 GetDisplayedCacheStorages(cookies_model.get())); |
| 466 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 494 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 467 GetDisplayedServiceWorkers(cookies_model.get())); | 495 GetDisplayedServiceWorkers(cookies_model.get())); |
| 468 EXPECT_EQ("xyz.com", | 496 EXPECT_EQ("xyz.com", |
| 469 GetDisplayedFlashLSOs(cookies_model.get())); | 497 GetDisplayedFlashLSOs(cookies_model.get())); |
| 470 } | 498 } |
| 471 | 499 |
| 472 mock_browsing_data_cookie_helper_->Reset(); | 500 mock_browsing_data_cookie_helper_->Reset(); |
| 473 mock_browsing_data_database_helper_->Reset(); | 501 mock_browsing_data_database_helper_->Reset(); |
| 474 mock_browsing_data_local_storage_helper_->Reset(); | 502 mock_browsing_data_local_storage_helper_->Reset(); |
| 475 mock_browsing_data_session_storage_helper_->Reset(); | 503 mock_browsing_data_session_storage_helper_->Reset(); |
| 476 mock_browsing_data_indexed_db_helper_->Reset(); | 504 mock_browsing_data_indexed_db_helper_->Reset(); |
| 477 mock_browsing_data_service_worker_helper_->Reset(); | 505 mock_browsing_data_service_worker_helper_->Reset(); |
| 506 mock_browsing_data_cache_storage_helper_->Reset(); |
| 478 mock_browsing_data_file_system_helper_->Reset(); | 507 mock_browsing_data_file_system_helper_->Reset(); |
| 479 | 508 |
| 480 cookies_model->DeleteAllStoredObjects(); | 509 cookies_model->DeleteAllStoredObjects(); |
| 481 | 510 |
| 482 // Make sure the nodes are also deleted from the model's cache. | 511 // Make sure the nodes are also deleted from the model's cache. |
| 483 // http://crbug.com/43249 | 512 // http://crbug.com/43249 |
| 484 cookies_model->UpdateSearchResults(base::string16()); | 513 cookies_model->UpdateSearchResults(base::string16()); |
| 485 | 514 |
| 486 { | 515 { |
| 487 // 2 nodes - root and app | 516 // 2 nodes - root and app |
| 488 SCOPED_TRACE("After removing"); | 517 SCOPED_TRACE("After removing"); |
| 489 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 518 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 490 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); | 519 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); |
| 491 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); | 520 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); |
| 492 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); | 521 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); |
| 493 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); | 522 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); |
| 494 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); | 523 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); |
| 495 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); | 524 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); |
| 496 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); | 525 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); |
| 497 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); | 526 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); |
| 498 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); | 527 EXPECT_TRUE(mock_browsing_data_channel_id_helper_->AllDeleted()); |
| 499 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted()); | 528 EXPECT_TRUE(mock_browsing_data_service_worker_helper_->AllDeleted()); |
| 529 EXPECT_TRUE(mock_browsing_data_cache_storage_helper_->AllDeleted()); |
| 500 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); | 530 EXPECT_TRUE(mock_browsing_data_flash_lso_helper_->AllDeleted()); |
| 501 } | 531 } |
| 502 } | 532 } |
| 503 | 533 |
| 504 TEST_F(CookiesTreeModelTest, Remove) { | 534 TEST_F(CookiesTreeModelTest, Remove) { |
| 505 scoped_ptr<CookiesTreeModel> cookies_model( | 535 scoped_ptr<CookiesTreeModel> cookies_model( |
| 506 CreateCookiesTreeModelWithInitialSample()); | 536 CreateCookiesTreeModelWithInitialSample()); |
| 507 | 537 |
| 508 // Children start out arranged as follows: | 538 // Children start out arranged as follows: |
| 509 // | 539 // |
| 510 // 0. `foo1` | 540 // 0. `cshost1` |
| 511 // 1. `foo2` | 541 // 1. `cshost2` |
| 512 // 2. `foo3` | 542 // 2. `foo1` |
| 513 // 3. `fshost1` | 543 // 3. `foo2` |
| 514 // 4. `fshost2` | 544 // 4. `foo3` |
| 515 // 5. `fshost3` | 545 // 5. `fshost1` |
| 516 // 6. `gdbhost1` | 546 // 6. `fshost2` |
| 517 // 7. `gdbhost2` | 547 // 7. `fshost3` |
| 518 // 8. `host1` | 548 // 8. `gdbhost1` |
| 519 // 9. `host2` | 549 // 9. `gdbhost2` |
| 520 // 10. `idbhost1` | 550 // 10. `host1` |
| 521 // 11. `idbhost2` | 551 // 11. `host2` |
| 522 // 12. `quotahost1` | 552 // 12. `idbhost1` |
| 523 // 13. `quotahost2` | 553 // 13. `idbhost2` |
| 524 // 14. `sbc1` | 554 // 14. `quotahost1` |
| 525 // 15. `sbc2` | 555 // 15. `quotahost2` |
| 526 // 16. 'swhost1' | 556 // 16. `sbc1` |
| 527 // 17. 'swhost2' | 557 // 17. `sbc2` |
| 528 // 18. `xyz.com` | 558 // 18. `swhost1` |
| 559 // 19. `swhost2` |
| 560 // 20. `xyz.com` |
| 529 // | 561 // |
| 530 // Here, we'll remove them one by one, starting from the end, and | 562 // Here, we'll remove them one by one, starting from the end, and |
| 531 // check that the state makes sense. | 563 // check that the state makes sense. |
| 532 | 564 |
| 533 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18)); | 565 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(20)); |
| 534 { | 566 { |
| 535 SCOPED_TRACE("`xyz.com` removed."); | 567 SCOPED_TRACE("`xyz.com` removed."); |
| 536 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 568 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 537 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 569 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 538 EXPECT_EQ("http://host1:1/,http://host2:2/", | 570 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 539 GetDisplayedLocalStorages(cookies_model.get())); | 571 GetDisplayedLocalStorages(cookies_model.get())); |
| 540 EXPECT_EQ("http://host1:1/,http://host2:2/", | 572 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 541 GetDisplayedSessionStorages(cookies_model.get())); | 573 GetDisplayedSessionStorages(cookies_model.get())); |
| 542 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 574 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 543 GetDisplayedFileSystems(cookies_model.get())); | 575 GetDisplayedFileSystems(cookies_model.get())); |
| 544 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 576 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 545 GetDisplayedIndexedDBs(cookies_model.get())); | 577 GetDisplayedIndexedDBs(cookies_model.get())); |
| 546 EXPECT_EQ("quotahost1,quotahost2", | 578 EXPECT_EQ("quotahost1,quotahost2", |
| 547 GetDisplayedQuotas(cookies_model.get())); | 579 GetDisplayedQuotas(cookies_model.get())); |
| 548 EXPECT_EQ("sbc1,sbc2", | 580 EXPECT_EQ("sbc1,sbc2", |
| 549 GetDisplayedChannelIDs(cookies_model.get())); | 581 GetDisplayedChannelIDs(cookies_model.get())); |
| 550 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 582 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 551 GetDisplayedServiceWorkers(cookies_model.get())); | 583 GetDisplayedServiceWorkers(cookies_model.get())); |
| 552 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 584 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 585 GetDisplayedCacheStorages(cookies_model.get())); |
| 586 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 587 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 553 } | 588 } |
| 554 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17)); | 589 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(19)); |
| 555 { | 590 { |
| 556 SCOPED_TRACE("`swhost2` removed."); | 591 SCOPED_TRACE("`swhost2` removed."); |
| 557 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 592 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 558 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 593 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 559 EXPECT_EQ("http://host1:1/,http://host2:2/", | 594 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 560 GetDisplayedLocalStorages(cookies_model.get())); | 595 GetDisplayedLocalStorages(cookies_model.get())); |
| 561 EXPECT_EQ("http://host1:1/,http://host2:2/", | 596 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 562 GetDisplayedSessionStorages(cookies_model.get())); | 597 GetDisplayedSessionStorages(cookies_model.get())); |
| 563 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 598 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 564 GetDisplayedFileSystems(cookies_model.get())); | 599 GetDisplayedFileSystems(cookies_model.get())); |
| 565 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 600 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 566 GetDisplayedIndexedDBs(cookies_model.get())); | 601 GetDisplayedIndexedDBs(cookies_model.get())); |
| 567 EXPECT_EQ("quotahost1,quotahost2", | 602 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 568 GetDisplayedQuotas(cookies_model.get())); | 603 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 569 EXPECT_EQ("sbc1,sbc2", | |
| 570 GetDisplayedChannelIDs(cookies_model.get())); | |
| 571 EXPECT_EQ("https://swhost1:1/", | 604 EXPECT_EQ("https://swhost1:1/", |
| 572 GetDisplayedServiceWorkers(cookies_model.get())); | 605 GetDisplayedServiceWorkers(cookies_model.get())); |
| 573 EXPECT_EQ(54, cookies_model->GetRoot()->GetTotalNodeCount()); | 606 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 607 GetDisplayedCacheStorages(cookies_model.get())); |
| 608 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 609 EXPECT_EQ(60, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 574 } | 610 } |
| 575 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16)); | 611 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(18)); |
| 576 { | 612 { |
| 577 SCOPED_TRACE("`swhost1` removed."); | 613 SCOPED_TRACE("`swhost1` removed."); |
| 578 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 614 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 579 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 615 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 580 EXPECT_EQ("http://host1:1/,http://host2:2/", | 616 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 581 GetDisplayedLocalStorages(cookies_model.get())); | 617 GetDisplayedLocalStorages(cookies_model.get())); |
| 582 EXPECT_EQ("http://host1:1/,http://host2:2/", | 618 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 583 GetDisplayedSessionStorages(cookies_model.get())); | 619 GetDisplayedSessionStorages(cookies_model.get())); |
| 584 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 620 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 585 GetDisplayedFileSystems(cookies_model.get())); | 621 GetDisplayedFileSystems(cookies_model.get())); |
| 586 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 622 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 587 GetDisplayedIndexedDBs(cookies_model.get())); | 623 GetDisplayedIndexedDBs(cookies_model.get())); |
| 588 EXPECT_EQ("quotahost1,quotahost2", | 624 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 589 GetDisplayedQuotas(cookies_model.get())); | 625 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 590 EXPECT_EQ("sbc1,sbc2", | |
| 591 GetDisplayedChannelIDs(cookies_model.get())); | |
| 592 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 626 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 593 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); | 627 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 628 GetDisplayedCacheStorages(cookies_model.get())); |
| 629 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 630 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 594 } | 631 } |
| 595 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); | 632 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(17)); |
| 596 { | 633 { |
| 597 SCOPED_TRACE("`sbc2` removed."); | 634 SCOPED_TRACE("`sbc2` removed."); |
| 598 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 635 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 599 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 636 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 600 EXPECT_EQ("http://host1:1/,http://host2:2/", | 637 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 601 GetDisplayedLocalStorages(cookies_model.get())); | 638 GetDisplayedLocalStorages(cookies_model.get())); |
| 602 EXPECT_EQ("http://host1:1/,http://host2:2/", | 639 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 603 GetDisplayedSessionStorages(cookies_model.get())); | 640 GetDisplayedSessionStorages(cookies_model.get())); |
| 604 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 641 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 605 GetDisplayedFileSystems(cookies_model.get())); | 642 GetDisplayedFileSystems(cookies_model.get())); |
| 606 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 643 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 607 GetDisplayedIndexedDBs(cookies_model.get())); | 644 GetDisplayedIndexedDBs(cookies_model.get())); |
| 608 EXPECT_EQ("quotahost1,quotahost2", | 645 EXPECT_EQ("quotahost1,quotahost2", |
| 609 GetDisplayedQuotas(cookies_model.get())); | 646 GetDisplayedQuotas(cookies_model.get())); |
| 610 EXPECT_EQ("sbc1", | 647 EXPECT_EQ("sbc1", |
| 611 GetDisplayedChannelIDs(cookies_model.get())); | 648 GetDisplayedChannelIDs(cookies_model.get())); |
| 612 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 649 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 613 EXPECT_EQ(48, cookies_model->GetRoot()->GetTotalNodeCount()); | 650 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 651 GetDisplayedCacheStorages(cookies_model.get())); |
| 652 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 653 EXPECT_EQ(54, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 614 } | 654 } |
| 615 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); | 655 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(16)); |
| 616 { | 656 { |
| 617 SCOPED_TRACE("`sbc1` removed."); | 657 SCOPED_TRACE("`sbc1` removed."); |
| 618 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 658 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 619 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 659 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 620 EXPECT_EQ("http://host1:1/,http://host2:2/", | 660 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 621 GetDisplayedLocalStorages(cookies_model.get())); | 661 GetDisplayedLocalStorages(cookies_model.get())); |
| 622 EXPECT_EQ("http://host1:1/,http://host2:2/", | 662 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 623 GetDisplayedSessionStorages(cookies_model.get())); | 663 GetDisplayedSessionStorages(cookies_model.get())); |
| 624 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 664 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 625 GetDisplayedFileSystems(cookies_model.get())); | 665 GetDisplayedFileSystems(cookies_model.get())); |
| 626 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 666 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 627 GetDisplayedIndexedDBs(cookies_model.get())); | 667 GetDisplayedIndexedDBs(cookies_model.get())); |
| 628 EXPECT_EQ("quotahost1,quotahost2", | 668 EXPECT_EQ("quotahost1,quotahost2", |
| 629 GetDisplayedQuotas(cookies_model.get())); | 669 GetDisplayedQuotas(cookies_model.get())); |
| 670 EXPECT_EQ("", GetDisplayedChannelIDs(cookies_model.get())); |
| 630 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 671 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 631 EXPECT_EQ(45, cookies_model->GetRoot()->GetTotalNodeCount()); | 672 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 673 GetDisplayedCacheStorages(cookies_model.get())); |
| 674 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 675 EXPECT_EQ(51, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 632 } | 676 } |
| 633 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); | 677 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(15)); |
| 634 { | 678 { |
| 635 SCOPED_TRACE("`quotahost2` removed."); | 679 SCOPED_TRACE("`quotahost2` removed."); |
| 636 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 680 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 637 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 681 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 638 EXPECT_EQ("http://host1:1/,http://host2:2/", | 682 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 639 GetDisplayedLocalStorages(cookies_model.get())); | 683 GetDisplayedLocalStorages(cookies_model.get())); |
| 640 EXPECT_EQ("http://host1:1/,http://host2:2/", | 684 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 641 GetDisplayedSessionStorages(cookies_model.get())); | 685 GetDisplayedSessionStorages(cookies_model.get())); |
| 642 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 686 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 643 GetDisplayedFileSystems(cookies_model.get())); | 687 GetDisplayedFileSystems(cookies_model.get())); |
| 644 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 688 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 645 GetDisplayedIndexedDBs(cookies_model.get())); | 689 GetDisplayedIndexedDBs(cookies_model.get())); |
| 646 EXPECT_EQ("quotahost1", | 690 EXPECT_EQ("quotahost1", |
| 647 GetDisplayedQuotas(cookies_model.get())); | 691 GetDisplayedQuotas(cookies_model.get())); |
| 648 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 692 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 649 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); | 693 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 694 GetDisplayedCacheStorages(cookies_model.get())); |
| 695 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 696 EXPECT_EQ(49, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 650 } | 697 } |
| 651 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); | 698 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(14)); |
| 652 { | 699 { |
| 653 SCOPED_TRACE("`quotahost1` removed."); | 700 SCOPED_TRACE("`quotahost1` removed."); |
| 654 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 701 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 655 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 702 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 656 EXPECT_EQ("http://host1:1/,http://host2:2/", | 703 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 657 GetDisplayedLocalStorages(cookies_model.get())); | 704 GetDisplayedLocalStorages(cookies_model.get())); |
| 658 EXPECT_EQ("http://host1:1/,http://host2:2/", | 705 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 659 GetDisplayedSessionStorages(cookies_model.get())); | 706 GetDisplayedSessionStorages(cookies_model.get())); |
| 660 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 707 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 661 GetDisplayedFileSystems(cookies_model.get())); | 708 GetDisplayedFileSystems(cookies_model.get())); |
| 662 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 709 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 663 GetDisplayedIndexedDBs(cookies_model.get())); | 710 GetDisplayedIndexedDBs(cookies_model.get())); |
| 664 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 711 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 665 EXPECT_EQ(41, 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(47, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 666 } | 716 } |
| 667 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); | 717 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); |
| 668 { | 718 { |
| 669 SCOPED_TRACE("`idbhost2` removed."); | 719 SCOPED_TRACE("`idbhost2` removed."); |
| 670 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 720 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 671 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 721 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 672 EXPECT_EQ("http://host1:1/,http://host2:2/", | 722 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 673 GetDisplayedLocalStorages(cookies_model.get())); | 723 GetDisplayedLocalStorages(cookies_model.get())); |
| 674 EXPECT_EQ("http://host1:1/,http://host2:2/", | 724 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 675 GetDisplayedSessionStorages(cookies_model.get())); | 725 GetDisplayedSessionStorages(cookies_model.get())); |
| 676 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 726 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 677 GetDisplayedFileSystems(cookies_model.get())); | 727 GetDisplayedFileSystems(cookies_model.get())); |
| 678 EXPECT_EQ("http://idbhost1:1/", | 728 EXPECT_EQ("http://idbhost1:1/", |
| 679 GetDisplayedIndexedDBs(cookies_model.get())); | 729 GetDisplayedIndexedDBs(cookies_model.get())); |
| 680 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 730 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 681 EXPECT_EQ(38, cookies_model->GetRoot()->GetTotalNodeCount()); | 731 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 732 GetDisplayedCacheStorages(cookies_model.get())); |
| 733 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 734 EXPECT_EQ(44, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 682 } | 735 } |
| 683 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); | 736 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); |
| 684 { | 737 { |
| 685 SCOPED_TRACE("`idbhost1` removed."); | 738 SCOPED_TRACE("`idbhost1` removed."); |
| 686 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 739 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 687 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 740 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 688 EXPECT_EQ("http://host1:1/,http://host2:2/", | 741 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 689 GetDisplayedLocalStorages(cookies_model.get())); | 742 GetDisplayedLocalStorages(cookies_model.get())); |
| 690 EXPECT_EQ("http://host1:1/,http://host2:2/", | 743 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 691 GetDisplayedSessionStorages(cookies_model.get())); | 744 GetDisplayedSessionStorages(cookies_model.get())); |
| 692 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 745 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 693 GetDisplayedFileSystems(cookies_model.get())); | 746 GetDisplayedFileSystems(cookies_model.get())); |
| 694 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 747 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 695 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 748 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 696 EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); | 749 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 750 GetDisplayedCacheStorages(cookies_model.get())); |
| 751 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 752 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 697 } | 753 } |
| 698 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); | 754 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); |
| 699 { | 755 { |
| 700 SCOPED_TRACE("`host2` removed."); | 756 SCOPED_TRACE("`host2` removed."); |
| 701 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 757 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 702 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 758 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 703 EXPECT_EQ("http://host1:1/", | 759 EXPECT_EQ("http://host1:1/", |
| 704 GetDisplayedLocalStorages(cookies_model.get())); | 760 GetDisplayedLocalStorages(cookies_model.get())); |
| 705 EXPECT_EQ("http://host1:1/", | 761 EXPECT_EQ("http://host1:1/", |
| 706 GetDisplayedSessionStorages(cookies_model.get())); | 762 GetDisplayedSessionStorages(cookies_model.get())); |
| 707 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 763 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 708 GetDisplayedFileSystems(cookies_model.get())); | 764 GetDisplayedFileSystems(cookies_model.get())); |
| 709 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 765 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 710 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 766 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 711 EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount()); | 767 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 768 GetDisplayedCacheStorages(cookies_model.get())); |
| 769 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 770 EXPECT_EQ(36, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 712 } | 771 } |
| 713 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); | 772 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); |
| 714 { | 773 { |
| 715 SCOPED_TRACE("`host1` removed."); | 774 SCOPED_TRACE("`host1` removed."); |
| 716 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 775 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 717 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 776 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 718 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 777 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 719 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 778 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 720 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 779 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 721 GetDisplayedFileSystems(cookies_model.get())); | 780 GetDisplayedFileSystems(cookies_model.get())); |
| 722 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 781 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 723 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 782 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 724 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); | 783 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 784 GetDisplayedCacheStorages(cookies_model.get())); |
| 785 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 786 EXPECT_EQ(31, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 725 } | 787 } |
| 726 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); | 788 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); |
| 727 { | 789 { |
| 728 SCOPED_TRACE("`gdbhost2` removed."); | 790 SCOPED_TRACE("`gdbhost2` removed."); |
| 729 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 791 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 730 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); | 792 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); |
| 731 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 793 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 732 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 794 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 733 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 795 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 734 GetDisplayedFileSystems(cookies_model.get())); | 796 GetDisplayedFileSystems(cookies_model.get())); |
| 735 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 797 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 736 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 798 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 737 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); | 799 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 800 GetDisplayedCacheStorages(cookies_model.get())); |
| 801 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 802 EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 738 } | 803 } |
| 739 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); | 804 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); |
| 740 { | 805 { |
| 741 SCOPED_TRACE("`gdbhost1` removed."); | 806 SCOPED_TRACE("`gdbhost1` removed."); |
| 742 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 807 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 743 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 808 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 744 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 809 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 745 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 810 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 746 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 811 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 747 GetDisplayedFileSystems(cookies_model.get())); | 812 GetDisplayedFileSystems(cookies_model.get())); |
| 748 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 813 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 749 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 814 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 750 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); | 815 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 816 GetDisplayedCacheStorages(cookies_model.get())); |
| 817 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 818 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 751 } | 819 } |
| 752 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); | 820 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); |
| 753 { | 821 { |
| 754 SCOPED_TRACE("`fshost3` removed."); | 822 SCOPED_TRACE("`fshost3` removed."); |
| 755 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 823 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 756 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 824 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 757 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 825 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 758 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 826 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 759 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", | 827 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", |
| 760 GetDisplayedFileSystems(cookies_model.get())); | 828 GetDisplayedFileSystems(cookies_model.get())); |
| 761 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 829 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 762 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 830 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 763 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); | 831 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 832 GetDisplayedCacheStorages(cookies_model.get())); |
| 833 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 834 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 764 } | 835 } |
| 765 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); | 836 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); |
| 766 { | 837 { |
| 767 SCOPED_TRACE("`fshost2` removed."); | 838 SCOPED_TRACE("`fshost2` removed."); |
| 768 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 839 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 769 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 840 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 770 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 841 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 771 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 842 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 772 EXPECT_EQ("http://fshost1:1/", | 843 EXPECT_EQ("http://fshost1:1/", |
| 773 GetDisplayedFileSystems(cookies_model.get())); | 844 GetDisplayedFileSystems(cookies_model.get())); |
| 774 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 845 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 775 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 846 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 776 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); | 847 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 848 GetDisplayedCacheStorages(cookies_model.get())); |
| 849 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 850 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 777 } | 851 } |
| 778 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); | 852 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); |
| 779 { | 853 { |
| 780 SCOPED_TRACE("`fshost1` removed."); | 854 SCOPED_TRACE("`fshost1` removed."); |
| 781 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 855 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 782 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 856 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 783 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 857 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 784 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 858 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 785 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 859 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 786 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 860 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 787 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 861 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 788 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); | 862 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 863 GetDisplayedCacheStorages(cookies_model.get())); |
| 864 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 865 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 789 } | 866 } |
| 790 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); | 867 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); |
| 791 { | 868 { |
| 792 SCOPED_TRACE("`foo3` removed."); | 869 SCOPED_TRACE("`foo3` removed."); |
| 793 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); | 870 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 794 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 871 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 795 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 872 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 796 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 873 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 797 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 874 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 798 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 875 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 799 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 876 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 800 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); | 877 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 878 GetDisplayedCacheStorages(cookies_model.get())); |
| 879 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 880 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 801 } | 881 } |
| 802 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); | 882 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); |
| 803 { | 883 { |
| 804 SCOPED_TRACE("`foo2` removed."); | 884 SCOPED_TRACE("`foo2` removed."); |
| 805 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); | 885 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 806 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 886 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 807 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 887 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 808 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 888 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 809 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 889 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 810 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 890 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 811 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 891 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 812 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); | 892 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 893 GetDisplayedCacheStorages(cookies_model.get())); |
| 894 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 895 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 813 } | 896 } |
| 814 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); | 897 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); |
| 815 { | 898 { |
| 816 SCOPED_TRACE("`foo1` removed."); | 899 SCOPED_TRACE("`foo1` removed."); |
| 817 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); | 900 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 818 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 901 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 819 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 902 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 903 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 904 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 905 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 906 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 907 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 908 GetDisplayedCacheStorages(cookies_model.get())); |
| 909 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 910 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 911 } |
| 912 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); |
| 913 { |
| 914 SCOPED_TRACE("`cshost2` removed."); |
| 915 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 916 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 917 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 918 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 919 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 920 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 921 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 922 EXPECT_EQ("https://cshost1:1/", |
| 923 GetDisplayedCacheStorages(cookies_model.get())); |
| 924 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 925 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 926 } |
| 927 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); |
| 928 { |
| 929 SCOPED_TRACE("`cshost1` removed."); |
| 930 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 931 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 932 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 820 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 933 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 821 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 934 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 822 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 935 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 823 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 936 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 937 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get())); |
| 938 EXPECT_EQ("", GetDisplayedFlashLSOs(cookies_model.get())); |
| 824 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 939 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 825 } | 940 } |
| 826 } | 941 } |
| 827 | 942 |
| 828 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { | 943 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { |
| 829 scoped_ptr<CookiesTreeModel> cookies_model( | 944 scoped_ptr<CookiesTreeModel> cookies_model( |
| 830 CreateCookiesTreeModelWithInitialSample()); | 945 CreateCookiesTreeModelWithInitialSample()); |
| 831 | 946 |
| 832 DeleteStoredObjects( | 947 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)->GetChild(0)); |
| 833 cookies_model->GetRoot()->GetChild(0)->GetChild(0)); | |
| 834 { | 948 { |
| 835 SCOPED_TRACE("First origin removed"); | 949 SCOPED_TRACE("First cookies origin removed"); |
| 836 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 950 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 837 // 57 because in this case, the origin remains, although the COOKIES | 951 // 63 because in this case, the origin remains, although the COOKIES |
| 838 // node beneath it has been deleted. | 952 // node beneath it has been deleted. |
| 839 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 953 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 840 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 954 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 841 EXPECT_EQ("http://host1:1/,http://host2:2/", | 955 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 842 GetDisplayedLocalStorages(cookies_model.get())); | 956 GetDisplayedLocalStorages(cookies_model.get())); |
| 843 EXPECT_EQ("http://host1:1/,http://host2:2/", | 957 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 844 GetDisplayedSessionStorages(cookies_model.get())); | 958 GetDisplayedSessionStorages(cookies_model.get())); |
| 845 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 959 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 846 GetDisplayedIndexedDBs(cookies_model.get())); | 960 GetDisplayedIndexedDBs(cookies_model.get())); |
| 847 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 961 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 848 GetDisplayedFileSystems(cookies_model.get())); | 962 GetDisplayedFileSystems(cookies_model.get())); |
| 849 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 963 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 850 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 964 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 851 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 965 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 852 GetDisplayedServiceWorkers(cookies_model.get())); | 966 GetDisplayedServiceWorkers(cookies_model.get())); |
| 967 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 968 GetDisplayedCacheStorages(cookies_model.get())); |
| 853 } | 969 } |
| 854 | 970 |
| 855 DeleteStoredObjects( | 971 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
| 856 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | |
| 857 { | 972 { |
| 858 SCOPED_TRACE("First database removed"); | 973 SCOPED_TRACE("First database origin removed"); |
| 859 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 974 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 860 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 975 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 861 EXPECT_EQ("http://host1:1/,http://host2:2/", | 976 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 862 GetDisplayedLocalStorages(cookies_model.get())); | 977 GetDisplayedLocalStorages(cookies_model.get())); |
| 863 EXPECT_EQ("http://host1:1/,http://host2:2/", | 978 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 864 GetDisplayedSessionStorages(cookies_model.get())); | 979 GetDisplayedSessionStorages(cookies_model.get())); |
| 865 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 980 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 866 GetDisplayedIndexedDBs(cookies_model.get())); | 981 GetDisplayedIndexedDBs(cookies_model.get())); |
| 867 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 982 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 868 GetDisplayedFileSystems(cookies_model.get())); | 983 GetDisplayedFileSystems(cookies_model.get())); |
| 869 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 984 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 870 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 985 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 871 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 986 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 872 GetDisplayedServiceWorkers(cookies_model.get())); | 987 GetDisplayedServiceWorkers(cookies_model.get())); |
| 873 EXPECT_EQ(55, cookies_model->GetRoot()->GetTotalNodeCount()); | 988 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 989 GetDisplayedCacheStorages(cookies_model.get())); |
| 990 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 874 } | 991 } |
| 875 | 992 |
| 876 DeleteStoredObjects( | 993 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); |
| 877 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | |
| 878 { | 994 { |
| 879 SCOPED_TRACE("First origin removed"); | 995 SCOPED_TRACE("First local storage origin removed"); |
| 880 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 996 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 881 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 997 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 882 EXPECT_EQ("http://host2:2/", | 998 EXPECT_EQ("http://host2:2/", |
| 883 GetDisplayedLocalStorages(cookies_model.get())); | 999 GetDisplayedLocalStorages(cookies_model.get())); |
| 884 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1000 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 885 GetDisplayedSessionStorages(cookies_model.get())); | 1001 GetDisplayedSessionStorages(cookies_model.get())); |
| 886 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1002 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 887 GetDisplayedIndexedDBs(cookies_model.get())); | 1003 GetDisplayedIndexedDBs(cookies_model.get())); |
| 888 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1004 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 889 GetDisplayedFileSystems(cookies_model.get())); | 1005 GetDisplayedFileSystems(cookies_model.get())); |
| 890 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1006 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 891 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1007 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 892 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1008 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 893 GetDisplayedServiceWorkers(cookies_model.get())); | 1009 GetDisplayedServiceWorkers(cookies_model.get())); |
| 894 EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); | 1010 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1011 GetDisplayedCacheStorages(cookies_model.get())); |
| 1012 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 895 } | 1013 } |
| 896 } | 1014 } |
| 897 | 1015 |
| 898 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { | 1016 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { |
| 899 scoped_ptr<CookiesTreeModel> cookies_model( | 1017 scoped_ptr<CookiesTreeModel> cookies_model( |
| 900 CreateCookiesTreeModelWithInitialSample()); | 1018 CreateCookiesTreeModelWithInitialSample()); |
| 901 | 1019 |
| 902 DeleteStoredObjects( | 1020 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0)); |
| 903 cookies_model->GetRoot()->GetChild(1)->GetChild(0)); | |
| 904 { | 1021 { |
| 905 SCOPED_TRACE("Second origin COOKIES node removed"); | 1022 SCOPED_TRACE("Second origin COOKIES node removed"); |
| 906 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 1023 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 907 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 1024 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 908 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1025 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 909 GetDisplayedLocalStorages(cookies_model.get())); | 1026 GetDisplayedLocalStorages(cookies_model.get())); |
| 910 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1027 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 911 GetDisplayedSessionStorages(cookies_model.get())); | 1028 GetDisplayedSessionStorages(cookies_model.get())); |
| 912 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1029 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 913 GetDisplayedIndexedDBs(cookies_model.get())); | 1030 GetDisplayedIndexedDBs(cookies_model.get())); |
| 914 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1031 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 915 GetDisplayedFileSystems(cookies_model.get())); | 1032 GetDisplayedFileSystems(cookies_model.get())); |
| 916 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1033 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 917 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1034 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 918 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1035 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 919 GetDisplayedServiceWorkers(cookies_model.get())); | 1036 GetDisplayedServiceWorkers(cookies_model.get())); |
| 920 // 57 because in this case, the origin remains, although the COOKIES | 1037 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1038 GetDisplayedCacheStorages(cookies_model.get())); |
| 1039 // 63 because in this case, the origin remains, although the COOKIES |
| 921 // node beneath it has been deleted. | 1040 // node beneath it has been deleted. |
| 922 EXPECT_EQ(57, cookies_model->GetRoot()->GetTotalNodeCount()); | 1041 EXPECT_EQ(63, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 923 } | 1042 } |
| 924 | 1043 |
| 925 DeleteStoredObjects( | 1044 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
| 926 cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | |
| 927 { | 1045 { |
| 928 SCOPED_TRACE("First database removed"); | 1046 SCOPED_TRACE("First database origin removed"); |
| 929 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 1047 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 930 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 1048 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 931 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1049 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 932 GetDisplayedLocalStorages(cookies_model.get())); | 1050 GetDisplayedLocalStorages(cookies_model.get())); |
| 933 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1051 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 934 GetDisplayedSessionStorages(cookies_model.get())); | 1052 GetDisplayedSessionStorages(cookies_model.get())); |
| 935 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1053 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 936 GetDisplayedIndexedDBs(cookies_model.get())); | 1054 GetDisplayedIndexedDBs(cookies_model.get())); |
| 937 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1055 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 938 GetDisplayedFileSystems(cookies_model.get())); | 1056 GetDisplayedFileSystems(cookies_model.get())); |
| 939 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1057 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 940 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1058 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 941 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1059 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 942 GetDisplayedServiceWorkers(cookies_model.get())); | 1060 GetDisplayedServiceWorkers(cookies_model.get())); |
| 943 EXPECT_EQ(55, cookies_model->GetRoot()->GetTotalNodeCount()); | 1061 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1062 GetDisplayedCacheStorages(cookies_model.get())); |
| 1063 EXPECT_EQ(61, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 944 } | 1064 } |
| 945 | 1065 |
| 946 DeleteStoredObjects( | 1066 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)->GetChild(0)); |
| 947 cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | |
| 948 { | 1067 { |
| 949 SCOPED_TRACE("First origin removed"); | 1068 SCOPED_TRACE("First local storage origin removed"); |
| 950 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 1069 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 951 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 1070 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 952 EXPECT_EQ("http://host2:2/", | 1071 EXPECT_EQ("http://host2:2/", |
| 953 GetDisplayedLocalStorages(cookies_model.get())); | 1072 GetDisplayedLocalStorages(cookies_model.get())); |
| 954 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1073 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 955 GetDisplayedSessionStorages(cookies_model.get())); | 1074 GetDisplayedSessionStorages(cookies_model.get())); |
| 956 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1075 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 957 GetDisplayedIndexedDBs(cookies_model.get())); | 1076 GetDisplayedIndexedDBs(cookies_model.get())); |
| 958 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1077 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 959 GetDisplayedFileSystems(cookies_model.get())); | 1078 GetDisplayedFileSystems(cookies_model.get())); |
| 960 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 1079 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 961 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); | 1080 EXPECT_EQ("sbc1,sbc2", GetDisplayedChannelIDs(cookies_model.get())); |
| 962 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1081 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 963 GetDisplayedServiceWorkers(cookies_model.get())); | 1082 GetDisplayedServiceWorkers(cookies_model.get())); |
| 964 EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); | 1083 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1084 GetDisplayedCacheStorages(cookies_model.get())); |
| 1085 EXPECT_EQ(59, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 965 } | 1086 } |
| 966 } | 1087 } |
| 967 | 1088 |
| 968 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { | 1089 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { |
| 969 LocalDataContainer* container = | 1090 LocalDataContainer* container = |
| 970 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1091 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 971 mock_browsing_data_database_helper_.get(), | 1092 mock_browsing_data_database_helper_.get(), |
| 972 mock_browsing_data_local_storage_helper_.get(), | 1093 mock_browsing_data_local_storage_helper_.get(), |
| 973 mock_browsing_data_session_storage_helper_.get(), | 1094 mock_browsing_data_session_storage_helper_.get(), |
| 974 mock_browsing_data_appcache_helper_.get(), | 1095 mock_browsing_data_appcache_helper_.get(), |
| 975 mock_browsing_data_indexed_db_helper_.get(), | 1096 mock_browsing_data_indexed_db_helper_.get(), |
| 976 mock_browsing_data_file_system_helper_.get(), | 1097 mock_browsing_data_file_system_helper_.get(), |
| 977 mock_browsing_data_quota_helper_.get(), | 1098 mock_browsing_data_quota_helper_.get(), |
| 978 mock_browsing_data_channel_id_helper_.get(), | 1099 mock_browsing_data_channel_id_helper_.get(), |
| 979 mock_browsing_data_service_worker_helper_.get(), | 1100 mock_browsing_data_service_worker_helper_.get(), |
| 1101 mock_browsing_data_cache_storage_helper_.get(), |
| 980 mock_browsing_data_flash_lso_helper_.get()); | 1102 mock_browsing_data_flash_lso_helper_.get()); |
| 981 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1103 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 982 | 1104 |
| 983 mock_browsing_data_cookie_helper_-> | 1105 mock_browsing_data_cookie_helper_-> |
| 984 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1106 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 985 mock_browsing_data_cookie_helper_-> | 1107 mock_browsing_data_cookie_helper_-> |
| 986 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1108 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 987 mock_browsing_data_cookie_helper_-> | 1109 mock_browsing_data_cookie_helper_-> |
| 988 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1110 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 989 mock_browsing_data_cookie_helper_-> | 1111 mock_browsing_data_cookie_helper_-> |
| 990 AddCookieSamples(GURL("http://foo3"), "D=1"); | 1112 AddCookieSamples(GURL("http://foo3"), "D=1"); |
| 991 mock_browsing_data_cookie_helper_->Notify(); | 1113 mock_browsing_data_cookie_helper_->Notify(); |
| 992 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 1114 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 993 mock_browsing_data_database_helper_->Notify(); | 1115 mock_browsing_data_database_helper_->Notify(); |
| 994 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 1116 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 995 mock_browsing_data_local_storage_helper_->Notify(); | 1117 mock_browsing_data_local_storage_helper_->Notify(); |
| 996 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 1118 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 997 mock_browsing_data_session_storage_helper_->Notify(); | 1119 mock_browsing_data_session_storage_helper_->Notify(); |
| 998 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 1120 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 999 mock_browsing_data_indexed_db_helper_->Notify(); | 1121 mock_browsing_data_indexed_db_helper_->Notify(); |
| 1000 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 1122 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 1001 mock_browsing_data_file_system_helper_->Notify(); | 1123 mock_browsing_data_file_system_helper_->Notify(); |
| 1002 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 1124 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
| 1003 mock_browsing_data_quota_helper_->Notify(); | 1125 mock_browsing_data_quota_helper_->Notify(); |
| 1004 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); | 1126 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); |
| 1005 mock_browsing_data_service_worker_helper_->Notify(); | 1127 mock_browsing_data_service_worker_helper_->Notify(); |
| 1128 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); |
| 1129 mock_browsing_data_cache_storage_helper_->Notify(); |
| 1006 | 1130 |
| 1007 { | 1131 { |
| 1008 SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, " | 1132 SCOPED_TRACE( |
| 1009 "2 session storages, 2 indexed DBs, 3 file systems, " | 1133 "Initial State 4 cookies, 2 databases, 2 local storages, " |
| 1010 "2 quotas, 2 service workers."); | 1134 "2 session storages, 2 indexed DBs, 3 file systems, " |
| 1011 // 52 because there's the root, then | 1135 "2 quotas, 2 service workers, 2 caches."); |
| 1136 // 58 because there's the root, then |
| 1137 // cshost1 -> cache storage -> https://cshost1:1/ |
| 1138 // cshost2 -> cache storage -> https://cshost2:2/ |
| 1012 // foo1 -> cookies -> a, | 1139 // foo1 -> cookies -> a, |
| 1013 // foo2 -> cookies -> b, | 1140 // foo2 -> cookies -> b, |
| 1014 // foo3 -> cookies -> c,d | 1141 // foo3 -> cookies -> c,d |
| 1015 // dbhost1 -> database -> db1, | 1142 // dbhost1 -> database -> db1, |
| 1016 // dbhost2 -> database -> db2, | 1143 // dbhost2 -> database -> db2, |
| 1017 // host1 -> localstorage -> http://host1:1/, | 1144 // host1 -> localstorage -> http://host1:1/, |
| 1018 // -> sessionstorage -> http://host1:1/, | 1145 // -> sessionstorage -> http://host1:1/, |
| 1019 // host2 -> localstorage -> http://host2:2/, | 1146 // host2 -> localstorage -> http://host2:2/, |
| 1020 // -> sessionstorage -> http://host2:2/, | 1147 // -> sessionstorage -> http://host2:2/, |
| 1021 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 1148 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
| 1022 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 1149 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
| 1023 // fshost1 -> filesystem -> http://fshost1:1/, | 1150 // fshost1 -> filesystem -> http://fshost1:1/, |
| 1024 // fshost2 -> filesystem -> http://fshost2:1/, | 1151 // fshost2 -> filesystem -> http://fshost2:1/, |
| 1025 // fshost3 -> filesystem -> http://fshost3:1/, | 1152 // fshost3 -> filesystem -> http://fshost3:1/, |
| 1026 // quotahost1 -> quotahost1, | 1153 // quotahost1 -> quotahost1, |
| 1027 // quotahost2 -> quotahost2. | 1154 // quotahost2 -> quotahost2. |
| 1028 // swhost1 -> service worker -> https://swhost1:1 | 1155 // swhost1 -> service worker -> https://swhost1:1 |
| 1029 // swhost2 -> service worker -> https://swhost1:2 | 1156 // swhost2 -> service worker -> https://swhost1:2 |
| 1030 EXPECT_EQ(52, cookies_model.GetRoot()->GetTotalNodeCount()); | 1157 EXPECT_EQ(58, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 1031 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); | 1158 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); |
| 1032 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1159 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 1033 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1160 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1034 GetDisplayedLocalStorages(&cookies_model)); | 1161 GetDisplayedLocalStorages(&cookies_model)); |
| 1035 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1162 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1036 GetDisplayedSessionStorages(&cookies_model)); | 1163 GetDisplayedSessionStorages(&cookies_model)); |
| 1037 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1164 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 1038 GetDisplayedIndexedDBs(&cookies_model)); | 1165 GetDisplayedIndexedDBs(&cookies_model)); |
| 1039 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1166 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1040 GetDisplayedFileSystems(&cookies_model)); | 1167 GetDisplayedFileSystems(&cookies_model)); |
| 1041 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1168 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 1042 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1169 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 1043 GetDisplayedServiceWorkers(&cookies_model)); | 1170 GetDisplayedServiceWorkers(&cookies_model)); |
| 1171 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1172 GetDisplayedCacheStorages(&cookies_model)); |
| 1044 } | 1173 } |
| 1045 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)); | 1174 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(4)); |
| 1046 { | 1175 { |
| 1047 SCOPED_TRACE("Third origin removed"); | 1176 SCOPED_TRACE("Third cookie origin removed"); |
| 1048 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); | 1177 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); |
| 1049 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1178 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 1050 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1179 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1051 GetDisplayedLocalStorages(&cookies_model)); | 1180 GetDisplayedLocalStorages(&cookies_model)); |
| 1052 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1181 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1053 GetDisplayedSessionStorages(&cookies_model)); | 1182 GetDisplayedSessionStorages(&cookies_model)); |
| 1054 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1183 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 1055 GetDisplayedIndexedDBs(&cookies_model)); | 1184 GetDisplayedIndexedDBs(&cookies_model)); |
| 1056 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1185 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1057 GetDisplayedFileSystems(&cookies_model)); | 1186 GetDisplayedFileSystems(&cookies_model)); |
| 1058 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1187 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 1059 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1188 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 1060 GetDisplayedServiceWorkers(&cookies_model)); | 1189 GetDisplayedServiceWorkers(&cookies_model)); |
| 1061 EXPECT_EQ(48, cookies_model.GetRoot()->GetTotalNodeCount()); | 1190 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1191 GetDisplayedCacheStorages(&cookies_model)); |
| 1192 EXPECT_EQ(54, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 1062 } | 1193 } |
| 1063 } | 1194 } |
| 1064 | 1195 |
| 1065 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { | 1196 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { |
| 1066 LocalDataContainer* container = | 1197 LocalDataContainer* container = |
| 1067 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1198 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1068 mock_browsing_data_database_helper_.get(), | 1199 mock_browsing_data_database_helper_.get(), |
| 1069 mock_browsing_data_local_storage_helper_.get(), | 1200 mock_browsing_data_local_storage_helper_.get(), |
| 1070 mock_browsing_data_session_storage_helper_.get(), | 1201 mock_browsing_data_session_storage_helper_.get(), |
| 1071 mock_browsing_data_appcache_helper_.get(), | 1202 mock_browsing_data_appcache_helper_.get(), |
| 1072 mock_browsing_data_indexed_db_helper_.get(), | 1203 mock_browsing_data_indexed_db_helper_.get(), |
| 1073 mock_browsing_data_file_system_helper_.get(), | 1204 mock_browsing_data_file_system_helper_.get(), |
| 1074 mock_browsing_data_quota_helper_.get(), | 1205 mock_browsing_data_quota_helper_.get(), |
| 1075 mock_browsing_data_channel_id_helper_.get(), | 1206 mock_browsing_data_channel_id_helper_.get(), |
| 1076 mock_browsing_data_service_worker_helper_.get(), | 1207 mock_browsing_data_service_worker_helper_.get(), |
| 1208 mock_browsing_data_cache_storage_helper_.get(), |
| 1077 mock_browsing_data_flash_lso_helper_.get()); | 1209 mock_browsing_data_flash_lso_helper_.get()); |
| 1078 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1210 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 1079 | 1211 |
| 1080 mock_browsing_data_cookie_helper_-> | 1212 mock_browsing_data_cookie_helper_-> |
| 1081 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1213 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 1082 mock_browsing_data_cookie_helper_-> | 1214 mock_browsing_data_cookie_helper_-> |
| 1083 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1215 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 1084 mock_browsing_data_cookie_helper_-> | 1216 mock_browsing_data_cookie_helper_-> |
| 1085 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1217 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 1086 mock_browsing_data_cookie_helper_-> | 1218 mock_browsing_data_cookie_helper_-> |
| 1087 AddCookieSamples(GURL("http://foo3"), "D=1"); | 1219 AddCookieSamples(GURL("http://foo3"), "D=1"); |
| 1088 mock_browsing_data_cookie_helper_-> | 1220 mock_browsing_data_cookie_helper_-> |
| 1089 AddCookieSamples(GURL("http://foo3"), "E=1"); | 1221 AddCookieSamples(GURL("http://foo3"), "E=1"); |
| 1090 mock_browsing_data_cookie_helper_->Notify(); | 1222 mock_browsing_data_cookie_helper_->Notify(); |
| 1091 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 1223 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 1092 mock_browsing_data_database_helper_->Notify(); | 1224 mock_browsing_data_database_helper_->Notify(); |
| 1093 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 1225 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 1094 mock_browsing_data_local_storage_helper_->Notify(); | 1226 mock_browsing_data_local_storage_helper_->Notify(); |
| 1095 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 1227 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 1096 mock_browsing_data_session_storage_helper_->Notify(); | 1228 mock_browsing_data_session_storage_helper_->Notify(); |
| 1097 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 1229 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 1098 mock_browsing_data_indexed_db_helper_->Notify(); | 1230 mock_browsing_data_indexed_db_helper_->Notify(); |
| 1099 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 1231 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 1100 mock_browsing_data_file_system_helper_->Notify(); | 1232 mock_browsing_data_file_system_helper_->Notify(); |
| 1101 mock_browsing_data_quota_helper_->AddQuotaSamples(); | 1233 mock_browsing_data_quota_helper_->AddQuotaSamples(); |
| 1102 mock_browsing_data_quota_helper_->Notify(); | 1234 mock_browsing_data_quota_helper_->Notify(); |
| 1103 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); | 1235 mock_browsing_data_service_worker_helper_->AddServiceWorkerSamples(); |
| 1104 mock_browsing_data_service_worker_helper_->Notify(); | 1236 mock_browsing_data_service_worker_helper_->Notify(); |
| 1237 mock_browsing_data_cache_storage_helper_->AddCacheStorageSamples(); |
| 1238 mock_browsing_data_cache_storage_helper_->Notify(); |
| 1105 | 1239 |
| 1106 { | 1240 { |
| 1107 SCOPED_TRACE("Initial State 5 cookies, 2 databases, 2 local storages, " | 1241 SCOPED_TRACE( |
| 1108 "2 session storages, 2 indexed DBs, 3 filesystems, " | 1242 "Initial State 5 cookies, 2 databases, 2 local storages, " |
| 1109 "2 quotas, 2 service workers."); | 1243 "2 session storages, 2 indexed DBs, 3 filesystems, " |
| 1110 // 53 because there's the root, then | 1244 "2 quotas, 2 service workers, 2 caches."); |
| 1245 // 59 because there's the root, then |
| 1246 // cshost1 -> cache storage -> https://cshost1:1/ |
| 1247 // cshost2 -> cache storage -> https://cshost2:2/ |
| 1111 // foo1 -> cookies -> a, | 1248 // foo1 -> cookies -> a, |
| 1112 // foo2 -> cookies -> b, | 1249 // foo2 -> cookies -> b, |
| 1113 // foo3 -> cookies -> c,d,e | 1250 // foo3 -> cookies -> c,d,e |
| 1114 // dbhost1 -> database -> db1, | 1251 // dbhost1 -> database -> db1, |
| 1115 // dbhost2 -> database -> db2, | 1252 // dbhost2 -> database -> db2, |
| 1116 // host1 -> localstorage -> http://host1:1/, | 1253 // host1 -> localstorage -> http://host1:1/, |
| 1117 // -> sessionstorage -> http://host1:1/, | 1254 // -> sessionstorage -> http://host1:1/, |
| 1118 // host2 -> localstorage -> http://host2:2/, | 1255 // host2 -> localstorage -> http://host2:2/, |
| 1119 // -> sessionstorage -> http://host2:2/, | 1256 // -> sessionstorage -> http://host2:2/, |
| 1120 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 1257 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
| 1121 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 1258 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
| 1122 // fshost1 -> filesystem -> http://fshost1:1/, | 1259 // fshost1 -> filesystem -> http://fshost1:1/, |
| 1123 // fshost2 -> filesystem -> http://fshost2:1/, | 1260 // fshost2 -> filesystem -> http://fshost2:1/, |
| 1124 // fshost3 -> filesystem -> http://fshost3:1/, | 1261 // fshost3 -> filesystem -> http://fshost3:1/, |
| 1125 // quotahost1 -> quotahost1, | 1262 // quotahost1 -> quotahost1, |
| 1126 // quotahost2 -> quotahost2. | 1263 // quotahost2 -> quotahost2. |
| 1127 // swhost1 -> service worker -> https://swhost1:1 | 1264 // swhost1 -> service worker -> https://swhost1:1 |
| 1128 // swhost2 -> service worker -> https://swhost1:2 | 1265 // swhost2 -> service worker -> https://swhost1:2 |
| 1129 EXPECT_EQ(53, cookies_model.GetRoot()->GetTotalNodeCount()); | 1266 EXPECT_EQ(59, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 1130 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 1267 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 1131 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1268 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 1132 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1269 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1133 GetDisplayedLocalStorages(&cookies_model)); | 1270 GetDisplayedLocalStorages(&cookies_model)); |
| 1134 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1271 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1135 GetDisplayedSessionStorages(&cookies_model)); | 1272 GetDisplayedSessionStorages(&cookies_model)); |
| 1136 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1273 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 1137 GetDisplayedIndexedDBs(&cookies_model)); | 1274 GetDisplayedIndexedDBs(&cookies_model)); |
| 1138 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1275 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1139 GetDisplayedFileSystems(&cookies_model)); | 1276 GetDisplayedFileSystems(&cookies_model)); |
| 1140 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1277 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 1141 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1278 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 1142 GetDisplayedServiceWorkers(&cookies_model)); | 1279 GetDisplayedServiceWorkers(&cookies_model)); |
| 1280 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1281 GetDisplayedCacheStorages(&cookies_model)); |
| 1143 } | 1282 } |
| 1144 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)-> | 1283 DeleteStoredObjects( |
| 1145 GetChild(1)); | 1284 cookies_model.GetRoot()->GetChild(4)->GetChild(0)->GetChild(1)); |
| 1146 { | 1285 { |
| 1147 SCOPED_TRACE("Middle cookie in third origin removed"); | 1286 SCOPED_TRACE("Middle cookie in third cookie origin removed"); |
| 1148 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); | 1287 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 1149 EXPECT_EQ(52, cookies_model.GetRoot()->GetTotalNodeCount()); | 1288 EXPECT_EQ(58, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 1150 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 1289 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 1151 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1290 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1152 GetDisplayedLocalStorages(&cookies_model)); | 1291 GetDisplayedLocalStorages(&cookies_model)); |
| 1153 EXPECT_EQ("http://host1:1/,http://host2:2/", | 1292 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 1154 GetDisplayedSessionStorages(&cookies_model)); | 1293 GetDisplayedSessionStorages(&cookies_model)); |
| 1155 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 1294 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 1156 GetDisplayedIndexedDBs(&cookies_model)); | 1295 GetDisplayedIndexedDBs(&cookies_model)); |
| 1157 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1296 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1158 GetDisplayedFileSystems(&cookies_model)); | 1297 GetDisplayedFileSystems(&cookies_model)); |
| 1159 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 1298 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 1160 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1299 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 1161 GetDisplayedServiceWorkers(&cookies_model)); | 1300 GetDisplayedServiceWorkers(&cookies_model)); |
| 1301 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1302 GetDisplayedCacheStorages(&cookies_model)); |
| 1162 } | 1303 } |
| 1163 } | 1304 } |
| 1164 | 1305 |
| 1165 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 1306 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
| 1166 LocalDataContainer* container = | 1307 LocalDataContainer* container = |
| 1167 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1308 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1168 mock_browsing_data_database_helper_.get(), | 1309 mock_browsing_data_database_helper_.get(), |
| 1169 mock_browsing_data_local_storage_helper_.get(), | 1310 mock_browsing_data_local_storage_helper_.get(), |
| 1170 mock_browsing_data_session_storage_helper_.get(), | 1311 mock_browsing_data_session_storage_helper_.get(), |
| 1171 mock_browsing_data_appcache_helper_.get(), | 1312 mock_browsing_data_appcache_helper_.get(), |
| 1172 mock_browsing_data_indexed_db_helper_.get(), | 1313 mock_browsing_data_indexed_db_helper_.get(), |
| 1173 mock_browsing_data_file_system_helper_.get(), | 1314 mock_browsing_data_file_system_helper_.get(), |
| 1174 mock_browsing_data_quota_helper_.get(), | 1315 mock_browsing_data_quota_helper_.get(), |
| 1175 mock_browsing_data_channel_id_helper_.get(), | 1316 mock_browsing_data_channel_id_helper_.get(), |
| 1176 mock_browsing_data_service_worker_helper_.get(), | 1317 mock_browsing_data_service_worker_helper_.get(), |
| 1318 mock_browsing_data_cache_storage_helper_.get(), |
| 1177 mock_browsing_data_flash_lso_helper_.get()); | 1319 mock_browsing_data_flash_lso_helper_.get()); |
| 1178 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1320 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 1179 | 1321 |
| 1180 mock_browsing_data_cookie_helper_-> | 1322 mock_browsing_data_cookie_helper_-> |
| 1181 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1323 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 1182 mock_browsing_data_cookie_helper_-> | 1324 mock_browsing_data_cookie_helper_-> |
| 1183 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1325 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 1184 mock_browsing_data_cookie_helper_-> | 1326 mock_browsing_data_cookie_helper_-> |
| 1185 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1327 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 1186 mock_browsing_data_cookie_helper_-> | 1328 mock_browsing_data_cookie_helper_-> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1210 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1352 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1211 mock_browsing_data_database_helper_.get(), | 1353 mock_browsing_data_database_helper_.get(), |
| 1212 mock_browsing_data_local_storage_helper_.get(), | 1354 mock_browsing_data_local_storage_helper_.get(), |
| 1213 mock_browsing_data_session_storage_helper_.get(), | 1355 mock_browsing_data_session_storage_helper_.get(), |
| 1214 mock_browsing_data_appcache_helper_.get(), | 1356 mock_browsing_data_appcache_helper_.get(), |
| 1215 mock_browsing_data_indexed_db_helper_.get(), | 1357 mock_browsing_data_indexed_db_helper_.get(), |
| 1216 mock_browsing_data_file_system_helper_.get(), | 1358 mock_browsing_data_file_system_helper_.get(), |
| 1217 mock_browsing_data_quota_helper_.get(), | 1359 mock_browsing_data_quota_helper_.get(), |
| 1218 mock_browsing_data_channel_id_helper_.get(), | 1360 mock_browsing_data_channel_id_helper_.get(), |
| 1219 mock_browsing_data_service_worker_helper_.get(), | 1361 mock_browsing_data_service_worker_helper_.get(), |
| 1362 mock_browsing_data_cache_storage_helper_.get(), |
| 1220 mock_browsing_data_flash_lso_helper_.get()); | 1363 mock_browsing_data_flash_lso_helper_.get()); |
| 1221 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1364 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 1222 | 1365 |
| 1223 mock_browsing_data_cookie_helper_-> | 1366 mock_browsing_data_cookie_helper_-> |
| 1224 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); | 1367 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); |
| 1225 mock_browsing_data_cookie_helper_-> | 1368 mock_browsing_data_cookie_helper_-> |
| 1226 AddCookieSamples(GURL("http://foo2.com"), "B=1"); | 1369 AddCookieSamples(GURL("http://foo2.com"), "B=1"); |
| 1227 mock_browsing_data_cookie_helper_-> | 1370 mock_browsing_data_cookie_helper_-> |
| 1228 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); | 1371 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); |
| 1229 // Leading dot on the foo4 | 1372 // Leading dot on the foo4 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1258 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1401 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1259 mock_browsing_data_database_helper_.get(), | 1402 mock_browsing_data_database_helper_.get(), |
| 1260 mock_browsing_data_local_storage_helper_.get(), | 1403 mock_browsing_data_local_storage_helper_.get(), |
| 1261 mock_browsing_data_session_storage_helper_.get(), | 1404 mock_browsing_data_session_storage_helper_.get(), |
| 1262 mock_browsing_data_appcache_helper_.get(), | 1405 mock_browsing_data_appcache_helper_.get(), |
| 1263 mock_browsing_data_indexed_db_helper_.get(), | 1406 mock_browsing_data_indexed_db_helper_.get(), |
| 1264 mock_browsing_data_file_system_helper_.get(), | 1407 mock_browsing_data_file_system_helper_.get(), |
| 1265 mock_browsing_data_quota_helper_.get(), | 1408 mock_browsing_data_quota_helper_.get(), |
| 1266 mock_browsing_data_channel_id_helper_.get(), | 1409 mock_browsing_data_channel_id_helper_.get(), |
| 1267 mock_browsing_data_service_worker_helper_.get(), | 1410 mock_browsing_data_service_worker_helper_.get(), |
| 1411 mock_browsing_data_cache_storage_helper_.get(), |
| 1268 mock_browsing_data_flash_lso_helper_.get()); | 1412 mock_browsing_data_flash_lso_helper_.get()); |
| 1269 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1413 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 1270 | 1414 |
| 1271 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); | 1415 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); |
| 1272 mock_browsing_data_cookie_helper_->Notify(); | 1416 mock_browsing_data_cookie_helper_->Notify(); |
| 1273 | 1417 |
| 1274 TestingProfile profile; | 1418 TestingProfile profile; |
| 1275 HostContentSettingsMap* content_settings = | 1419 HostContentSettingsMap* content_settings = |
| 1276 profile.GetHostContentSettingsMap(); | 1420 profile.GetHostContentSettingsMap(); |
| 1277 content_settings::CookieSettings* cookie_settings = | 1421 content_settings::CookieSettings* cookie_settings = |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 GetDisplayedServiceWorkers(cookies_model.get())); | 1484 GetDisplayedServiceWorkers(cookies_model.get())); |
| 1341 | 1485 |
| 1342 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("swhost3")); | 1486 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("swhost3")); |
| 1343 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); | 1487 EXPECT_EQ("", GetDisplayedServiceWorkers(cookies_model.get())); |
| 1344 | 1488 |
| 1345 cookies_model->UpdateSearchResults(base::string16()); | 1489 cookies_model->UpdateSearchResults(base::string16()); |
| 1346 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", | 1490 EXPECT_EQ("https://swhost1:1/,https://swhost2:2/", |
| 1347 GetDisplayedServiceWorkers(cookies_model.get())); | 1491 GetDisplayedServiceWorkers(cookies_model.get())); |
| 1348 } | 1492 } |
| 1349 | 1493 |
| 1494 TEST_F(CookiesTreeModelTest, CacheStorageFilter) { |
| 1495 scoped_ptr<CookiesTreeModel> cookies_model( |
| 1496 CreateCookiesTreeModelWithInitialSample()); |
| 1497 |
| 1498 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost1")); |
| 1499 EXPECT_EQ("https://cshost1:1/", |
| 1500 GetDisplayedCacheStorages(cookies_model.get())); |
| 1501 |
| 1502 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost2")); |
| 1503 EXPECT_EQ("https://cshost2:2/", |
| 1504 GetDisplayedCacheStorages(cookies_model.get())); |
| 1505 |
| 1506 cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost3")); |
| 1507 EXPECT_EQ("", GetDisplayedCacheStorages(cookies_model.get())); |
| 1508 |
| 1509 cookies_model->UpdateSearchResults(base::string16()); |
| 1510 EXPECT_EQ("https://cshost1:1/,https://cshost2:2/", |
| 1511 GetDisplayedCacheStorages(cookies_model.get())); |
| 1512 } |
| 1513 |
| 1350 TEST_F(CookiesTreeModelTest, CookiesFilter) { | 1514 TEST_F(CookiesTreeModelTest, CookiesFilter) { |
| 1351 LocalDataContainer* container = | 1515 LocalDataContainer* container = |
| 1352 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1516 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1353 mock_browsing_data_database_helper_.get(), | 1517 mock_browsing_data_database_helper_.get(), |
| 1354 mock_browsing_data_local_storage_helper_.get(), | 1518 mock_browsing_data_local_storage_helper_.get(), |
| 1355 mock_browsing_data_session_storage_helper_.get(), | 1519 mock_browsing_data_session_storage_helper_.get(), |
| 1356 mock_browsing_data_appcache_helper_.get(), | 1520 mock_browsing_data_appcache_helper_.get(), |
| 1357 mock_browsing_data_indexed_db_helper_.get(), | 1521 mock_browsing_data_indexed_db_helper_.get(), |
| 1358 mock_browsing_data_file_system_helper_.get(), | 1522 mock_browsing_data_file_system_helper_.get(), |
| 1359 mock_browsing_data_quota_helper_.get(), | 1523 mock_browsing_data_quota_helper_.get(), |
| 1360 mock_browsing_data_channel_id_helper_.get(), | 1524 mock_browsing_data_channel_id_helper_.get(), |
| 1361 mock_browsing_data_service_worker_helper_.get(), | 1525 mock_browsing_data_service_worker_helper_.get(), |
| 1526 mock_browsing_data_cache_storage_helper_.get(), |
| 1362 mock_browsing_data_flash_lso_helper_.get()); | 1527 mock_browsing_data_flash_lso_helper_.get()); |
| 1363 CookiesTreeModel cookies_model(container, special_storage_policy(), false); | 1528 CookiesTreeModel cookies_model(container, special_storage_policy(), false); |
| 1364 | 1529 |
| 1365 mock_browsing_data_cookie_helper_-> | 1530 mock_browsing_data_cookie_helper_-> |
| 1366 AddCookieSamples(GURL("http://123.com"), "A=1"); | 1531 AddCookieSamples(GURL("http://123.com"), "A=1"); |
| 1367 mock_browsing_data_cookie_helper_-> | 1532 mock_browsing_data_cookie_helper_-> |
| 1368 AddCookieSamples(GURL("http://foo1.com"), "B=1"); | 1533 AddCookieSamples(GURL("http://foo1.com"), "B=1"); |
| 1369 mock_browsing_data_cookie_helper_-> | 1534 mock_browsing_data_cookie_helper_-> |
| 1370 AddCookieSamples(GURL("http://foo2.com"), "C=1"); | 1535 AddCookieSamples(GURL("http://foo2.com"), "C=1"); |
| 1371 mock_browsing_data_cookie_helper_-> | 1536 mock_browsing_data_cookie_helper_-> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1393 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1558 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1394 mock_browsing_data_database_helper_.get(), | 1559 mock_browsing_data_database_helper_.get(), |
| 1395 mock_browsing_data_local_storage_helper_.get(), | 1560 mock_browsing_data_local_storage_helper_.get(), |
| 1396 mock_browsing_data_session_storage_helper_.get(), | 1561 mock_browsing_data_session_storage_helper_.get(), |
| 1397 mock_browsing_data_appcache_helper_.get(), | 1562 mock_browsing_data_appcache_helper_.get(), |
| 1398 mock_browsing_data_indexed_db_helper_.get(), | 1563 mock_browsing_data_indexed_db_helper_.get(), |
| 1399 mock_browsing_data_file_system_helper_.get(), | 1564 mock_browsing_data_file_system_helper_.get(), |
| 1400 mock_browsing_data_quota_helper_.get(), | 1565 mock_browsing_data_quota_helper_.get(), |
| 1401 mock_browsing_data_channel_id_helper_.get(), | 1566 mock_browsing_data_channel_id_helper_.get(), |
| 1402 mock_browsing_data_service_worker_helper_.get(), | 1567 mock_browsing_data_service_worker_helper_.get(), |
| 1568 mock_browsing_data_cache_storage_helper_.get(), |
| 1403 mock_browsing_data_flash_lso_helper_.get()); | 1569 mock_browsing_data_flash_lso_helper_.get()); |
| 1404 CookiesTreeModel cookies_model(container, special_storage_policy(), | 1570 CookiesTreeModel cookies_model(container, special_storage_policy(), |
| 1405 true /* group by cookie source */); | 1571 true /* group by cookie source */); |
| 1406 | 1572 |
| 1407 mock_browsing_data_cookie_helper_->AddCookieSamples( | 1573 mock_browsing_data_cookie_helper_->AddCookieSamples( |
| 1408 GURL("file:///tmp/test.html"), "A=1"); | 1574 GURL("file:///tmp/test.html"), "A=1"); |
| 1409 mock_browsing_data_cookie_helper_->AddCookieSamples( | 1575 mock_browsing_data_cookie_helper_->AddCookieSamples( |
| 1410 GURL("http://example.com"), "B=1"); | 1576 GURL("http://example.com"), "B=1"); |
| 1411 mock_browsing_data_cookie_helper_->AddCookieSamples( | 1577 mock_browsing_data_cookie_helper_->AddCookieSamples( |
| 1412 GURL("http://example.com/"), "C=1"); | 1578 GURL("http://example.com/"), "C=1"); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 | 1634 |
| 1469 cookies_model.UpdateSearchResults( | 1635 cookies_model.UpdateSearchResults( |
| 1470 base::string16(base::ASCIIToUTF16("example4.com"))); | 1636 base::string16(base::ASCIIToUTF16("example4.com"))); |
| 1471 EXPECT_EQ("L", GetDisplayedCookies(&cookies_model)); | 1637 EXPECT_EQ("L", GetDisplayedCookies(&cookies_model)); |
| 1472 CheckContentSettingsUrlForHostNodes( | 1638 CheckContentSettingsUrlForHostNodes( |
| 1473 cookies_model.GetRoot(), CookieTreeNode::DetailedInfo::TYPE_ROOT, | 1639 cookies_model.GetRoot(), CookieTreeNode::DetailedInfo::TYPE_ROOT, |
| 1474 cookie_settings, GURL("http://example4.com")); | 1640 cookie_settings, GURL("http://example4.com")); |
| 1475 } | 1641 } |
| 1476 | 1642 |
| 1477 } // namespace | 1643 } // namespace |
| OLD | NEW |