| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cookies_tree_model.h" | 5 #include "chrome/browser/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/content_settings/mock_settings_observer.h" | 10 #include "chrome/browser/content_settings/mock_settings_observer.h" |
| 11 #include "chrome/browser/mock_browsing_data_appcache_helper.h" | 11 #include "chrome/browser/mock_browsing_data_appcache_helper.h" |
| 12 #include "chrome/browser/mock_browsing_data_cookie_helper.h" |
| 12 #include "chrome/browser/mock_browsing_data_database_helper.h" | 13 #include "chrome/browser/mock_browsing_data_database_helper.h" |
| 13 #include "chrome/browser/mock_browsing_data_file_system_helper.h" | 14 #include "chrome/browser/mock_browsing_data_file_system_helper.h" |
| 14 #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" | 15 #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" |
| 15 #include "chrome/browser/mock_browsing_data_quota_helper.h" | 16 #include "chrome/browser/mock_browsing_data_quota_helper.h" |
| 16 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" | 17 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 18 #include "chrome/test/testing_browser_process_test.h" | 19 #include "chrome/test/testing_browser_process_test.h" |
| 19 #include "content/common/content_notification_types.h" | 20 #include "content/common/content_notification_types.h" |
| 20 #include "content/common/notification_details.h" | 21 #include "content/common/notification_details.h" |
| 21 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 CookiesTreeModelTest() : ui_thread_(BrowserThread::UI, &message_loop_), | 34 CookiesTreeModelTest() : ui_thread_(BrowserThread::UI, &message_loop_), |
| 34 io_thread_(BrowserThread::IO, &message_loop_) { | 35 io_thread_(BrowserThread::IO, &message_loop_) { |
| 35 } | 36 } |
| 36 | 37 |
| 37 virtual ~CookiesTreeModelTest() { | 38 virtual ~CookiesTreeModelTest() { |
| 38 } | 39 } |
| 39 | 40 |
| 40 virtual void SetUp() OVERRIDE { | 41 virtual void SetUp() OVERRIDE { |
| 41 profile_.reset(new TestingProfile()); | 42 profile_.reset(new TestingProfile()); |
| 42 profile_->CreateRequestContext(); | 43 profile_->CreateRequestContext(); |
| 44 mock_browsing_data_cookie_helper_ = |
| 45 new MockBrowsingDataCookieHelper(profile_.get()); |
| 43 mock_browsing_data_database_helper_ = | 46 mock_browsing_data_database_helper_ = |
| 44 new MockBrowsingDataDatabaseHelper(profile_.get()); | 47 new MockBrowsingDataDatabaseHelper(profile_.get()); |
| 45 mock_browsing_data_local_storage_helper_ = | 48 mock_browsing_data_local_storage_helper_ = |
| 46 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 49 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 47 mock_browsing_data_session_storage_helper_ = | 50 mock_browsing_data_session_storage_helper_ = |
| 48 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 51 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 49 mock_browsing_data_appcache_helper_ = | 52 mock_browsing_data_appcache_helper_ = |
| 50 new MockBrowsingDataAppCacheHelper(profile_.get()); | 53 new MockBrowsingDataAppCacheHelper(profile_.get()); |
| 51 mock_browsing_data_indexed_db_helper_ = | 54 mock_browsing_data_indexed_db_helper_ = |
| 52 new MockBrowsingDataIndexedDBHelper(profile_.get()); | 55 new MockBrowsingDataIndexedDBHelper(profile_.get()); |
| 53 mock_browsing_data_file_system_helper_ = | 56 mock_browsing_data_file_system_helper_ = |
| 54 new MockBrowsingDataFileSystemHelper(profile_.get()); | 57 new MockBrowsingDataFileSystemHelper(profile_.get()); |
| 55 mock_browsing_data_quota_helper_ = | 58 mock_browsing_data_quota_helper_ = |
| 56 new MockBrowsingDataQuotaHelper(profile_.get()); | 59 new MockBrowsingDataQuotaHelper(profile_.get()); |
| 57 } | 60 } |
| 58 | 61 |
| 59 virtual void TearDown() OVERRIDE { | 62 virtual void TearDown() OVERRIDE { |
| 60 mock_browsing_data_quota_helper_ = NULL; | 63 mock_browsing_data_quota_helper_ = NULL; |
| 61 mock_browsing_data_file_system_helper_ = NULL; | 64 mock_browsing_data_file_system_helper_ = NULL; |
| 62 mock_browsing_data_indexed_db_helper_ = NULL; | 65 mock_browsing_data_indexed_db_helper_ = NULL; |
| 63 mock_browsing_data_appcache_helper_ = NULL; | 66 mock_browsing_data_appcache_helper_ = NULL; |
| 64 mock_browsing_data_session_storage_helper_ = NULL; | 67 mock_browsing_data_session_storage_helper_ = NULL; |
| 65 mock_browsing_data_local_storage_helper_ = NULL; | 68 mock_browsing_data_local_storage_helper_ = NULL; |
| 66 mock_browsing_data_database_helper_ = NULL; | 69 mock_browsing_data_database_helper_ = NULL; |
| 67 message_loop_.RunAllPending(); | 70 message_loop_.RunAllPending(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() { | 73 CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() { |
| 71 net::CookieMonster* monster = profile_->GetCookieMonster(); | |
| 72 monster->SetCookie(GURL("http://foo1"), "A=1"); | |
| 73 monster->SetCookie(GURL("http://foo2"), "B=1"); | |
| 74 monster->SetCookie(GURL("http://foo3"), "C=1"); | |
| 75 CookiesTreeModel* cookies_model = new CookiesTreeModel( | 74 CookiesTreeModel* cookies_model = new CookiesTreeModel( |
| 76 monster, mock_browsing_data_database_helper_, | 75 mock_browsing_data_cookie_helper_, |
| 76 mock_browsing_data_database_helper_, |
| 77 mock_browsing_data_local_storage_helper_, | 77 mock_browsing_data_local_storage_helper_, |
| 78 mock_browsing_data_session_storage_helper_, | 78 mock_browsing_data_session_storage_helper_, |
| 79 mock_browsing_data_appcache_helper_, | 79 mock_browsing_data_appcache_helper_, |
| 80 mock_browsing_data_indexed_db_helper_, | 80 mock_browsing_data_indexed_db_helper_, |
| 81 mock_browsing_data_file_system_helper_, | 81 mock_browsing_data_file_system_helper_, |
| 82 mock_browsing_data_quota_helper_, | 82 mock_browsing_data_quota_helper_, |
| 83 false); | 83 false); |
| 84 mock_browsing_data_cookie_helper_-> |
| 85 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 86 mock_browsing_data_cookie_helper_-> |
| 87 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 88 mock_browsing_data_cookie_helper_-> |
| 89 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 90 mock_browsing_data_cookie_helper_->Notify(); |
| 84 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 91 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 85 mock_browsing_data_database_helper_->Notify(); | 92 mock_browsing_data_database_helper_->Notify(); |
| 86 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 93 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 87 mock_browsing_data_local_storage_helper_->Notify(); | 94 mock_browsing_data_local_storage_helper_->Notify(); |
| 88 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 95 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 89 mock_browsing_data_session_storage_helper_->Notify(); | 96 mock_browsing_data_session_storage_helper_->Notify(); |
| 90 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 97 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 91 mock_browsing_data_indexed_db_helper_->Notify(); | 98 mock_browsing_data_indexed_db_helper_->Notify(); |
| 92 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 99 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 93 mock_browsing_data_file_system_helper_->Notify(); | 100 mock_browsing_data_file_system_helper_->Notify(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 // fshost3 -> filesystem -> http://fshost3:1/, | 112 // fshost3 -> filesystem -> http://fshost3:1/, |
| 106 // host1 -> localstorage -> http://host1:1/, | 113 // host1 -> localstorage -> http://host1:1/, |
| 107 // host2 -> localstorage -> http://host2:2/. | 114 // host2 -> localstorage -> http://host2:2/. |
| 108 // host1 -> sessionstorage -> http://host1:1/, | 115 // host1 -> sessionstorage -> http://host1:1/, |
| 109 // host2 -> sessionstorage -> http://host2:2/, | 116 // host2 -> sessionstorage -> http://host2:2/, |
| 110 // idbhost1 -> indexeddb -> http://idbhost1:1/, | 117 // idbhost1 -> indexeddb -> http://idbhost1:1/, |
| 111 // idbhost2 -> indexeddb -> http://idbhost2:2/, | 118 // idbhost2 -> indexeddb -> http://idbhost2:2/, |
| 112 // quotahost1 -> quotahost1, | 119 // quotahost1 -> quotahost1, |
| 113 // quotahost2 -> quotahost2. | 120 // quotahost2 -> quotahost2. |
| 114 EXPECT_EQ(45, cookies_model->GetRoot()->GetTotalNodeCount()); | 121 EXPECT_EQ(45, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 122 EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); |
| 115 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); | 123 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); |
| 116 EXPECT_EQ("http://host1:1/,http://host2:2/", | 124 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 117 GetDisplayedLocalStorages(cookies_model)); | 125 GetDisplayedLocalStorages(cookies_model)); |
| 118 EXPECT_EQ("http://host1:1/,http://host2:2/", | 126 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 119 GetDisplayedSessionStorages(cookies_model)); | 127 GetDisplayedSessionStorages(cookies_model)); |
| 120 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 128 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 121 GetDisplayedIndexedDBs(cookies_model)); | 129 GetDisplayedIndexedDBs(cookies_model)); |
| 122 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 130 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 123 GetDisplayedFileSystems(cookies_model)); | 131 GetDisplayedFileSystems(cookies_model)); |
| 124 EXPECT_EQ("quotahost1,quotahost2", | 132 EXPECT_EQ("quotahost1,quotahost2", |
| 125 GetDisplayedQuotas(cookies_model)); | 133 GetDisplayedQuotas(cookies_model)); |
| 126 } | 134 } |
| 127 return cookies_model; | 135 return cookies_model; |
| 128 } | 136 } |
| 129 | 137 |
| 130 // Get the cookie names in the cookie list, as a comma seperated string. | |
| 131 // (Note that the CookieMonster cookie list is sorted by domain.) | |
| 132 // Ex: | |
| 133 // monster->SetCookie(GURL("http://b"), "X=1") | |
| 134 // monster->SetCookie(GURL("http://a"), "Y=1") | |
| 135 // EXPECT_STREQ("Y,X", GetMonsterCookies(monster).c_str()); | |
| 136 std::string GetMonsterCookies(net::CookieMonster* monster) { | |
| 137 std::vector<std::string> parts; | |
| 138 net::CookieList cookie_list = monster->GetAllCookies(); | |
| 139 for (size_t i = 0; i < cookie_list.size(); ++i) | |
| 140 parts.push_back(cookie_list[i].Name()); | |
| 141 return JoinString(parts, ','); | |
| 142 } | |
| 143 | |
| 144 std::string GetNodesOfChildren( | 138 std::string GetNodesOfChildren( |
| 145 const CookieTreeNode* node, | 139 const CookieTreeNode* node, |
| 146 CookieTreeNode::DetailedInfo::NodeType node_type) { | 140 CookieTreeNode::DetailedInfo::NodeType node_type) { |
| 147 if (!node->empty()) { | 141 if (!node->empty()) { |
| 148 std::string retval; | 142 std::string retval; |
| 149 for (int i = 0; i < node->child_count(); ++i) { | 143 for (int i = 0; i < node->child_count(); ++i) { |
| 150 retval += GetNodesOfChildren(node->GetChild(i), node_type); | 144 retval += GetNodesOfChildren(node->GetChild(i), node_type); |
| 151 } | 145 } |
| 152 return retval; | 146 return retval; |
| 153 } else { | 147 } else { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 DCHECK(parent_node); | 268 DCHECK(parent_node); |
| 275 delete parent_node->GetModel()->Remove(parent_node, node); | 269 delete parent_node->GetModel()->Remove(parent_node, node); |
| 276 } | 270 } |
| 277 | 271 |
| 278 protected: | 272 protected: |
| 279 MessageLoop message_loop_; | 273 MessageLoop message_loop_; |
| 280 BrowserThread ui_thread_; | 274 BrowserThread ui_thread_; |
| 281 BrowserThread io_thread_; | 275 BrowserThread io_thread_; |
| 282 | 276 |
| 283 scoped_ptr<TestingProfile> profile_; | 277 scoped_ptr<TestingProfile> profile_; |
| 278 scoped_refptr<MockBrowsingDataCookieHelper> |
| 279 mock_browsing_data_cookie_helper_; |
| 284 scoped_refptr<MockBrowsingDataDatabaseHelper> | 280 scoped_refptr<MockBrowsingDataDatabaseHelper> |
| 285 mock_browsing_data_database_helper_; | 281 mock_browsing_data_database_helper_; |
| 286 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 282 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| 287 mock_browsing_data_local_storage_helper_; | 283 mock_browsing_data_local_storage_helper_; |
| 288 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 284 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| 289 mock_browsing_data_session_storage_helper_; | 285 mock_browsing_data_session_storage_helper_; |
| 290 scoped_refptr<MockBrowsingDataAppCacheHelper> | 286 scoped_refptr<MockBrowsingDataAppCacheHelper> |
| 291 mock_browsing_data_appcache_helper_; | 287 mock_browsing_data_appcache_helper_; |
| 292 scoped_refptr<MockBrowsingDataIndexedDBHelper> | 288 scoped_refptr<MockBrowsingDataIndexedDBHelper> |
| 293 mock_browsing_data_indexed_db_helper_; | 289 mock_browsing_data_indexed_db_helper_; |
| 294 scoped_refptr<MockBrowsingDataFileSystemHelper> | 290 scoped_refptr<MockBrowsingDataFileSystemHelper> |
| 295 mock_browsing_data_file_system_helper_; | 291 mock_browsing_data_file_system_helper_; |
| 296 scoped_refptr<MockBrowsingDataQuotaHelper> | 292 scoped_refptr<MockBrowsingDataQuotaHelper> |
| 297 mock_browsing_data_quota_helper_; | 293 mock_browsing_data_quota_helper_; |
| 298 }; | 294 }; |
| 299 | 295 |
| 300 TEST_F(CookiesTreeModelTest, RemoveAll) { | 296 TEST_F(CookiesTreeModelTest, RemoveAll) { |
| 301 scoped_ptr<CookiesTreeModel> cookies_model( | 297 scoped_ptr<CookiesTreeModel> cookies_model( |
| 302 CreateCookiesTreeModelWithInitialSample()); | 298 CreateCookiesTreeModelWithInitialSample()); |
| 303 net::CookieMonster* monster = profile_->GetCookieMonster(); | |
| 304 | 299 |
| 305 // Reset the selection of the first row. | 300 // Reset the selection of the first row. |
| 306 { | 301 { |
| 307 SCOPED_TRACE("Before removing"); | 302 SCOPED_TRACE("Before removing"); |
| 308 EXPECT_EQ(GetMonsterCookies(monster), | 303 EXPECT_EQ("A,B,C", |
| 309 GetDisplayedCookies(cookies_model.get())); | 304 GetDisplayedCookies(cookies_model.get())); |
| 310 EXPECT_EQ("db1,db2", | 305 EXPECT_EQ("db1,db2", |
| 311 GetDisplayedDatabases(cookies_model.get())); | 306 GetDisplayedDatabases(cookies_model.get())); |
| 312 EXPECT_EQ("http://host1:1/,http://host2:2/", | 307 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 313 GetDisplayedLocalStorages(cookies_model.get())); | 308 GetDisplayedLocalStorages(cookies_model.get())); |
| 314 EXPECT_EQ("http://host1:1/,http://host2:2/", | 309 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 315 GetDisplayedSessionStorages(cookies_model.get())); | 310 GetDisplayedSessionStorages(cookies_model.get())); |
| 316 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 311 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 317 GetDisplayedIndexedDBs(cookies_model.get())); | 312 GetDisplayedIndexedDBs(cookies_model.get())); |
| 318 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 313 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 319 GetDisplayedFileSystems(cookies_model.get())); | 314 GetDisplayedFileSystems(cookies_model.get())); |
| 320 EXPECT_EQ("quotahost1,quotahost2", | 315 EXPECT_EQ("quotahost1,quotahost2", |
| 321 GetDisplayedQuotas(cookies_model.get())); | 316 GetDisplayedQuotas(cookies_model.get())); |
| 322 } | 317 } |
| 323 | 318 |
| 319 mock_browsing_data_cookie_helper_->Reset(); |
| 324 mock_browsing_data_database_helper_->Reset(); | 320 mock_browsing_data_database_helper_->Reset(); |
| 325 mock_browsing_data_local_storage_helper_->Reset(); | 321 mock_browsing_data_local_storage_helper_->Reset(); |
| 326 mock_browsing_data_session_storage_helper_->Reset(); | 322 mock_browsing_data_session_storage_helper_->Reset(); |
| 327 mock_browsing_data_indexed_db_helper_->Reset(); | 323 mock_browsing_data_indexed_db_helper_->Reset(); |
| 328 mock_browsing_data_file_system_helper_->Reset(); | 324 mock_browsing_data_file_system_helper_->Reset(); |
| 329 | 325 |
| 330 cookies_model->DeleteAllStoredObjects(); | 326 cookies_model->DeleteAllStoredObjects(); |
| 331 | 327 |
| 332 { | 328 { |
| 333 SCOPED_TRACE("After removing"); | 329 SCOPED_TRACE("After removing"); |
| 334 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 330 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 335 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); | 331 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); |
| 336 EXPECT_EQ(std::string(""), GetMonsterCookies(monster)); | 332 EXPECT_EQ(std::string(""), GetDisplayedCookies(cookies_model.get())); |
| 337 EXPECT_EQ(GetMonsterCookies(monster), | 333 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); |
| 338 GetDisplayedCookies(cookies_model.get())); | |
| 339 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); | 334 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); |
| 340 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); | 335 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); |
| 341 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); | 336 EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted()); |
| 342 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); | 337 EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted()); |
| 343 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); | 338 EXPECT_TRUE(mock_browsing_data_file_system_helper_->AllDeleted()); |
| 344 } | 339 } |
| 345 } | 340 } |
| 346 | 341 |
| 347 TEST_F(CookiesTreeModelTest, Remove) { | 342 TEST_F(CookiesTreeModelTest, Remove) { |
| 348 scoped_ptr<CookiesTreeModel> cookies_model( | 343 scoped_ptr<CookiesTreeModel> cookies_model( |
| 349 CreateCookiesTreeModelWithInitialSample()); | 344 CreateCookiesTreeModelWithInitialSample()); |
| 350 net::CookieMonster* monster = profile_->GetCookieMonster(); | |
| 351 | 345 |
| 352 // Children start out arranged as follows: | 346 // Children start out arranged as follows: |
| 353 // | 347 // |
| 354 // 0. `foo1` | 348 // 0. `foo1` |
| 355 // 1. `foo2` | 349 // 1. `foo2` |
| 356 // 2. `foo3` | 350 // 2. `foo3` |
| 357 // 3. `fshost1` | 351 // 3. `fshost1` |
| 358 // 4. `fshost2` | 352 // 4. `fshost2` |
| 359 // 5. `fshost3` | 353 // 5. `fshost3` |
| 360 // 6. `gdbhost1` | 354 // 6. `gdbhost1` |
| 361 // 7. `gdbhost2` | 355 // 7. `gdbhost2` |
| 362 // 8. `host1` | 356 // 8. `host1` |
| 363 // 9. `host2` | 357 // 9. `host2` |
| 364 // 10. `idbhost1` | 358 // 10. `idbhost1` |
| 365 // 11. `idbhost2` | 359 // 11. `idbhost2` |
| 366 // 12. `quotahost1` | 360 // 12. `quotahost1` |
| 367 // 13. `quotahost2` | 361 // 13. `quotahost2` |
| 368 // | 362 // |
| 369 // Here, we'll remove them one by one, starting from the end, and | 363 // Here, we'll remove them one by one, starting from the end, and |
| 370 // check that the state makes sense. | 364 // check that the state makes sense. |
| 371 | 365 |
| 372 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); | 366 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(13)); |
| 373 { | 367 { |
| 374 SCOPED_TRACE("`quotahost2` removed."); | 368 SCOPED_TRACE("`quotahost2` removed."); |
| 375 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 376 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 369 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 377 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 370 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 378 EXPECT_EQ("http://host1:1/,http://host2:2/", | 371 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 379 GetDisplayedLocalStorages(cookies_model.get())); | 372 GetDisplayedLocalStorages(cookies_model.get())); |
| 380 EXPECT_EQ("http://host1:1/,http://host2:2/", | 373 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 381 GetDisplayedSessionStorages(cookies_model.get())); | 374 GetDisplayedSessionStorages(cookies_model.get())); |
| 382 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 375 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 383 GetDisplayedFileSystems(cookies_model.get())); | 376 GetDisplayedFileSystems(cookies_model.get())); |
| 384 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 377 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 385 GetDisplayedIndexedDBs(cookies_model.get())); | 378 GetDisplayedIndexedDBs(cookies_model.get())); |
| 386 EXPECT_EQ("quotahost1", | 379 EXPECT_EQ("quotahost1", |
| 387 GetDisplayedQuotas(cookies_model.get())); | 380 GetDisplayedQuotas(cookies_model.get())); |
| 388 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); | 381 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 389 } | 382 } |
| 390 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); | 383 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(12)); |
| 391 { | 384 { |
| 392 SCOPED_TRACE("`quotahost1` removed."); | 385 SCOPED_TRACE("`quotahost1` removed."); |
| 393 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 394 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 386 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 395 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 387 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 396 EXPECT_EQ("http://host1:1/,http://host2:2/", | 388 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 397 GetDisplayedLocalStorages(cookies_model.get())); | 389 GetDisplayedLocalStorages(cookies_model.get())); |
| 398 EXPECT_EQ("http://host1:1/,http://host2:2/", | 390 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 399 GetDisplayedSessionStorages(cookies_model.get())); | 391 GetDisplayedSessionStorages(cookies_model.get())); |
| 400 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 392 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 401 GetDisplayedFileSystems(cookies_model.get())); | 393 GetDisplayedFileSystems(cookies_model.get())); |
| 402 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 394 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 403 GetDisplayedIndexedDBs(cookies_model.get())); | 395 GetDisplayedIndexedDBs(cookies_model.get())); |
| 404 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); | 396 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 405 } | 397 } |
| 406 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); | 398 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(11)); |
| 407 { | 399 { |
| 408 SCOPED_TRACE("`idbhost2` removed."); | 400 SCOPED_TRACE("`idbhost2` removed."); |
| 409 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 410 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 401 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 411 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 402 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 412 EXPECT_EQ("http://host1:1/,http://host2:2/", | 403 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 413 GetDisplayedLocalStorages(cookies_model.get())); | 404 GetDisplayedLocalStorages(cookies_model.get())); |
| 414 EXPECT_EQ("http://host1:1/,http://host2:2/", | 405 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 415 GetDisplayedSessionStorages(cookies_model.get())); | 406 GetDisplayedSessionStorages(cookies_model.get())); |
| 416 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 407 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 417 GetDisplayedFileSystems(cookies_model.get())); | 408 GetDisplayedFileSystems(cookies_model.get())); |
| 418 EXPECT_EQ("http://idbhost1:1/", | 409 EXPECT_EQ("http://idbhost1:1/", |
| 419 GetDisplayedIndexedDBs(cookies_model.get())); | 410 GetDisplayedIndexedDBs(cookies_model.get())); |
| 420 EXPECT_EQ(38, cookies_model->GetRoot()->GetTotalNodeCount()); | 411 EXPECT_EQ(38, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 421 } | 412 } |
| 422 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); | 413 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(10)); |
| 423 { | 414 { |
| 424 SCOPED_TRACE("`idbhost1` removed."); | 415 SCOPED_TRACE("`idbhost1` removed."); |
| 425 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 426 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 416 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 427 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 417 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 428 EXPECT_EQ("http://host1:1/,http://host2:2/", | 418 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 429 GetDisplayedLocalStorages(cookies_model.get())); | 419 GetDisplayedLocalStorages(cookies_model.get())); |
| 430 EXPECT_EQ("http://host1:1/,http://host2:2/", | 420 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 431 GetDisplayedSessionStorages(cookies_model.get())); | 421 GetDisplayedSessionStorages(cookies_model.get())); |
| 432 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 422 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 433 GetDisplayedFileSystems(cookies_model.get())); | 423 GetDisplayedFileSystems(cookies_model.get())); |
| 434 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 424 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 435 EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); | 425 EXPECT_EQ(35, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 436 } | 426 } |
| 437 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); | 427 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(9)); |
| 438 { | 428 { |
| 439 SCOPED_TRACE("`host2` removed."); | 429 SCOPED_TRACE("`host2` removed."); |
| 440 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 441 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 430 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 442 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 431 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 443 EXPECT_EQ("http://host1:1/", | 432 EXPECT_EQ("http://host1:1/", |
| 444 GetDisplayedLocalStorages(cookies_model.get())); | 433 GetDisplayedLocalStorages(cookies_model.get())); |
| 445 EXPECT_EQ("http://host1:1/", | 434 EXPECT_EQ("http://host1:1/", |
| 446 GetDisplayedSessionStorages(cookies_model.get())); | 435 GetDisplayedSessionStorages(cookies_model.get())); |
| 447 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 436 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 448 GetDisplayedFileSystems(cookies_model.get())); | 437 GetDisplayedFileSystems(cookies_model.get())); |
| 449 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 438 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 450 EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount()); | 439 EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 451 } | 440 } |
| 452 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); | 441 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)); |
| 453 { | 442 { |
| 454 SCOPED_TRACE("`host1` removed."); | 443 SCOPED_TRACE("`host1` removed."); |
| 455 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 456 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 444 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 457 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 445 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 458 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 446 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 459 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 447 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 460 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 448 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 461 GetDisplayedFileSystems(cookies_model.get())); | 449 GetDisplayedFileSystems(cookies_model.get())); |
| 462 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 450 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 463 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); | 451 EXPECT_EQ(25, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 464 } | 452 } |
| 465 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); | 453 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(7)); |
| 466 { | 454 { |
| 467 SCOPED_TRACE("`gdbhost2` removed."); | 455 SCOPED_TRACE("`gdbhost2` removed."); |
| 468 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 469 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 456 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 470 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); | 457 EXPECT_EQ("db1", GetDisplayedDatabases(cookies_model.get())); |
| 471 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 458 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 472 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 459 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 473 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 460 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 474 GetDisplayedFileSystems(cookies_model.get())); | 461 GetDisplayedFileSystems(cookies_model.get())); |
| 475 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 462 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 476 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); | 463 EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 477 } | 464 } |
| 478 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); | 465 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)); |
| 479 { | 466 { |
| 480 SCOPED_TRACE("`gdbhost1` removed."); | 467 SCOPED_TRACE("`gdbhost1` removed."); |
| 481 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 482 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 468 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 483 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 469 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 484 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 470 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 485 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 471 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 486 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 472 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 487 GetDisplayedFileSystems(cookies_model.get())); | 473 GetDisplayedFileSystems(cookies_model.get())); |
| 488 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 474 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 489 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); | 475 EXPECT_EQ(19, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 490 } | 476 } |
| 491 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); | 477 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)); |
| 492 { | 478 { |
| 493 SCOPED_TRACE("`fshost3` removed."); | 479 SCOPED_TRACE("`fshost3` removed."); |
| 494 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 495 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 480 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 496 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 481 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 497 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 482 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 498 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 483 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 499 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", | 484 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/", |
| 500 GetDisplayedFileSystems(cookies_model.get())); | 485 GetDisplayedFileSystems(cookies_model.get())); |
| 501 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 486 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 502 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); | 487 EXPECT_EQ(16, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 503 } | 488 } |
| 504 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); | 489 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4)); |
| 505 { | 490 { |
| 506 SCOPED_TRACE("`fshost2` removed."); | 491 SCOPED_TRACE("`fshost2` removed."); |
| 507 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 508 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 492 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 509 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 493 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 510 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 494 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 511 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 495 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 512 EXPECT_EQ("http://fshost1:1/", | 496 EXPECT_EQ("http://fshost1:1/", |
| 513 GetDisplayedFileSystems(cookies_model.get())); | 497 GetDisplayedFileSystems(cookies_model.get())); |
| 514 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 498 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 515 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); | 499 EXPECT_EQ(13, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 516 } | 500 } |
| 517 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); | 501 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)); |
| 518 { | 502 { |
| 519 SCOPED_TRACE("`fshost1` removed."); | 503 SCOPED_TRACE("`fshost1` removed."); |
| 520 EXPECT_STREQ("A,B,C", GetMonsterCookies(monster).c_str()); | |
| 521 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 504 EXPECT_STREQ("A,B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 522 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 505 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 523 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 506 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 524 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 507 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 525 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 508 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 526 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 509 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 527 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); | 510 EXPECT_EQ(10, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 528 } | 511 } |
| 529 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); | 512 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)); |
| 530 { | 513 { |
| 531 SCOPED_TRACE("`foo3` removed."); | 514 SCOPED_TRACE("`foo3` removed."); |
| 532 EXPECT_STREQ("A,B", GetMonsterCookies(monster).c_str()); | |
| 533 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); | 515 EXPECT_STREQ("A,B", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 534 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 516 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 535 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 517 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 536 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 518 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 537 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 519 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 538 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 520 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 539 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); | 521 EXPECT_EQ(7, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 540 } | 522 } |
| 541 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); | 523 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)); |
| 542 { | 524 { |
| 543 SCOPED_TRACE("`foo2` removed."); | 525 SCOPED_TRACE("`foo2` removed."); |
| 544 EXPECT_STREQ("A", GetMonsterCookies(monster).c_str()); | |
| 545 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); | 526 EXPECT_STREQ("A", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 546 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 527 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 547 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 528 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 548 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 529 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 549 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 530 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 550 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 531 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 551 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); | 532 EXPECT_EQ(4, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 552 } | 533 } |
| 553 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); | 534 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)); |
| 554 { | 535 { |
| 555 SCOPED_TRACE("`foo1` removed."); | 536 SCOPED_TRACE("`foo1` removed."); |
| 556 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); | |
| 557 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); | 537 EXPECT_STREQ("", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 558 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); | 538 EXPECT_EQ("", GetDisplayedDatabases(cookies_model.get())); |
| 559 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); | 539 EXPECT_EQ("", GetDisplayedLocalStorages(cookies_model.get())); |
| 560 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); | 540 EXPECT_EQ("", GetDisplayedSessionStorages(cookies_model.get())); |
| 561 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); | 541 EXPECT_EQ("", GetDisplayedFileSystems(cookies_model.get())); |
| 562 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); | 542 EXPECT_EQ("", GetDisplayedIndexedDBs(cookies_model.get())); |
| 563 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 543 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 564 } | 544 } |
| 565 } | 545 } |
| 566 | 546 |
| 567 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { | 547 TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { |
| 568 scoped_ptr<CookiesTreeModel> cookies_model( | 548 scoped_ptr<CookiesTreeModel> cookies_model( |
| 569 CreateCookiesTreeModelWithInitialSample()); | 549 CreateCookiesTreeModelWithInitialSample()); |
| 570 net::CookieMonster* monster = profile_->GetCookieMonster(); | |
| 571 | 550 |
| 572 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)->GetChild(0)); | 551 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(0)->GetChild(0)); |
| 573 { | 552 { |
| 574 SCOPED_TRACE("First origin removed"); | 553 SCOPED_TRACE("First origin removed"); |
| 575 EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str()); | |
| 576 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 554 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 577 // 43 because in this case, the origin remains, although the COOKIES | 555 // 43 because in this case, the origin remains, although the COOKIES |
| 578 // node beneath it has been deleted. So, we have | 556 // node beneath it has been deleted. So, we have |
| 579 // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c | 557 // root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c |
| 580 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, | 558 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, |
| 581 // fshost1 -> filesystem -> http://fshost1:1/, | 559 // fshost1 -> filesystem -> http://fshost1:1/, |
| 582 // fshost2 -> filesystem -> http://fshost2:1/, | 560 // fshost2 -> filesystem -> http://fshost2:1/, |
| 583 // fshost3 -> filesystem -> http://fshost3:1/, | 561 // fshost3 -> filesystem -> http://fshost3:1/, |
| 584 // host1 -> localstorage -> http://host1:1/, | 562 // host1 -> localstorage -> http://host1:1/, |
| 585 // host2 -> localstorage -> http://host2:2/, | 563 // host2 -> localstorage -> http://host2:2/, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 596 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 574 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 597 GetDisplayedIndexedDBs(cookies_model.get())); | 575 GetDisplayedIndexedDBs(cookies_model.get())); |
| 598 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 576 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 599 GetDisplayedFileSystems(cookies_model.get())); | 577 GetDisplayedFileSystems(cookies_model.get())); |
| 600 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 578 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 601 } | 579 } |
| 602 | 580 |
| 603 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | 581 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); |
| 604 { | 582 { |
| 605 SCOPED_TRACE("First database removed"); | 583 SCOPED_TRACE("First database removed"); |
| 606 EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str()); | |
| 607 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 584 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 608 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 585 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 609 EXPECT_EQ("http://host1:1/,http://host2:2/", | 586 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 610 GetDisplayedLocalStorages(cookies_model.get())); | 587 GetDisplayedLocalStorages(cookies_model.get())); |
| 611 EXPECT_EQ("http://host1:1/,http://host2:2/", | 588 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 612 GetDisplayedSessionStorages(cookies_model.get())); | 589 GetDisplayedSessionStorages(cookies_model.get())); |
| 613 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 590 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 614 GetDisplayedIndexedDBs(cookies_model.get())); | 591 GetDisplayedIndexedDBs(cookies_model.get())); |
| 615 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 592 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 616 GetDisplayedFileSystems(cookies_model.get())); | 593 GetDisplayedFileSystems(cookies_model.get())); |
| 617 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 594 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 618 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); | 595 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 619 } | 596 } |
| 620 | 597 |
| 621 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | 598 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
| 622 { | 599 { |
| 623 SCOPED_TRACE("First origin removed"); | 600 SCOPED_TRACE("First origin removed"); |
| 624 EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str()); | |
| 625 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 601 EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 626 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 602 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 627 EXPECT_EQ("http://host2:2/", | 603 EXPECT_EQ("http://host2:2/", |
| 628 GetDisplayedLocalStorages(cookies_model.get())); | 604 GetDisplayedLocalStorages(cookies_model.get())); |
| 629 EXPECT_EQ("http://host1:1/,http://host2:2/", | 605 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 630 GetDisplayedSessionStorages(cookies_model.get())); | 606 GetDisplayedSessionStorages(cookies_model.get())); |
| 631 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 607 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 632 GetDisplayedIndexedDBs(cookies_model.get())); | 608 GetDisplayedIndexedDBs(cookies_model.get())); |
| 633 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 609 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 634 GetDisplayedFileSystems(cookies_model.get())); | 610 GetDisplayedFileSystems(cookies_model.get())); |
| 635 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 611 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 636 EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); | 612 EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 637 } | 613 } |
| 638 } | 614 } |
| 639 | 615 |
| 640 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { | 616 TEST_F(CookiesTreeModelTest, RemoveCookieNode) { |
| 641 scoped_ptr<CookiesTreeModel> cookies_model( | 617 scoped_ptr<CookiesTreeModel> cookies_model( |
| 642 CreateCookiesTreeModelWithInitialSample()); | 618 CreateCookiesTreeModelWithInitialSample()); |
| 643 net::CookieMonster* monster = profile_->GetCookieMonster(); | |
| 644 | 619 |
| 645 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)->GetChild(0)); | 620 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(1)->GetChild(0)); |
| 646 { | 621 { |
| 647 SCOPED_TRACE("Second origin COOKIES node removed"); | 622 SCOPED_TRACE("Second origin COOKIES node removed"); |
| 648 EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str()); | |
| 649 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 623 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 650 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); | 624 EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get())); |
| 651 EXPECT_EQ("http://host1:1/,http://host2:2/", | 625 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 652 GetDisplayedLocalStorages(cookies_model.get())); | 626 GetDisplayedLocalStorages(cookies_model.get())); |
| 653 EXPECT_EQ("http://host1:1/,http://host2:2/", | 627 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 654 GetDisplayedSessionStorages(cookies_model.get())); | 628 GetDisplayedSessionStorages(cookies_model.get())); |
| 655 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 629 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 656 GetDisplayedIndexedDBs(cookies_model.get())); | 630 GetDisplayedIndexedDBs(cookies_model.get())); |
| 657 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 631 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 658 GetDisplayedFileSystems(cookies_model.get())); | 632 GetDisplayedFileSystems(cookies_model.get())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 671 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 645 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
| 672 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 646 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
| 673 // quotahost1 -> quotahost1, | 647 // quotahost1 -> quotahost1, |
| 674 // quotahost2 -> quotahost2. | 648 // quotahost2 -> quotahost2. |
| 675 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); | 649 EXPECT_EQ(43, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 676 } | 650 } |
| 677 | 651 |
| 678 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); | 652 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(6)->GetChild(0)); |
| 679 { | 653 { |
| 680 SCOPED_TRACE("First database removed"); | 654 SCOPED_TRACE("First database removed"); |
| 681 EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str()); | |
| 682 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 655 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 683 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 656 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 684 EXPECT_EQ("http://host1:1/,http://host2:2/", | 657 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 685 GetDisplayedLocalStorages(cookies_model.get())); | 658 GetDisplayedLocalStorages(cookies_model.get())); |
| 686 EXPECT_EQ("http://host1:1/,http://host2:2/", | 659 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 687 GetDisplayedSessionStorages(cookies_model.get())); | 660 GetDisplayedSessionStorages(cookies_model.get())); |
| 688 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 661 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 689 GetDisplayedIndexedDBs(cookies_model.get())); | 662 GetDisplayedIndexedDBs(cookies_model.get())); |
| 690 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 663 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 691 GetDisplayedFileSystems(cookies_model.get())); | 664 GetDisplayedFileSystems(cookies_model.get())); |
| 692 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 665 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 693 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); | 666 EXPECT_EQ(41, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 694 } | 667 } |
| 695 | 668 |
| 696 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); | 669 DeleteStoredObjects(cookies_model->GetRoot()->GetChild(8)->GetChild(0)); |
| 697 { | 670 { |
| 698 SCOPED_TRACE("First origin removed"); | 671 SCOPED_TRACE("First origin removed"); |
| 699 EXPECT_STREQ("A,C", GetMonsterCookies(monster).c_str()); | |
| 700 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); | 672 EXPECT_STREQ("A,C", GetDisplayedCookies(cookies_model.get()).c_str()); |
| 701 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); | 673 EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get())); |
| 702 EXPECT_EQ("http://host2:2/", | 674 EXPECT_EQ("http://host2:2/", |
| 703 GetDisplayedLocalStorages(cookies_model.get())); | 675 GetDisplayedLocalStorages(cookies_model.get())); |
| 704 EXPECT_EQ("http://host1:1/,http://host2:2/", | 676 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 705 GetDisplayedSessionStorages(cookies_model.get())); | 677 GetDisplayedSessionStorages(cookies_model.get())); |
| 706 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 678 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 707 GetDisplayedIndexedDBs(cookies_model.get())); | 679 GetDisplayedIndexedDBs(cookies_model.get())); |
| 708 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 680 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 709 GetDisplayedFileSystems(cookies_model.get())); | 681 GetDisplayedFileSystems(cookies_model.get())); |
| 710 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 682 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
| 711 EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); | 683 EXPECT_EQ(39, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 712 } | 684 } |
| 713 } | 685 } |
| 714 | 686 |
| 715 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { | 687 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { |
| 716 net::CookieMonster* monster = profile_->GetCookieMonster(); | 688 CookiesTreeModel cookies_model(mock_browsing_data_cookie_helper_, |
| 717 monster->SetCookie(GURL("http://foo1"), "A=1"); | |
| 718 monster->SetCookie(GURL("http://foo2"), "B=1"); | |
| 719 monster->SetCookie(GURL("http://foo3"), "C=1"); | |
| 720 monster->SetCookie(GURL("http://foo3"), "D=1"); | |
| 721 CookiesTreeModel cookies_model(monster, | |
| 722 mock_browsing_data_database_helper_, | 689 mock_browsing_data_database_helper_, |
| 723 mock_browsing_data_local_storage_helper_, | 690 mock_browsing_data_local_storage_helper_, |
| 724 mock_browsing_data_session_storage_helper_, | 691 mock_browsing_data_session_storage_helper_, |
| 725 mock_browsing_data_appcache_helper_, | 692 mock_browsing_data_appcache_helper_, |
| 726 mock_browsing_data_indexed_db_helper_, | 693 mock_browsing_data_indexed_db_helper_, |
| 727 mock_browsing_data_file_system_helper_, | 694 mock_browsing_data_file_system_helper_, |
| 728 mock_browsing_data_quota_helper_, | 695 mock_browsing_data_quota_helper_, |
| 729 false); | 696 false); |
| 697 mock_browsing_data_cookie_helper_-> |
| 698 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 699 mock_browsing_data_cookie_helper_-> |
| 700 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 701 mock_browsing_data_cookie_helper_-> |
| 702 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 703 mock_browsing_data_cookie_helper_-> |
| 704 AddCookieSamples(GURL("http://foo3"), "D=1"); |
| 705 mock_browsing_data_cookie_helper_->Notify(); |
| 730 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 706 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 731 mock_browsing_data_database_helper_->Notify(); | 707 mock_browsing_data_database_helper_->Notify(); |
| 732 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 708 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 733 mock_browsing_data_local_storage_helper_->Notify(); | 709 mock_browsing_data_local_storage_helper_->Notify(); |
| 734 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 710 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 735 mock_browsing_data_session_storage_helper_->Notify(); | 711 mock_browsing_data_session_storage_helper_->Notify(); |
| 736 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 712 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 737 mock_browsing_data_indexed_db_helper_->Notify(); | 713 mock_browsing_data_indexed_db_helper_->Notify(); |
| 738 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 714 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 739 mock_browsing_data_file_system_helper_->Notify(); | 715 mock_browsing_data_file_system_helper_->Notify(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 751 // fshost2 -> filesystem -> http://fshost2:1/, | 727 // fshost2 -> filesystem -> http://fshost2:1/, |
| 752 // fshost3 -> filesystem -> http://fshost3:1/, | 728 // fshost3 -> filesystem -> http://fshost3:1/, |
| 753 // host1 -> localstorage -> http://host1:1/, | 729 // host1 -> localstorage -> http://host1:1/, |
| 754 // host1 -> sessionstorage -> http://host1:1/, | 730 // host1 -> sessionstorage -> http://host1:1/, |
| 755 // host2 -> sessionstorage -> http://host2:2/, | 731 // host2 -> sessionstorage -> http://host2:2/, |
| 756 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 732 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
| 757 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 733 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
| 758 // quotahost1 -> quotahost1, | 734 // quotahost1 -> quotahost1, |
| 759 // quotahost2 -> quotahost2. | 735 // quotahost2 -> quotahost2. |
| 760 EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); | 736 EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 761 EXPECT_STREQ("A,B,C,D", GetMonsterCookies(monster).c_str()); | |
| 762 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); | 737 EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str()); |
| 763 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 738 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 764 EXPECT_EQ("http://host1:1/,http://host2:2/", | 739 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 765 GetDisplayedLocalStorages(&cookies_model)); | 740 GetDisplayedLocalStorages(&cookies_model)); |
| 766 EXPECT_EQ("http://host1:1/,http://host2:2/", | 741 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 767 GetDisplayedSessionStorages(&cookies_model)); | 742 GetDisplayedSessionStorages(&cookies_model)); |
| 768 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 743 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 769 GetDisplayedIndexedDBs(&cookies_model)); | 744 GetDisplayedIndexedDBs(&cookies_model)); |
| 770 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 745 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 771 GetDisplayedFileSystems(&cookies_model)); | 746 GetDisplayedFileSystems(&cookies_model)); |
| 772 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 747 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 773 } | 748 } |
| 774 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)); | 749 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)); |
| 775 { | 750 { |
| 776 SCOPED_TRACE("Third origin removed"); | 751 SCOPED_TRACE("Third origin removed"); |
| 777 EXPECT_STREQ("A,B", GetMonsterCookies(monster).c_str()); | |
| 778 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); | 752 EXPECT_STREQ("A,B", GetDisplayedCookies(&cookies_model).c_str()); |
| 779 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 753 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 780 EXPECT_EQ("http://host1:1/,http://host2:2/", | 754 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 781 GetDisplayedLocalStorages(&cookies_model)); | 755 GetDisplayedLocalStorages(&cookies_model)); |
| 782 EXPECT_EQ("http://host1:1/,http://host2:2/", | 756 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 783 GetDisplayedSessionStorages(&cookies_model)); | 757 GetDisplayedSessionStorages(&cookies_model)); |
| 784 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 758 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 785 GetDisplayedIndexedDBs(&cookies_model)); | 759 GetDisplayedIndexedDBs(&cookies_model)); |
| 786 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 760 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 787 GetDisplayedFileSystems(&cookies_model)); | 761 GetDisplayedFileSystems(&cookies_model)); |
| 788 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 762 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 789 EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); | 763 EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 790 } | 764 } |
| 791 } | 765 } |
| 792 | 766 |
| 793 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { | 767 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { |
| 794 net::CookieMonster* monster = profile_->GetCookieMonster(); | 768 CookiesTreeModel cookies_model(mock_browsing_data_cookie_helper_, |
| 795 monster->SetCookie(GURL("http://foo1"), "A=1"); | |
| 796 monster->SetCookie(GURL("http://foo2"), "B=1"); | |
| 797 monster->SetCookie(GURL("http://foo3"), "C=1"); | |
| 798 monster->SetCookie(GURL("http://foo3"), "D=1"); | |
| 799 monster->SetCookie(GURL("http://foo3"), "E=1"); | |
| 800 CookiesTreeModel cookies_model(monster, | |
| 801 mock_browsing_data_database_helper_, | 769 mock_browsing_data_database_helper_, |
| 802 mock_browsing_data_local_storage_helper_, | 770 mock_browsing_data_local_storage_helper_, |
| 803 mock_browsing_data_session_storage_helper_, | 771 mock_browsing_data_session_storage_helper_, |
| 804 mock_browsing_data_appcache_helper_, | 772 mock_browsing_data_appcache_helper_, |
| 805 mock_browsing_data_indexed_db_helper_, | 773 mock_browsing_data_indexed_db_helper_, |
| 806 mock_browsing_data_file_system_helper_, | 774 mock_browsing_data_file_system_helper_, |
| 807 mock_browsing_data_quota_helper_, | 775 mock_browsing_data_quota_helper_, |
| 808 false); | 776 false); |
| 777 mock_browsing_data_cookie_helper_-> |
| 778 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 779 mock_browsing_data_cookie_helper_-> |
| 780 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 781 mock_browsing_data_cookie_helper_-> |
| 782 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 783 mock_browsing_data_cookie_helper_-> |
| 784 AddCookieSamples(GURL("http://foo3"), "D=1"); |
| 785 mock_browsing_data_cookie_helper_-> |
| 786 AddCookieSamples(GURL("http://foo3"), "E=1"); |
| 787 mock_browsing_data_cookie_helper_->Notify(); |
| 809 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 788 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 810 mock_browsing_data_database_helper_->Notify(); | 789 mock_browsing_data_database_helper_->Notify(); |
| 811 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 790 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 812 mock_browsing_data_local_storage_helper_->Notify(); | 791 mock_browsing_data_local_storage_helper_->Notify(); |
| 813 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 792 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 814 mock_browsing_data_session_storage_helper_->Notify(); | 793 mock_browsing_data_session_storage_helper_->Notify(); |
| 815 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 794 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 816 mock_browsing_data_indexed_db_helper_->Notify(); | 795 mock_browsing_data_indexed_db_helper_->Notify(); |
| 817 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 796 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 818 mock_browsing_data_file_system_helper_->Notify(); | 797 mock_browsing_data_file_system_helper_->Notify(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 831 // fshost3 -> filesystem -> http://fshost3:1/, | 810 // fshost3 -> filesystem -> http://fshost3:1/, |
| 832 // host1 -> localstorage -> http://host1:1/, | 811 // host1 -> localstorage -> http://host1:1/, |
| 833 // host2 -> localstorage -> http://host2:2/, | 812 // host2 -> localstorage -> http://host2:2/, |
| 834 // host1 -> sessionstorage -> http://host1:1/, | 813 // host1 -> sessionstorage -> http://host1:1/, |
| 835 // host2 -> sessionstorage -> http://host2:2/, | 814 // host2 -> sessionstorage -> http://host2:2/, |
| 836 // idbhost1 -> sessionstorage -> http://idbhost1:1/, | 815 // idbhost1 -> sessionstorage -> http://idbhost1:1/, |
| 837 // idbhost2 -> sessionstorage -> http://idbhost2:2/, | 816 // idbhost2 -> sessionstorage -> http://idbhost2:2/, |
| 838 // quotahost1 -> quotahost1, | 817 // quotahost1 -> quotahost1, |
| 839 // quotahost2 -> quotahost2. | 818 // quotahost2 -> quotahost2. |
| 840 EXPECT_EQ(47, cookies_model.GetRoot()->GetTotalNodeCount()); | 819 EXPECT_EQ(47, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 841 EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str()); | |
| 842 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 820 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 843 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 821 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 844 EXPECT_EQ("http://host1:1/,http://host2:2/", | 822 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 845 GetDisplayedLocalStorages(&cookies_model)); | 823 GetDisplayedLocalStorages(&cookies_model)); |
| 846 EXPECT_EQ("http://host1:1/,http://host2:2/", | 824 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 847 GetDisplayedSessionStorages(&cookies_model)); | 825 GetDisplayedSessionStorages(&cookies_model)); |
| 848 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 826 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 849 GetDisplayedIndexedDBs(&cookies_model)); | 827 GetDisplayedIndexedDBs(&cookies_model)); |
| 850 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 828 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 851 GetDisplayedFileSystems(&cookies_model)); | 829 GetDisplayedFileSystems(&cookies_model)); |
| 852 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 830 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 853 } | 831 } |
| 854 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)-> | 832 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)-> |
| 855 GetChild(1)); | 833 GetChild(1)); |
| 856 { | 834 { |
| 857 SCOPED_TRACE("Middle cookie in third origin removed"); | 835 SCOPED_TRACE("Middle cookie in third origin removed"); |
| 858 EXPECT_STREQ("A,B,C,E", GetMonsterCookies(monster).c_str()); | |
| 859 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); | 836 EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 860 EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); | 837 EXPECT_EQ(46, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 861 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); | 838 EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model)); |
| 862 EXPECT_EQ("http://host1:1/,http://host2:2/", | 839 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 863 GetDisplayedLocalStorages(&cookies_model)); | 840 GetDisplayedLocalStorages(&cookies_model)); |
| 864 EXPECT_EQ("http://host1:1/,http://host2:2/", | 841 EXPECT_EQ("http://host1:1/,http://host2:2/", |
| 865 GetDisplayedSessionStorages(&cookies_model)); | 842 GetDisplayedSessionStorages(&cookies_model)); |
| 866 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 843 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
| 867 GetDisplayedIndexedDBs(&cookies_model)); | 844 GetDisplayedIndexedDBs(&cookies_model)); |
| 868 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 845 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 869 GetDisplayedFileSystems(&cookies_model)); | 846 GetDisplayedFileSystems(&cookies_model)); |
| 870 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 847 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
| 871 } | 848 } |
| 872 } | 849 } |
| 873 | 850 |
| 874 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 851 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
| 875 net::CookieMonster* monster = profile_->GetCookieMonster(); | 852 CookiesTreeModel cookies_model(mock_browsing_data_cookie_helper_, |
| 876 monster->SetCookie(GURL("http://foo1"), "A=1"); | |
| 877 monster->SetCookie(GURL("http://foo2"), "B=1"); | |
| 878 monster->SetCookie(GURL("http://foo3"), "C=1"); | |
| 879 monster->SetCookie(GURL("http://foo3"), "D=1"); | |
| 880 monster->SetCookie(GURL("http://foo3"), "E=1"); | |
| 881 CookiesTreeModel cookies_model(monster, | |
| 882 mock_browsing_data_database_helper_, | 853 mock_browsing_data_database_helper_, |
| 883 mock_browsing_data_local_storage_helper_, | 854 mock_browsing_data_local_storage_helper_, |
| 884 mock_browsing_data_session_storage_helper_, | 855 mock_browsing_data_session_storage_helper_, |
| 885 mock_browsing_data_appcache_helper_, | 856 mock_browsing_data_appcache_helper_, |
| 886 mock_browsing_data_indexed_db_helper_, | 857 mock_browsing_data_indexed_db_helper_, |
| 887 mock_browsing_data_file_system_helper_, | 858 mock_browsing_data_file_system_helper_, |
| 888 mock_browsing_data_quota_helper_, | 859 mock_browsing_data_quota_helper_, |
| 889 false); | 860 false); |
| 861 mock_browsing_data_cookie_helper_-> |
| 862 AddCookieSamples(GURL("http://foo1"), "A=1"); |
| 863 mock_browsing_data_cookie_helper_-> |
| 864 AddCookieSamples(GURL("http://foo2"), "B=1"); |
| 865 mock_browsing_data_cookie_helper_-> |
| 866 AddCookieSamples(GURL("http://foo3"), "C=1"); |
| 867 mock_browsing_data_cookie_helper_-> |
| 868 AddCookieSamples(GURL("http://foo3"), "D=1"); |
| 869 mock_browsing_data_cookie_helper_-> |
| 870 AddCookieSamples(GURL("http://foo3"), "E=1"); |
| 871 mock_browsing_data_cookie_helper_->Notify(); |
| 872 |
| 890 { | 873 { |
| 891 SCOPED_TRACE("Initial State 5 cookies"); | 874 SCOPED_TRACE("Initial State 5 cookies"); |
| 892 // 11 because there's the root, then foo1 -> cookies -> a, | 875 // 11 because there's the root, then foo1 -> cookies -> a, |
| 893 // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e | 876 // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e |
| 894 EXPECT_EQ(12, cookies_model.GetRoot()->GetTotalNodeCount()); | 877 EXPECT_EQ(12, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 895 EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str()); | |
| 896 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 878 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 897 } | 879 } |
| 898 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); | 880 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); |
| 899 { | 881 { |
| 900 SCOPED_TRACE("Second origin removed"); | 882 SCOPED_TRACE("Second origin removed"); |
| 901 EXPECT_STREQ("A,C,D,E", GetMonsterCookies(monster).c_str()); | |
| 902 EXPECT_STREQ("A,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 883 EXPECT_STREQ("A,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 903 // Left with root -> foo1 -> cookies -> a, foo3 -> cookies -> c,d,e | 884 // Left with root -> foo1 -> cookies -> a, foo3 -> cookies -> c,d,e |
| 904 EXPECT_EQ(9, cookies_model.GetRoot()->GetTotalNodeCount()); | 885 EXPECT_EQ(9, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 905 } | 886 } |
| 906 } | 887 } |
| 907 | 888 |
| 908 TEST_F(CookiesTreeModelTest, OriginOrdering) { | 889 TEST_F(CookiesTreeModelTest, OriginOrdering) { |
| 909 net::CookieMonster* monster = profile_->GetCookieMonster(); | 890 CookiesTreeModel cookies_model(mock_browsing_data_cookie_helper_, |
| 910 monster->SetCookie(GURL("http://a.foo2.com"), "A=1"); | 891 mock_browsing_data_database_helper_, |
| 911 monster->SetCookie(GURL("http://foo2.com"), "B=1"); | 892 mock_browsing_data_local_storage_helper_, |
| 912 monster->SetCookie(GURL("http://b.foo1.com"), "C=1"); | 893 mock_browsing_data_session_storage_helper_, |
| 913 monster->SetCookie(GURL("http://foo4.com"), "D=1; domain=.foo4.com;" | 894 mock_browsing_data_appcache_helper_, |
| 914 " path=/;"); // Leading dot on the foo4 | 895 mock_browsing_data_indexed_db_helper_, |
| 915 monster->SetCookie(GURL("http://a.foo1.com"), "E=1"); | 896 mock_browsing_data_file_system_helper_, |
| 916 monster->SetCookie(GURL("http://foo1.com"), "F=1"); | 897 mock_browsing_data_quota_helper_, |
| 917 monster->SetCookie(GURL("http://foo3.com"), "G=1"); | 898 false); |
| 918 monster->SetCookie(GURL("http://foo4.com"), "H=1"); | 899 mock_browsing_data_cookie_helper_-> |
| 919 | 900 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); |
| 920 CookiesTreeModel cookies_model(monster, | 901 mock_browsing_data_cookie_helper_-> |
| 921 new MockBrowsingDataDatabaseHelper(profile_.get()), | 902 AddCookieSamples(GURL("http://foo2.com"), "B=1"); |
| 922 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 903 mock_browsing_data_cookie_helper_-> |
| 923 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 904 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); |
| 924 new MockBrowsingDataAppCacheHelper(profile_.get()), | 905 // Leading dot on the foo4 |
| 925 new MockBrowsingDataIndexedDBHelper(profile_.get()), | 906 mock_browsing_data_cookie_helper_->AddCookieSamples( |
| 926 new MockBrowsingDataFileSystemHelper(profile_.get()), | 907 GURL("http://foo4.com"), "D=1; domain=.foo4.com; path=/;"); |
| 927 new MockBrowsingDataQuotaHelper(profile_.get()), | 908 mock_browsing_data_cookie_helper_-> |
| 928 false); | 909 AddCookieSamples(GURL("http://a.foo1.com"), "E=1"); |
| 910 mock_browsing_data_cookie_helper_-> |
| 911 AddCookieSamples(GURL("http://foo1.com"), "F=1"); |
| 912 mock_browsing_data_cookie_helper_-> |
| 913 AddCookieSamples(GURL("http://foo3.com"), "G=1"); |
| 914 mock_browsing_data_cookie_helper_-> |
| 915 AddCookieSamples(GURL("http://foo4.com"), "H=1"); |
| 916 mock_browsing_data_cookie_helper_->Notify(); |
| 929 | 917 |
| 930 { | 918 { |
| 931 SCOPED_TRACE("Initial State 8 cookies"); | 919 SCOPED_TRACE("Initial State 8 cookies"); |
| 932 // CookieMonster orders cookies by pathlength, then by creation time. | 920 EXPECT_EQ(23, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 933 // All paths are length 1. | |
| 934 EXPECT_STREQ("A,B,C,D,E,F,G,H", GetMonsterCookies(monster).c_str()); | |
| 935 EXPECT_STREQ("F,E,C,B,A,G,D,H", | 921 EXPECT_STREQ("F,E,C,B,A,G,D,H", |
| 936 GetDisplayedCookies(&cookies_model).c_str()); | 922 GetDisplayedCookies(&cookies_model).c_str()); |
| 937 } | 923 } |
| 938 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); // Delete "E" | 924 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); // Delete "E" |
| 939 { | 925 { |
| 940 EXPECT_STREQ("A,B,C,D,F,G,H", GetMonsterCookies(monster).c_str()); | |
| 941 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); | 926 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); |
| 942 } | 927 } |
| 943 } | 928 } |
| 944 | 929 |
| 945 TEST_F(CookiesTreeModelTest, ContentSettings) { | 930 TEST_F(CookiesTreeModelTest, ContentSettings) { |
| 946 GURL host("http://example.com/"); | 931 GURL host("http://example.com/"); |
| 947 net::CookieMonster* monster = profile_->GetCookieMonster(); | 932 CookiesTreeModel cookies_model(mock_browsing_data_cookie_helper_, |
| 948 monster->SetCookie(host, "A=1"); | 933 mock_browsing_data_database_helper_, |
| 949 | 934 mock_browsing_data_local_storage_helper_, |
| 950 CookiesTreeModel cookies_model(monster, | 935 mock_browsing_data_session_storage_helper_, |
| 951 new MockBrowsingDataDatabaseHelper(profile_.get()), | 936 mock_browsing_data_appcache_helper_, |
| 952 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 937 mock_browsing_data_indexed_db_helper_, |
| 953 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 938 mock_browsing_data_file_system_helper_, |
| 954 new MockBrowsingDataAppCacheHelper(profile_.get()), | 939 mock_browsing_data_quota_helper_, |
| 955 new MockBrowsingDataIndexedDBHelper(profile_.get()), | 940 false); |
| 956 new MockBrowsingDataFileSystemHelper(profile_.get()), | 941 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); |
| 957 new MockBrowsingDataQuotaHelper(profile_.get()), | 942 mock_browsing_data_cookie_helper_->Notify(); |
| 958 false); | |
| 959 | 943 |
| 960 TestingProfile profile; | 944 TestingProfile profile; |
| 961 HostContentSettingsMap* content_settings = | 945 HostContentSettingsMap* content_settings = |
| 962 profile.GetHostContentSettingsMap(); | 946 profile.GetHostContentSettingsMap(); |
| 963 MockSettingsObserver observer; | 947 MockSettingsObserver observer; |
| 964 | 948 |
| 965 CookieTreeRootNode* root = | 949 CookieTreeRootNode* root = |
| 966 static_cast<CookieTreeRootNode*>(cookies_model.GetRoot()); | 950 static_cast<CookieTreeRootNode*>(cookies_model.GetRoot()); |
| 967 CookieTreeOriginNode* origin = root->GetOrCreateOriginNode(host); | 951 CookieTreeOriginNode* origin = root->GetOrCreateOriginNode(host); |
| 968 | 952 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); | 988 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); |
| 1005 EXPECT_EQ("http://fshost3:3/", | 989 EXPECT_EQ("http://fshost3:3/", |
| 1006 GetDisplayedFileSystems(cookies_model.get())); | 990 GetDisplayedFileSystems(cookies_model.get())); |
| 1007 | 991 |
| 1008 cookies_model->UpdateSearchResults(std::wstring()); | 992 cookies_model->UpdateSearchResults(std::wstring()); |
| 1009 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 993 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1010 GetDisplayedFileSystems(cookies_model.get())); | 994 GetDisplayedFileSystems(cookies_model.get())); |
| 1011 } | 995 } |
| 1012 | 996 |
| 1013 } // namespace | 997 } // namespace |
| OLD | NEW |