OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 new MockBrowsingDataQuotaHelper(profile_.get()); | 72 new MockBrowsingDataQuotaHelper(profile_.get()); |
73 mock_browsing_data_server_bound_cert_helper_ = | 73 mock_browsing_data_server_bound_cert_helper_ = |
74 new MockBrowsingDataServerBoundCertHelper(); | 74 new MockBrowsingDataServerBoundCertHelper(); |
75 mock_browsing_data_flash_lso_helper_ = | 75 mock_browsing_data_flash_lso_helper_ = |
76 new MockBrowsingDataFlashLSOHelper(profile_.get()); | 76 new MockBrowsingDataFlashLSOHelper(profile_.get()); |
77 | 77 |
78 scoped_refptr<CookieSettings> cookie_settings = | 78 scoped_refptr<CookieSettings> cookie_settings = |
79 new CookieSettings(profile_->GetHostContentSettingsMap(), | 79 new CookieSettings(profile_->GetHostContentSettingsMap(), |
80 profile_->GetPrefs()); | 80 profile_->GetPrefs()); |
81 special_storage_policy_ = | 81 special_storage_policy_ = |
82 new ExtensionSpecialStoragePolicy(cookie_settings); | 82 new ExtensionSpecialStoragePolicy(cookie_settings.get()); |
83 } | 83 } |
84 | 84 |
85 virtual void TearDown() OVERRIDE { | 85 virtual void TearDown() OVERRIDE { |
86 mock_browsing_data_server_bound_cert_helper_ = NULL; | 86 mock_browsing_data_server_bound_cert_helper_ = NULL; |
87 mock_browsing_data_quota_helper_ = NULL; | 87 mock_browsing_data_quota_helper_ = NULL; |
88 mock_browsing_data_file_system_helper_ = NULL; | 88 mock_browsing_data_file_system_helper_ = NULL; |
89 mock_browsing_data_indexed_db_helper_ = NULL; | 89 mock_browsing_data_indexed_db_helper_ = NULL; |
90 mock_browsing_data_appcache_helper_ = NULL; | 90 mock_browsing_data_appcache_helper_ = NULL; |
91 mock_browsing_data_session_storage_helper_ = NULL; | 91 mock_browsing_data_session_storage_helper_ = NULL; |
92 mock_browsing_data_local_storage_helper_ = NULL; | 92 mock_browsing_data_local_storage_helper_ = NULL; |
93 mock_browsing_data_database_helper_ = NULL; | 93 mock_browsing_data_database_helper_ = NULL; |
94 mock_browsing_data_flash_lso_helper_ = NULL; | 94 mock_browsing_data_flash_lso_helper_ = NULL; |
95 message_loop_.RunUntilIdle(); | 95 message_loop_.RunUntilIdle(); |
96 } | 96 } |
97 | 97 |
98 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { | 98 scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { |
99 LocalDataContainer* container = new LocalDataContainer( | 99 LocalDataContainer* container = new LocalDataContainer( |
100 mock_browsing_data_cookie_helper_, | 100 mock_browsing_data_cookie_helper_.get(), |
101 mock_browsing_data_database_helper_, | 101 mock_browsing_data_database_helper_.get(), |
102 mock_browsing_data_local_storage_helper_, | 102 mock_browsing_data_local_storage_helper_.get(), |
103 mock_browsing_data_session_storage_helper_, | 103 mock_browsing_data_session_storage_helper_.get(), |
104 mock_browsing_data_appcache_helper_, | 104 mock_browsing_data_appcache_helper_.get(), |
105 mock_browsing_data_indexed_db_helper_, | 105 mock_browsing_data_indexed_db_helper_.get(), |
106 mock_browsing_data_file_system_helper_, | 106 mock_browsing_data_file_system_helper_.get(), |
107 mock_browsing_data_quota_helper_, | 107 mock_browsing_data_quota_helper_.get(), |
108 mock_browsing_data_server_bound_cert_helper_, | 108 mock_browsing_data_server_bound_cert_helper_.get(), |
109 mock_browsing_data_flash_lso_helper_); | 109 mock_browsing_data_flash_lso_helper_.get()); |
110 | 110 |
111 CookiesTreeModel* cookies_model = | 111 CookiesTreeModel* cookies_model = |
112 new CookiesTreeModel(container, | 112 new CookiesTreeModel(container, special_storage_policy_.get(), false); |
113 special_storage_policy_, | |
114 false); | |
115 mock_browsing_data_cookie_helper_-> | 113 mock_browsing_data_cookie_helper_-> |
116 AddCookieSamples(GURL("http://foo1"), "A=1"); | 114 AddCookieSamples(GURL("http://foo1"), "A=1"); |
117 mock_browsing_data_cookie_helper_-> | 115 mock_browsing_data_cookie_helper_-> |
118 AddCookieSamples(GURL("http://foo2"), "B=1"); | 116 AddCookieSamples(GURL("http://foo2"), "B=1"); |
119 mock_browsing_data_cookie_helper_-> | 117 mock_browsing_data_cookie_helper_-> |
120 AddCookieSamples(GURL("http://foo3"), "C=1"); | 118 AddCookieSamples(GURL("http://foo3"), "C=1"); |
121 mock_browsing_data_cookie_helper_->Notify(); | 119 mock_browsing_data_cookie_helper_->Notify(); |
122 mock_browsing_data_database_helper_->AddDatabaseSamples(); | 120 mock_browsing_data_database_helper_->AddDatabaseSamples(); |
123 mock_browsing_data_database_helper_->Notify(); | 121 mock_browsing_data_database_helper_->Notify(); |
124 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); | 122 mock_browsing_data_local_storage_helper_->AddLocalStorageSamples(); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 GetDisplayedIndexedDBs(cookies_model.get())); | 811 GetDisplayedIndexedDBs(cookies_model.get())); |
814 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 812 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
815 GetDisplayedFileSystems(cookies_model.get())); | 813 GetDisplayedFileSystems(cookies_model.get())); |
816 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); | 814 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(cookies_model.get())); |
817 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); | 815 EXPECT_EQ("sbc1,sbc2", GetDisplayedServerBoundCerts(cookies_model.get())); |
818 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); | 816 EXPECT_EQ(47, cookies_model->GetRoot()->GetTotalNodeCount()); |
819 } | 817 } |
820 } | 818 } |
821 | 819 |
822 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { | 820 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { |
823 LocalDataContainer* container = new LocalDataContainer( | 821 LocalDataContainer* container = |
824 mock_browsing_data_cookie_helper_, | 822 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
825 mock_browsing_data_database_helper_, | 823 mock_browsing_data_database_helper_.get(), |
826 mock_browsing_data_local_storage_helper_, | 824 mock_browsing_data_local_storage_helper_.get(), |
827 mock_browsing_data_session_storage_helper_, | 825 mock_browsing_data_session_storage_helper_.get(), |
828 mock_browsing_data_appcache_helper_, | 826 mock_browsing_data_appcache_helper_.get(), |
829 mock_browsing_data_indexed_db_helper_, | 827 mock_browsing_data_indexed_db_helper_.get(), |
830 mock_browsing_data_file_system_helper_, | 828 mock_browsing_data_file_system_helper_.get(), |
831 mock_browsing_data_quota_helper_, | 829 mock_browsing_data_quota_helper_.get(), |
832 mock_browsing_data_server_bound_cert_helper_, | 830 mock_browsing_data_server_bound_cert_helper_.get(), |
833 mock_browsing_data_flash_lso_helper_); | 831 mock_browsing_data_flash_lso_helper_.get()); |
834 CookiesTreeModel cookies_model(container, special_storage_policy_, false); | 832 CookiesTreeModel cookies_model( |
| 833 container, special_storage_policy_.get(), false); |
835 | 834 |
836 mock_browsing_data_cookie_helper_-> | 835 mock_browsing_data_cookie_helper_-> |
837 AddCookieSamples(GURL("http://foo1"), "A=1"); | 836 AddCookieSamples(GURL("http://foo1"), "A=1"); |
838 mock_browsing_data_cookie_helper_-> | 837 mock_browsing_data_cookie_helper_-> |
839 AddCookieSamples(GURL("http://foo2"), "B=1"); | 838 AddCookieSamples(GURL("http://foo2"), "B=1"); |
840 mock_browsing_data_cookie_helper_-> | 839 mock_browsing_data_cookie_helper_-> |
841 AddCookieSamples(GURL("http://foo3"), "C=1"); | 840 AddCookieSamples(GURL("http://foo3"), "C=1"); |
842 mock_browsing_data_cookie_helper_-> | 841 mock_browsing_data_cookie_helper_-> |
843 AddCookieSamples(GURL("http://foo3"), "D=1"); | 842 AddCookieSamples(GURL("http://foo3"), "D=1"); |
844 mock_browsing_data_cookie_helper_->Notify(); | 843 mock_browsing_data_cookie_helper_->Notify(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 900 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
902 GetDisplayedIndexedDBs(&cookies_model)); | 901 GetDisplayedIndexedDBs(&cookies_model)); |
903 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 902 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
904 GetDisplayedFileSystems(&cookies_model)); | 903 GetDisplayedFileSystems(&cookies_model)); |
905 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 904 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
906 EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); | 905 EXPECT_EQ(42, cookies_model.GetRoot()->GetTotalNodeCount()); |
907 } | 906 } |
908 } | 907 } |
909 | 908 |
910 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { | 909 TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { |
911 LocalDataContainer* container = new LocalDataContainer( | 910 LocalDataContainer* container = |
912 mock_browsing_data_cookie_helper_, | 911 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
913 mock_browsing_data_database_helper_, | 912 mock_browsing_data_database_helper_.get(), |
914 mock_browsing_data_local_storage_helper_, | 913 mock_browsing_data_local_storage_helper_.get(), |
915 mock_browsing_data_session_storage_helper_, | 914 mock_browsing_data_session_storage_helper_.get(), |
916 mock_browsing_data_appcache_helper_, | 915 mock_browsing_data_appcache_helper_.get(), |
917 mock_browsing_data_indexed_db_helper_, | 916 mock_browsing_data_indexed_db_helper_.get(), |
918 mock_browsing_data_file_system_helper_, | 917 mock_browsing_data_file_system_helper_.get(), |
919 mock_browsing_data_quota_helper_, | 918 mock_browsing_data_quota_helper_.get(), |
920 mock_browsing_data_server_bound_cert_helper_, | 919 mock_browsing_data_server_bound_cert_helper_.get(), |
921 mock_browsing_data_flash_lso_helper_); | 920 mock_browsing_data_flash_lso_helper_.get()); |
922 CookiesTreeModel cookies_model(container, special_storage_policy_,false); | 921 CookiesTreeModel cookies_model( |
| 922 container, special_storage_policy_.get(), false); |
923 | 923 |
924 mock_browsing_data_cookie_helper_-> | 924 mock_browsing_data_cookie_helper_-> |
925 AddCookieSamples(GURL("http://foo1"), "A=1"); | 925 AddCookieSamples(GURL("http://foo1"), "A=1"); |
926 mock_browsing_data_cookie_helper_-> | 926 mock_browsing_data_cookie_helper_-> |
927 AddCookieSamples(GURL("http://foo2"), "B=1"); | 927 AddCookieSamples(GURL("http://foo2"), "B=1"); |
928 mock_browsing_data_cookie_helper_-> | 928 mock_browsing_data_cookie_helper_-> |
929 AddCookieSamples(GURL("http://foo3"), "C=1"); | 929 AddCookieSamples(GURL("http://foo3"), "C=1"); |
930 mock_browsing_data_cookie_helper_-> | 930 mock_browsing_data_cookie_helper_-> |
931 AddCookieSamples(GURL("http://foo3"), "D=1"); | 931 AddCookieSamples(GURL("http://foo3"), "D=1"); |
932 mock_browsing_data_cookie_helper_-> | 932 mock_browsing_data_cookie_helper_-> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 GetDisplayedSessionStorages(&cookies_model)); | 992 GetDisplayedSessionStorages(&cookies_model)); |
993 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", | 993 EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/", |
994 GetDisplayedIndexedDBs(&cookies_model)); | 994 GetDisplayedIndexedDBs(&cookies_model)); |
995 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 995 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
996 GetDisplayedFileSystems(&cookies_model)); | 996 GetDisplayedFileSystems(&cookies_model)); |
997 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); | 997 EXPECT_EQ("quotahost1,quotahost2", GetDisplayedQuotas(&cookies_model)); |
998 } | 998 } |
999 } | 999 } |
1000 | 1000 |
1001 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { | 1001 TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { |
1002 LocalDataContainer* container = new LocalDataContainer( | 1002 LocalDataContainer* container = |
1003 mock_browsing_data_cookie_helper_, | 1003 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1004 mock_browsing_data_database_helper_, | 1004 mock_browsing_data_database_helper_.get(), |
1005 mock_browsing_data_local_storage_helper_, | 1005 mock_browsing_data_local_storage_helper_.get(), |
1006 mock_browsing_data_session_storage_helper_, | 1006 mock_browsing_data_session_storage_helper_.get(), |
1007 mock_browsing_data_appcache_helper_, | 1007 mock_browsing_data_appcache_helper_.get(), |
1008 mock_browsing_data_indexed_db_helper_, | 1008 mock_browsing_data_indexed_db_helper_.get(), |
1009 mock_browsing_data_file_system_helper_, | 1009 mock_browsing_data_file_system_helper_.get(), |
1010 mock_browsing_data_quota_helper_, | 1010 mock_browsing_data_quota_helper_.get(), |
1011 mock_browsing_data_server_bound_cert_helper_, | 1011 mock_browsing_data_server_bound_cert_helper_.get(), |
1012 mock_browsing_data_flash_lso_helper_); | 1012 mock_browsing_data_flash_lso_helper_.get()); |
1013 CookiesTreeModel cookies_model(container, special_storage_policy_,false); | 1013 CookiesTreeModel cookies_model( |
| 1014 container, special_storage_policy_.get(), false); |
1014 | 1015 |
1015 mock_browsing_data_cookie_helper_-> | 1016 mock_browsing_data_cookie_helper_-> |
1016 AddCookieSamples(GURL("http://foo1"), "A=1"); | 1017 AddCookieSamples(GURL("http://foo1"), "A=1"); |
1017 mock_browsing_data_cookie_helper_-> | 1018 mock_browsing_data_cookie_helper_-> |
1018 AddCookieSamples(GURL("http://foo2"), "B=1"); | 1019 AddCookieSamples(GURL("http://foo2"), "B=1"); |
1019 mock_browsing_data_cookie_helper_-> | 1020 mock_browsing_data_cookie_helper_-> |
1020 AddCookieSamples(GURL("http://foo3"), "C=1"); | 1021 AddCookieSamples(GURL("http://foo3"), "C=1"); |
1021 mock_browsing_data_cookie_helper_-> | 1022 mock_browsing_data_cookie_helper_-> |
1022 AddCookieSamples(GURL("http://foo3"), "D=1"); | 1023 AddCookieSamples(GURL("http://foo3"), "D=1"); |
1023 mock_browsing_data_cookie_helper_-> | 1024 mock_browsing_data_cookie_helper_-> |
(...skipping 10 matching lines...) Expand all Loading... |
1034 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); | 1035 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); |
1035 { | 1036 { |
1036 SCOPED_TRACE("Second origin removed"); | 1037 SCOPED_TRACE("Second origin removed"); |
1037 EXPECT_STREQ("A,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); | 1038 EXPECT_STREQ("A,C,D,E", GetDisplayedCookies(&cookies_model).c_str()); |
1038 // Left with root -> foo1 -> cookies -> a, foo3 -> cookies -> c,d,e | 1039 // Left with root -> foo1 -> cookies -> a, foo3 -> cookies -> c,d,e |
1039 EXPECT_EQ(9, cookies_model.GetRoot()->GetTotalNodeCount()); | 1040 EXPECT_EQ(9, cookies_model.GetRoot()->GetTotalNodeCount()); |
1040 } | 1041 } |
1041 } | 1042 } |
1042 | 1043 |
1043 TEST_F(CookiesTreeModelTest, OriginOrdering) { | 1044 TEST_F(CookiesTreeModelTest, OriginOrdering) { |
1044 LocalDataContainer* container = new LocalDataContainer( | 1045 LocalDataContainer* container = |
1045 mock_browsing_data_cookie_helper_, | 1046 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1046 mock_browsing_data_database_helper_, | 1047 mock_browsing_data_database_helper_.get(), |
1047 mock_browsing_data_local_storage_helper_, | 1048 mock_browsing_data_local_storage_helper_.get(), |
1048 mock_browsing_data_session_storage_helper_, | 1049 mock_browsing_data_session_storage_helper_.get(), |
1049 mock_browsing_data_appcache_helper_, | 1050 mock_browsing_data_appcache_helper_.get(), |
1050 mock_browsing_data_indexed_db_helper_, | 1051 mock_browsing_data_indexed_db_helper_.get(), |
1051 mock_browsing_data_file_system_helper_, | 1052 mock_browsing_data_file_system_helper_.get(), |
1052 mock_browsing_data_quota_helper_, | 1053 mock_browsing_data_quota_helper_.get(), |
1053 mock_browsing_data_server_bound_cert_helper_, | 1054 mock_browsing_data_server_bound_cert_helper_.get(), |
1054 mock_browsing_data_flash_lso_helper_); | 1055 mock_browsing_data_flash_lso_helper_.get()); |
1055 CookiesTreeModel cookies_model(container, special_storage_policy_, false); | 1056 CookiesTreeModel cookies_model( |
| 1057 container, special_storage_policy_.get(), false); |
1056 | 1058 |
1057 mock_browsing_data_cookie_helper_-> | 1059 mock_browsing_data_cookie_helper_-> |
1058 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); | 1060 AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); |
1059 mock_browsing_data_cookie_helper_-> | 1061 mock_browsing_data_cookie_helper_-> |
1060 AddCookieSamples(GURL("http://foo2.com"), "B=1"); | 1062 AddCookieSamples(GURL("http://foo2.com"), "B=1"); |
1061 mock_browsing_data_cookie_helper_-> | 1063 mock_browsing_data_cookie_helper_-> |
1062 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); | 1064 AddCookieSamples(GURL("http://b.foo1.com"), "C=1"); |
1063 // Leading dot on the foo4 | 1065 // Leading dot on the foo4 |
1064 mock_browsing_data_cookie_helper_->AddCookieSamples( | 1066 mock_browsing_data_cookie_helper_->AddCookieSamples( |
1065 GURL("http://foo4.com"), "D=1; domain=.foo4.com; path=/;"); | 1067 GURL("http://foo4.com"), "D=1; domain=.foo4.com; path=/;"); |
(...skipping 15 matching lines...) Expand all Loading... |
1081 } | 1083 } |
1082 // Delete "E" | 1084 // Delete "E" |
1083 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); | 1085 DeleteStoredObjects(cookies_model.GetRoot()->GetChild(1)); |
1084 { | 1086 { |
1085 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); | 1087 EXPECT_STREQ("F,C,B,A,G,D,H", GetDisplayedCookies(&cookies_model).c_str()); |
1086 } | 1088 } |
1087 } | 1089 } |
1088 | 1090 |
1089 TEST_F(CookiesTreeModelTest, ContentSettings) { | 1091 TEST_F(CookiesTreeModelTest, ContentSettings) { |
1090 GURL host("http://xyz.com/"); | 1092 GURL host("http://xyz.com/"); |
1091 LocalDataContainer* container = new LocalDataContainer( | 1093 LocalDataContainer* container = |
1092 mock_browsing_data_cookie_helper_, | 1094 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1093 mock_browsing_data_database_helper_, | 1095 mock_browsing_data_database_helper_.get(), |
1094 mock_browsing_data_local_storage_helper_, | 1096 mock_browsing_data_local_storage_helper_.get(), |
1095 mock_browsing_data_session_storage_helper_, | 1097 mock_browsing_data_session_storage_helper_.get(), |
1096 mock_browsing_data_appcache_helper_, | 1098 mock_browsing_data_appcache_helper_.get(), |
1097 mock_browsing_data_indexed_db_helper_, | 1099 mock_browsing_data_indexed_db_helper_.get(), |
1098 mock_browsing_data_file_system_helper_, | 1100 mock_browsing_data_file_system_helper_.get(), |
1099 mock_browsing_data_quota_helper_, | 1101 mock_browsing_data_quota_helper_.get(), |
1100 mock_browsing_data_server_bound_cert_helper_, | 1102 mock_browsing_data_server_bound_cert_helper_.get(), |
1101 mock_browsing_data_flash_lso_helper_); | 1103 mock_browsing_data_flash_lso_helper_.get()); |
1102 CookiesTreeModel cookies_model(container, special_storage_policy_, false); | 1104 CookiesTreeModel cookies_model( |
| 1105 container, special_storage_policy_.get(), false); |
1103 | 1106 |
1104 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); | 1107 mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); |
1105 mock_browsing_data_cookie_helper_->Notify(); | 1108 mock_browsing_data_cookie_helper_->Notify(); |
1106 | 1109 |
1107 TestingProfile profile; | 1110 TestingProfile profile; |
1108 HostContentSettingsMap* content_settings = | 1111 HostContentSettingsMap* content_settings = |
1109 profile.GetHostContentSettingsMap(); | 1112 profile.GetHostContentSettingsMap(); |
1110 CookieSettings* cookie_settings = | 1113 CookieSettings* cookie_settings = |
1111 CookieSettings::Factory::GetForProfile(&profile); | 1114 CookieSettings::Factory::GetForProfile(&profile); |
1112 MockSettingsObserver observer; | 1115 MockSettingsObserver observer; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost3")); | 1157 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost3")); |
1155 EXPECT_EQ("http://fshost3:3/", | 1158 EXPECT_EQ("http://fshost3:3/", |
1156 GetDisplayedFileSystems(cookies_model.get())); | 1159 GetDisplayedFileSystems(cookies_model.get())); |
1157 | 1160 |
1158 cookies_model->UpdateSearchResults(string16()); | 1161 cookies_model->UpdateSearchResults(string16()); |
1159 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1162 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
1160 GetDisplayedFileSystems(cookies_model.get())); | 1163 GetDisplayedFileSystems(cookies_model.get())); |
1161 } | 1164 } |
1162 | 1165 |
1163 TEST_F(CookiesTreeModelTest, CookiesFilter) { | 1166 TEST_F(CookiesTreeModelTest, CookiesFilter) { |
1164 LocalDataContainer* container = new LocalDataContainer( | 1167 LocalDataContainer* container = |
1165 mock_browsing_data_cookie_helper_, | 1168 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
1166 mock_browsing_data_database_helper_, | 1169 mock_browsing_data_database_helper_.get(), |
1167 mock_browsing_data_local_storage_helper_, | 1170 mock_browsing_data_local_storage_helper_.get(), |
1168 mock_browsing_data_session_storage_helper_, | 1171 mock_browsing_data_session_storage_helper_.get(), |
1169 mock_browsing_data_appcache_helper_, | 1172 mock_browsing_data_appcache_helper_.get(), |
1170 mock_browsing_data_indexed_db_helper_, | 1173 mock_browsing_data_indexed_db_helper_.get(), |
1171 mock_browsing_data_file_system_helper_, | 1174 mock_browsing_data_file_system_helper_.get(), |
1172 mock_browsing_data_quota_helper_, | 1175 mock_browsing_data_quota_helper_.get(), |
1173 mock_browsing_data_server_bound_cert_helper_, | 1176 mock_browsing_data_server_bound_cert_helper_.get(), |
1174 mock_browsing_data_flash_lso_helper_); | 1177 mock_browsing_data_flash_lso_helper_.get()); |
1175 CookiesTreeModel cookies_model(container, special_storage_policy_, false); | 1178 CookiesTreeModel cookies_model( |
| 1179 container, special_storage_policy_.get(), false); |
1176 | 1180 |
1177 mock_browsing_data_cookie_helper_-> | 1181 mock_browsing_data_cookie_helper_-> |
1178 AddCookieSamples(GURL("http://123.com"), "A=1"); | 1182 AddCookieSamples(GURL("http://123.com"), "A=1"); |
1179 mock_browsing_data_cookie_helper_-> | 1183 mock_browsing_data_cookie_helper_-> |
1180 AddCookieSamples(GURL("http://foo1.com"), "B=1"); | 1184 AddCookieSamples(GURL("http://foo1.com"), "B=1"); |
1181 mock_browsing_data_cookie_helper_-> | 1185 mock_browsing_data_cookie_helper_-> |
1182 AddCookieSamples(GURL("http://foo2.com"), "C=1"); | 1186 AddCookieSamples(GURL("http://foo2.com"), "C=1"); |
1183 mock_browsing_data_cookie_helper_-> | 1187 mock_browsing_data_cookie_helper_-> |
1184 AddCookieSamples(GURL("http://foo3.com"), "D=1"); | 1188 AddCookieSamples(GURL("http://foo3.com"), "D=1"); |
1185 mock_browsing_data_cookie_helper_->Notify(); | 1189 mock_browsing_data_cookie_helper_->Notify(); |
1186 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1190 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1187 | 1191 |
1188 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo"))); | 1192 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo"))); |
1189 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); | 1193 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); |
1190 | 1194 |
1191 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("2"))); | 1195 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("2"))); |
1192 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1196 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
1193 | 1197 |
1194 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo3"))); | 1198 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo3"))); |
1195 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1199 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
1196 | 1200 |
1197 cookies_model.UpdateSearchResults(string16()); | 1201 cookies_model.UpdateSearchResults(string16()); |
1198 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1202 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
1199 } | 1203 } |
1200 | 1204 |
1201 } // namespace | 1205 } // namespace |
OLD | NEW |