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/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 258 matching lines...) Loading... |
269 quit_closure_.Run(); | 269 quit_closure_.Run(); |
270 } | 270 } |
271 | 271 |
272 bool get_cookie_success_; | 272 bool get_cookie_success_; |
273 base::Closure quit_closure_; | 273 base::Closure quit_closure_; |
274 net::CookieStore* cookie_store_; | 274 net::CookieStore* cookie_store_; |
275 | 275 |
276 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); | 276 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); |
277 }; | 277 }; |
278 | 278 |
279 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 279 #if defined(SAFE_BROWSING_SERVICE) |
280 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { | 280 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { |
281 public: | 281 public: |
282 RemoveSafeBrowsingCookieTester() | 282 RemoveSafeBrowsingCookieTester() |
283 : browser_process_(TestingBrowserProcess::GetGlobal()) { | 283 : browser_process_(TestingBrowserProcess::GetGlobal()) { |
284 scoped_refptr<SafeBrowsingService> sb_service = | 284 scoped_refptr<SafeBrowsingService> sb_service = |
285 SafeBrowsingService::CreateSafeBrowsingService(); | 285 SafeBrowsingService::CreateSafeBrowsingService(); |
286 browser_process_->SetSafeBrowsingService(sb_service.get()); | 286 browser_process_->SetSafeBrowsingService(sb_service.get()); |
287 sb_service->Initialize(); | 287 sb_service->Initialize(); |
288 base::MessageLoop::current()->RunUntilIdle(); | 288 base::MessageLoop::current()->RunUntilIdle(); |
289 | 289 |
(...skipping 605 matching lines...) Loading... |
895 EXPECT_EQ(removal_data.remove_mask, | 895 EXPECT_EQ(removal_data.remove_mask, |
896 StoragePartition::REMOVE_DATA_MASK_COOKIES); | 896 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
897 // Removing with time period other than EVERYTHING should not clear | 897 // Removing with time period other than EVERYTHING should not clear |
898 // persistent storage data. | 898 // persistent storage data. |
899 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 899 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
900 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); | 900 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
901 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | 901 EXPECT_TRUE(removal_data.remove_origin.is_empty()); |
902 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 902 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
903 } | 903 } |
904 | 904 |
905 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 905 #if defined(SAFE_BROWSING_SERVICE) |
906 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { | 906 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { |
907 RemoveSafeBrowsingCookieTester tester; | 907 RemoveSafeBrowsingCookieTester tester; |
908 | 908 |
909 tester.AddCookie(); | 909 tester.AddCookie(); |
910 ASSERT_TRUE(tester.ContainsCookie()); | 910 ASSERT_TRUE(tester.ContainsCookie()); |
911 | 911 |
912 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 912 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
913 BrowsingDataRemover::REMOVE_COOKIES, false); | 913 BrowsingDataRemover::REMOVE_COOKIES, false); |
914 | 914 |
915 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 915 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
(...skipping 882 matching lines...) Loading... |
1798 EXPECT_EQ(1u, tester.clear_count()); | 1798 EXPECT_EQ(1u, tester.clear_count()); |
1799 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); | 1799 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
1800 } | 1800 } |
1801 | 1801 |
1802 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { | 1802 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { |
1803 BlockUntilBrowsingDataRemoved( | 1803 BlockUntilBrowsingDataRemoved( |
1804 BrowsingDataRemover::EVERYTHING, | 1804 BrowsingDataRemover::EVERYTHING, |
1805 BrowsingDataRemover::REMOVE_HISTORY | | 1805 BrowsingDataRemover::REMOVE_HISTORY | |
1806 BrowsingDataRemover::REMOVE_COOKIES, false); | 1806 BrowsingDataRemover::REMOVE_COOKIES, false); |
1807 } | 1807 } |
OLD | NEW |