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