| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 5 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 mock_browsing_data_database_helper_->Reset(); | 389 mock_browsing_data_database_helper_->Reset(); |
| 390 mock_browsing_data_local_storage_helper_->Reset(); | 390 mock_browsing_data_local_storage_helper_->Reset(); |
| 391 mock_browsing_data_session_storage_helper_->Reset(); | 391 mock_browsing_data_session_storage_helper_->Reset(); |
| 392 mock_browsing_data_indexed_db_helper_->Reset(); | 392 mock_browsing_data_indexed_db_helper_->Reset(); |
| 393 mock_browsing_data_file_system_helper_->Reset(); | 393 mock_browsing_data_file_system_helper_->Reset(); |
| 394 | 394 |
| 395 cookies_model->DeleteAllStoredObjects(); | 395 cookies_model->DeleteAllStoredObjects(); |
| 396 | 396 |
| 397 // Make sure the nodes are also deleted from the model's cache. | 397 // Make sure the nodes are also deleted from the model's cache. |
| 398 // http://crbug.com/43249 | 398 // http://crbug.com/43249 |
| 399 cookies_model->UpdateSearchResults(string16()); | 399 cookies_model->UpdateSearchResults(base::string16()); |
| 400 | 400 |
| 401 { | 401 { |
| 402 // 2 nodes - root and app | 402 // 2 nodes - root and app |
| 403 SCOPED_TRACE("After removing"); | 403 SCOPED_TRACE("After removing"); |
| 404 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); | 404 EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); |
| 405 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); | 405 EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); |
| 406 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); | 406 EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); |
| 407 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); | 407 EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); |
| 408 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); | 408 EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); |
| 409 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); | 409 EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 GetDisplayedFileSystems(cookies_model.get())); | 1140 GetDisplayedFileSystems(cookies_model.get())); |
| 1141 | 1141 |
| 1142 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost2")); | 1142 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost2")); |
| 1143 EXPECT_EQ("http://fshost2:2/", | 1143 EXPECT_EQ("http://fshost2:2/", |
| 1144 GetDisplayedFileSystems(cookies_model.get())); | 1144 GetDisplayedFileSystems(cookies_model.get())); |
| 1145 | 1145 |
| 1146 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost3")); | 1146 cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost3")); |
| 1147 EXPECT_EQ("http://fshost3:3/", | 1147 EXPECT_EQ("http://fshost3:3/", |
| 1148 GetDisplayedFileSystems(cookies_model.get())); | 1148 GetDisplayedFileSystems(cookies_model.get())); |
| 1149 | 1149 |
| 1150 cookies_model->UpdateSearchResults(string16()); | 1150 cookies_model->UpdateSearchResults(base::string16()); |
| 1151 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", | 1151 EXPECT_EQ("http://fshost1:1/,http://fshost2:2/,http://fshost3:3/", |
| 1152 GetDisplayedFileSystems(cookies_model.get())); | 1152 GetDisplayedFileSystems(cookies_model.get())); |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 TEST_F(CookiesTreeModelTest, CookiesFilter) { | 1155 TEST_F(CookiesTreeModelTest, CookiesFilter) { |
| 1156 LocalDataContainer* container = | 1156 LocalDataContainer* container = |
| 1157 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), | 1157 new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), |
| 1158 mock_browsing_data_database_helper_.get(), | 1158 mock_browsing_data_database_helper_.get(), |
| 1159 mock_browsing_data_local_storage_helper_.get(), | 1159 mock_browsing_data_local_storage_helper_.get(), |
| 1160 mock_browsing_data_session_storage_helper_.get(), | 1160 mock_browsing_data_session_storage_helper_.get(), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1171 AddCookieSamples(GURL("http://123.com"), "A=1"); | 1171 AddCookieSamples(GURL("http://123.com"), "A=1"); |
| 1172 mock_browsing_data_cookie_helper_-> | 1172 mock_browsing_data_cookie_helper_-> |
| 1173 AddCookieSamples(GURL("http://foo1.com"), "B=1"); | 1173 AddCookieSamples(GURL("http://foo1.com"), "B=1"); |
| 1174 mock_browsing_data_cookie_helper_-> | 1174 mock_browsing_data_cookie_helper_-> |
| 1175 AddCookieSamples(GURL("http://foo2.com"), "C=1"); | 1175 AddCookieSamples(GURL("http://foo2.com"), "C=1"); |
| 1176 mock_browsing_data_cookie_helper_-> | 1176 mock_browsing_data_cookie_helper_-> |
| 1177 AddCookieSamples(GURL("http://foo3.com"), "D=1"); | 1177 AddCookieSamples(GURL("http://foo3.com"), "D=1"); |
| 1178 mock_browsing_data_cookie_helper_->Notify(); | 1178 mock_browsing_data_cookie_helper_->Notify(); |
| 1179 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1179 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
| 1180 | 1180 |
| 1181 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo"))); | 1181 cookies_model.UpdateSearchResults(base::string16(ASCIIToUTF16("foo"))); |
| 1182 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); | 1182 EXPECT_EQ("B,C,D", GetDisplayedCookies(&cookies_model)); |
| 1183 | 1183 |
| 1184 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("2"))); | 1184 cookies_model.UpdateSearchResults(base::string16(ASCIIToUTF16("2"))); |
| 1185 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); | 1185 EXPECT_EQ("A,C", GetDisplayedCookies(&cookies_model)); |
| 1186 | 1186 |
| 1187 cookies_model.UpdateSearchResults(string16(ASCIIToUTF16("foo3"))); | 1187 cookies_model.UpdateSearchResults(base::string16(ASCIIToUTF16("foo3"))); |
| 1188 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); | 1188 EXPECT_EQ("D", GetDisplayedCookies(&cookies_model)); |
| 1189 | 1189 |
| 1190 cookies_model.UpdateSearchResults(string16()); | 1190 cookies_model.UpdateSearchResults(base::string16()); |
| 1191 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); | 1191 EXPECT_EQ("A,B,C,D", GetDisplayedCookies(&cookies_model)); |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 } // namespace | 1194 } // namespace |
| OLD | NEW |