| 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_database_helper.h" | 12 #include "chrome/browser/mock_browsing_data_database_helper.h" |
| 13 #include "chrome/browser/mock_browsing_data_file_system_helper.h" | 13 #include "chrome/browser/mock_browsing_data_file_system_helper.h" |
| 14 #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" | 14 #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" |
| 15 #include "chrome/browser/mock_browsing_data_quota_helper.h" |
| 15 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" | 16 #include "chrome/browser/mock_browsing_data_local_storage_helper.h" |
| 16 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
| 17 #include "content/common/content_notification_types.h" | 18 #include "content/common/content_notification_types.h" |
| 18 #include "content/common/notification_details.h" | 19 #include "content/common/notification_details.h" |
| 19 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 24 | 25 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 mock_browsing_data_local_storage_helper_ = | 44 mock_browsing_data_local_storage_helper_ = |
| 44 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 45 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 45 mock_browsing_data_session_storage_helper_ = | 46 mock_browsing_data_session_storage_helper_ = |
| 46 new MockBrowsingDataLocalStorageHelper(profile_.get()); | 47 new MockBrowsingDataLocalStorageHelper(profile_.get()); |
| 47 mock_browsing_data_appcache_helper_ = | 48 mock_browsing_data_appcache_helper_ = |
| 48 new MockBrowsingDataAppCacheHelper(profile_.get()); | 49 new MockBrowsingDataAppCacheHelper(profile_.get()); |
| 49 mock_browsing_data_indexed_db_helper_ = | 50 mock_browsing_data_indexed_db_helper_ = |
| 50 new MockBrowsingDataIndexedDBHelper(profile_.get()); | 51 new MockBrowsingDataIndexedDBHelper(profile_.get()); |
| 51 mock_browsing_data_file_system_helper_ = | 52 mock_browsing_data_file_system_helper_ = |
| 52 new MockBrowsingDataFileSystemHelper(profile_.get()); | 53 new MockBrowsingDataFileSystemHelper(profile_.get()); |
| 54 mock_browsing_data_quota_helper_ = |
| 55 new MockBrowsingDataQuotaHelper(profile_.get()); |
| 53 } | 56 } |
| 54 | 57 |
| 55 CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() { | 58 CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() { |
| 56 net::CookieMonster* monster = profile_->GetCookieMonster(); | 59 net::CookieMonster* monster = profile_->GetCookieMonster(); |
| 57 monster->SetCookie(GURL("http://foo1"), "A=1"); | 60 monster->SetCookie(GURL("http://foo1"), "A=1"); |
| 58 monster->SetCookie(GURL("http://foo2"), "B=1"); | 61 monster->SetCookie(GURL("http://foo2"), "B=1"); |
| 59 monster->SetCookie(GURL("http://foo3"), "C=1"); | 62 monster->SetCookie(GURL("http://foo3"), "C=1"); |
| 60 CookiesTreeModel* cookies_model = new CookiesTreeModel( | 63 CookiesTreeModel* cookies_model = new CookiesTreeModel( |
| 61 monster, mock_browsing_data_database_helper_, | 64 monster, mock_browsing_data_database_helper_, |
| 62 mock_browsing_data_local_storage_helper_, | 65 mock_browsing_data_local_storage_helper_, |
| 63 mock_browsing_data_session_storage_helper_, | 66 mock_browsing_data_session_storage_helper_, |
| 64 mock_browsing_data_appcache_helper_, | 67 mock_browsing_data_appcache_helper_, |
| 65 mock_browsing_data_indexed_db_helper_, | 68 mock_browsing_data_indexed_db_helper_, |
| 66 mock_browsing_data_file_system_helper_, | 69 mock_browsing_data_file_system_helper_, |
| 70 mock_browsing_data_quota_helper_, |
| 67 false); | 71 false); |
| 68 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 72 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 69 mock_browsing_data_database_helper_->Notify(); | 73 mock_browsing_data_database_helper_->Notify(); |
| 70 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 74 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 71 mock_browsing_data_local_storage_helper_->Notify(); | 75 mock_browsing_data_local_storage_helper_->Notify(); |
| 72 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 76 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 73 mock_browsing_data_session_storage_helper_->Notify(); | 77 mock_browsing_data_session_storage_helper_->Notify(); |
| 74 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 78 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 75 mock_browsing_data_indexed_db_helper_->Notify(); | 79 mock_browsing_data_indexed_db_helper_->Notify(); |
| 76 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 80 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 77 mock_browsing_data_file_system_helper_->Notify(); | 81 mock_browsing_data_file_system_helper_->Notify(); |
| 82 mock_browsing_data_quota_helper_->Notify(); |
| 78 { | 83 { |
| 79 SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " | 84 SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " |
| 80 "2 session storages, 2 indexed DBs, 3 filesystems"); | 85 "2 session storages, 2 indexed DBs, 3 filesystems"); |
| 81 // 41 because there's the root, then foo1 -> cookies -> a, | 86 // 41 because there's the root, then foo1 -> cookies -> a, |
| 82 // foo2 -> cookies -> b, foo3 -> cookies -> c, | 87 // foo2 -> cookies -> b, foo3 -> cookies -> c, |
| 83 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, | 88 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, |
| 84 // fshost1 -> filesystem -> http://fshost1:1/, | 89 // fshost1 -> filesystem -> http://fshost1:1/, |
| 85 // fshost2 -> filesystem -> http://fshost2:1/, | 90 // fshost2 -> filesystem -> http://fshost2:1/, |
| 86 // fshost3 -> filesystem -> http://fshost3:1/, | 91 // fshost3 -> filesystem -> http://fshost3:1/, |
| 87 // host1 -> localstorage -> http://host1:1/, | 92 // host1 -> localstorage -> http://host1:1/, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 256 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| 252 mock_browsing_data_local_storage_helper_; | 257 mock_browsing_data_local_storage_helper_; |
| 253 scoped_refptr<MockBrowsingDataLocalStorageHelper> | 258 scoped_refptr<MockBrowsingDataLocalStorageHelper> |
| 254 mock_browsing_data_session_storage_helper_; | 259 mock_browsing_data_session_storage_helper_; |
| 255 scoped_refptr<MockBrowsingDataAppCacheHelper> | 260 scoped_refptr<MockBrowsingDataAppCacheHelper> |
| 256 mock_browsing_data_appcache_helper_; | 261 mock_browsing_data_appcache_helper_; |
| 257 scoped_refptr<MockBrowsingDataIndexedDBHelper> | 262 scoped_refptr<MockBrowsingDataIndexedDBHelper> |
| 258 mock_browsing_data_indexed_db_helper_; | 263 mock_browsing_data_indexed_db_helper_; |
| 259 scoped_refptr<MockBrowsingDataFileSystemHelper> | 264 scoped_refptr<MockBrowsingDataFileSystemHelper> |
| 260 mock_browsing_data_file_system_helper_; | 265 mock_browsing_data_file_system_helper_; |
| 266 scoped_refptr<MockBrowsingDataQuotaHelper> |
| 267 mock_browsing_data_quota_helper_; |
| 261 }; | 268 }; |
| 262 | 269 |
| 263 TEST_F(CookiesTreeModelTest, RemoveAll) { | 270 TEST_F(CookiesTreeModelTest, RemoveAll) { |
| 264 scoped_ptr<CookiesTreeModel> cookies_model( | 271 scoped_ptr<CookiesTreeModel> cookies_model( |
| 265 CreateCookiesTreeModelWithInitialSample()); | 272 CreateCookiesTreeModelWithInitialSample()); |
| 266 net::CookieMonster* monster = profile_->GetCookieMonster(); | 273 net::CookieMonster* monster = profile_->GetCookieMonster(); |
| 267 | 274 |
| 268 // Reset the selection of the first row. | 275 // Reset the selection of the first row. |
| 269 { | 276 { |
| 270 SCOPED_TRACE("Before removing"); | 277 SCOPED_TRACE("Before removing"); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 monster->SetCookie(GURL("http://foo2"), "B=1"); | 640 monster->SetCookie(GURL("http://foo2"), "B=1"); |
| 634 monster->SetCookie(GURL("http://foo3"), "C=1"); | 641 monster->SetCookie(GURL("http://foo3"), "C=1"); |
| 635 monster->SetCookie(GURL("http://foo3"), "D=1"); | 642 monster->SetCookie(GURL("http://foo3"), "D=1"); |
| 636 CookiesTreeModel cookies_model(monster, | 643 CookiesTreeModel cookies_model(monster, |
| 637 mock_browsing_data_database_helper_, | 644 mock_browsing_data_database_helper_, |
| 638 mock_browsing_data_local_storage_helper_, | 645 mock_browsing_data_local_storage_helper_, |
| 639 mock_browsing_data_session_storage_helper_, | 646 mock_browsing_data_session_storage_helper_, |
| 640 mock_browsing_data_appcache_helper_, | 647 mock_browsing_data_appcache_helper_, |
| 641 mock_browsing_data_indexed_db_helper_, | 648 mock_browsing_data_indexed_db_helper_, |
| 642 mock_browsing_data_file_system_helper_, | 649 mock_browsing_data_file_system_helper_, |
| 650 mock_browsing_data_quota_helper_, |
| 643 false); | 651 false); |
| 644 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 652 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 645 mock_browsing_data_database_helper_->Notify(); | 653 mock_browsing_data_database_helper_->Notify(); |
| 646 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 654 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 647 mock_browsing_data_local_storage_helper_->Notify(); | 655 mock_browsing_data_local_storage_helper_->Notify(); |
| 648 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 656 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 649 mock_browsing_data_session_storage_helper_->Notify(); | 657 mock_browsing_data_session_storage_helper_->Notify(); |
| 650 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 658 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 651 mock_browsing_data_indexed_db_helper_->Notify(); | 659 mock_browsing_data_indexed_db_helper_->Notify(); |
| 652 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 660 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| 653 mock_browsing_data_file_system_helper_->Notify(); | 661 mock_browsing_data_file_system_helper_->Notify(); |
| 662 mock_browsing_data_quota_helper_->Notify(); |
| 654 | 663 |
| 655 { | 664 { |
| 656 SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, " | 665 SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, " |
| 657 "2 session storages, 2 indexed DBs, 3 file systems"); | 666 "2 session storages, 2 indexed DBs, 3 file systems"); |
| 658 // 42 because there's the root, then foo1 -> cookies -> a, | 667 // 42 because there's the root, then foo1 -> cookies -> a, |
| 659 // foo2 -> cookies -> b, foo3 -> cookies -> c,d | 668 // foo2 -> cookies -> b, foo3 -> cookies -> c,d |
| 660 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, | 669 // dbhost1 -> database -> db1, dbhost2 -> database -> db2, |
| 661 // fshost1 -> filesystem -> http://fshost1:1/, | 670 // fshost1 -> filesystem -> http://fshost1:1/, |
| 662 // fshost2 -> filesystem -> http://fshost2:1/, | 671 // fshost2 -> filesystem -> http://fshost2:1/, |
| 663 // fshost3 -> filesystem -> http://fshost3:1/, | 672 // fshost3 -> filesystem -> http://fshost3:1/, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 monster->SetCookie(GURL("http://foo3"), "C=1"); | 713 monster->SetCookie(GURL("http://foo3"), "C=1"); |
| 705 monster->SetCookie(GURL("http://foo3"), "D=1"); | 714 monster->SetCookie(GURL("http://foo3"), "D=1"); |
| 706 monster->SetCookie(GURL("http://foo3"), "E=1"); | 715 monster->SetCookie(GURL("http://foo3"), "E=1"); |
| 707 CookiesTreeModel cookies_model(monster, | 716 CookiesTreeModel cookies_model(monster, |
| 708 mock_browsing_data_database_helper_, | 717 mock_browsing_data_database_helper_, |
| 709 mock_browsing_data_local_storage_helper_, | 718 mock_browsing_data_local_storage_helper_, |
| 710 mock_browsing_data_session_storage_helper_, | 719 mock_browsing_data_session_storage_helper_, |
| 711 mock_browsing_data_appcache_helper_, | 720 mock_browsing_data_appcache_helper_, |
| 712 mock_browsing_data_indexed_db_helper_, | 721 mock_browsing_data_indexed_db_helper_, |
| 713 mock_browsing_data_file_system_helper_, | 722 mock_browsing_data_file_system_helper_, |
| 723 mock_browsing_data_quota_helper_, |
| 714 false); | 724 false); |
| 715 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 725 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
| 716 mock_browsing_data_database_helper_->Notify(); | 726 mock_browsing_data_database_helper_->Notify(); |
| 717 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 727 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
| 718 mock_browsing_data_local_storage_helper_->Notify(); | 728 mock_browsing_data_local_storage_helper_->Notify(); |
| 719 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); | 729 mock_browsing_data_session_storage_helper_->AddLocalStorageSamples(); |
| 720 mock_browsing_data_session_storage_helper_->Notify(); | 730 mock_browsing_data_session_storage_helper_->Notify(); |
| 721 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); | 731 mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples(); |
| 722 mock_browsing_data_indexed_db_helper_->Notify(); | 732 mock_browsing_data_indexed_db_helper_->Notify(); |
| 723 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); | 733 mock_browsing_data_file_system_helper_->AddFileSystemSamples(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 monster->SetCookie(GURL("http://foo3"), "C=1"); | 787 monster->SetCookie(GURL("http://foo3"), "C=1"); |
| 778 monster->SetCookie(GURL("http://foo3"), "D=1"); | 788 monster->SetCookie(GURL("http://foo3"), "D=1"); |
| 779 monster->SetCookie(GURL("http://foo3"), "E=1"); | 789 monster->SetCookie(GURL("http://foo3"), "E=1"); |
| 780 CookiesTreeModel cookies_model(monster, | 790 CookiesTreeModel cookies_model(monster, |
| 781 mock_browsing_data_database_helper_, | 791 mock_browsing_data_database_helper_, |
| 782 mock_browsing_data_local_storage_helper_, | 792 mock_browsing_data_local_storage_helper_, |
| 783 mock_browsing_data_session_storage_helper_, | 793 mock_browsing_data_session_storage_helper_, |
| 784 mock_browsing_data_appcache_helper_, | 794 mock_browsing_data_appcache_helper_, |
| 785 mock_browsing_data_indexed_db_helper_, | 795 mock_browsing_data_indexed_db_helper_, |
| 786 mock_browsing_data_file_system_helper_, | 796 mock_browsing_data_file_system_helper_, |
| 797 mock_browsing_data_quota_helper_, |
| 787 false); | 798 false); |
| 788 { | 799 { |
| 789 SCOPED_TRACE("Initial State 5 cookies"); | 800 SCOPED_TRACE("Initial State 5 cookies"); |
| 790 // 11 because there's the root, then foo1 -> cookies -> a, | 801 // 11 because there's the root, then foo1 -> cookies -> a, |
| 791 // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e | 802 // foo2 -> cookies -> b, foo3 -> cookies -> c,d,e |
| 792 EXPECT_EQ(12, cookies_model.GetRoot()->GetTotalNodeCount()); | 803 EXPECT_EQ(12, cookies_model.GetRoot()->GetTotalNodeCount()); |
| 793 EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str()); | 804 EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str()); |
| 794 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 805 EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
| 795 } | 806 } |
| 796 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); | 807 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 815 monster->SetCookie(GURL("http://foo3.com"), "G=1"); | 826 monster->SetCookie(GURL("http://foo3.com"), "G=1"); |
| 816 monster->SetCookie(GURL("http://foo4.com"), "H=1"); | 827 monster->SetCookie(GURL("http://foo4.com"), "H=1"); |
| 817 | 828 |
| 818 CookiesTreeModel cookies_model(monster, | 829 CookiesTreeModel cookies_model(monster, |
| 819 new MockBrowsingDataDatabaseHelper(profile_.get()), | 830 new MockBrowsingDataDatabaseHelper(profile_.get()), |
| 820 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 831 new MockBrowsingDataLocalStorageHelper(profile_.get()), |
| 821 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 832 new MockBrowsingDataLocalStorageHelper(profile_.get()), |
| 822 new MockBrowsingDataAppCacheHelper(profile_.get()), | 833 new MockBrowsingDataAppCacheHelper(profile_.get()), |
| 823 new MockBrowsingDataIndexedDBHelper(profile_.get()), | 834 new MockBrowsingDataIndexedDBHelper(profile_.get()), |
| 824 new MockBrowsingDataFileSystemHelper(profile_.get()), | 835 new MockBrowsingDataFileSystemHelper(profile_.get()), |
| 836 new MockBrowsingDataQuotaHelper(profile_.get()), |
| 825 false); | 837 false); |
| 826 | 838 |
| 827 { | 839 { |
| 828 SCOPED_TRACE("Initial State 8 cookies"); | 840 SCOPED_TRACE("Initial State 8 cookies"); |
| 829 // CookieMonster orders cookies by pathlength, then by creation time. | 841 // CookieMonster orders cookies by pathlength, then by creation time. |
| 830 // All paths are length 1. | 842 // All paths are length 1. |
| 831 EXPECT_STREQ("A,B,C,D,E,F,G,H", GetMonsterCookies(monster).c_str()); | 843 EXPECT_STREQ("A,B,C,D,E,F,G,H", GetMonsterCookies(monster).c_str()); |
| 832 EXPECT_STREQ("F,E,C,B,A,G,D,H", | 844 EXPECT_STREQ("F,E,C,B,A,G,D,H", |
| 833 GetDisplayedCookies(&cookies_model).c_str()); | 845 GetDisplayedCookies(&cookies_model).c_str()); |
| 834 } | 846 } |
| 835 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); // Delete "E" | 847 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); // Delete "E" |
| 836 { | 848 { |
| 837 EXPECT_STREQ("A,B,C,D,F,G,H", GetMonsterCookies(monster).c_str()); | 849 EXPECT_STREQ("A,B,C,D,F,G,H", GetMonsterCookies(monster).c_str()); |
| 838 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); | 850 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); |
| 839 } | 851 } |
| 840 } | 852 } |
| 841 | 853 |
| 842 TEST_F(CookiesTreeModelTest, ContentSettings) { | 854 TEST_F(CookiesTreeModelTest, ContentSettings) { |
| 843 GURL host("http://example.com/"); | 855 GURL host("http://example.com/"); |
| 844 net::CookieMonster* monster = profile_->GetCookieMonster(); | 856 net::CookieMonster* monster = profile_->GetCookieMonster(); |
| 845 monster->SetCookie(host, "A=1"); | 857 monster->SetCookie(host, "A=1"); |
| 846 | 858 |
| 847 CookiesTreeModel cookies_model(monster, | 859 CookiesTreeModel cookies_model(monster, |
| 848 new MockBrowsingDataDatabaseHelper(profile_.get()), | 860 new MockBrowsingDataDatabaseHelper(profile_.get()), |
| 849 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 861 new MockBrowsingDataLocalStorageHelper(profile_.get()), |
| 850 new MockBrowsingDataLocalStorageHelper(profile_.get()), | 862 new MockBrowsingDataLocalStorageHelper(profile_.get()), |
| 851 new MockBrowsingDataAppCacheHelper(profile_.get()), | 863 new MockBrowsingDataAppCacheHelper(profile_.get()), |
| 852 new MockBrowsingDataIndexedDBHelper(profile_.get()), | 864 new MockBrowsingDataIndexedDBHelper(profile_.get()), |
| 853 new MockBrowsingDataFileSystemHelper(profile_.get()), | 865 new MockBrowsingDataFileSystemHelper(profile_.get()), |
| 866 new MockBrowsingDataQuotaHelper(profile_.get()), |
| 854 false); | 867 false); |
| 855 | 868 |
| 856 TestingProfile profile; | 869 TestingProfile profile; |
| 857 HostContentSettingsMap* content_settings = | 870 HostContentSettingsMap* content_settings = |
| 858 profile.GetHostContentSettingsMap(); | 871 profile.GetHostContentSettingsMap(); |
| 859 MockSettingsObserver observer; | 872 MockSettingsObserver observer; |
| 860 | 873 |
| 861 CookieTreeRootNode* root = | 874 CookieTreeRootNode* root = |
| 862 static_cast<CookieTreeRootNode*>(cookies_model.GetRoot()); | 875 static_cast<CookieTreeRootNode*>(cookies_model.GetRoot()); |
| 863 CookieTreeOriginNode* origin = root->GetOrCreateOriginNode(host); | 876 CookieTreeOriginNode* origin = root->GetOrCreateOriginNode(host); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); | 913 cookies_model->UpdateSearchResults(std::wstring(L"fshost3")); |
| 901 EXPECT_EQ("http://fshost3:3/", | 914 EXPECT_EQ("http://fshost3:3/", |
| 902 GetDisplayedFileSystems(cookies_model.get())); | 915 GetDisplayedFileSystems(cookies_model.get())); |
| 903 | 916 |
| 904 cookies_model->UpdateSearchResults(std::wstring()); | 917 cookies_model->UpdateSearchResults(std::wstring()); |
| 905 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 918 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 906 GetDisplayedFileSystems(cookies_model.get())); | 919 GetDisplayedFileSystems(cookies_model.get())); |
| 907 } | 920 } |
| 908 | 921 |
| 909 } // namespace | 922 } // namespace |
| OLD | NEW |