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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 quit_closure_.Run(); | 258 quit_closure_.Run(); |
259 } | 259 } |
260 | 260 |
261 bool get_cookie_success_; | 261 bool get_cookie_success_; |
262 base::Closure quit_closure_; | 262 base::Closure quit_closure_; |
263 net::CookieStore* cookie_store_; | 263 net::CookieStore* cookie_store_; |
264 | 264 |
265 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); | 265 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); |
266 }; | 266 }; |
267 | 267 |
268 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 268 #if defined(SAFE_BROWSING_SERVICE) |
269 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { | 269 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { |
270 public: | 270 public: |
271 RemoveSafeBrowsingCookieTester() | 271 RemoveSafeBrowsingCookieTester() |
272 : browser_process_(TestingBrowserProcess::GetGlobal()) { | 272 : browser_process_(TestingBrowserProcess::GetGlobal()) { |
273 scoped_refptr<SafeBrowsingService> sb_service = | 273 scoped_refptr<SafeBrowsingService> sb_service = |
274 SafeBrowsingService::CreateSafeBrowsingService(); | 274 SafeBrowsingService::CreateSafeBrowsingService(); |
275 browser_process_->SetSafeBrowsingService(sb_service.get()); | 275 browser_process_->SetSafeBrowsingService(sb_service.get()); |
276 sb_service->Initialize(); | 276 sb_service->Initialize(); |
277 base::MessageLoop::current()->RunUntilIdle(); | 277 base::MessageLoop::current()->RunUntilIdle(); |
278 | 278 |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 EXPECT_EQ(removal_data.remove_mask, | 847 EXPECT_EQ(removal_data.remove_mask, |
848 StoragePartition::REMOVE_DATA_MASK_COOKIES); | 848 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
849 // Removing with time period other than EVERYTHING should not clear | 849 // Removing with time period other than EVERYTHING should not clear |
850 // persistent storage data. | 850 // persistent storage data. |
851 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 851 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
852 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); | 852 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
853 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | 853 EXPECT_TRUE(removal_data.remove_origin.is_empty()); |
854 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 854 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
855 } | 855 } |
856 | 856 |
857 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 857 #if defined(SAFE_BROWSING_SERVICE) |
858 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { | 858 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { |
859 RemoveSafeBrowsingCookieTester tester; | 859 RemoveSafeBrowsingCookieTester tester; |
860 | 860 |
861 tester.AddCookie(); | 861 tester.AddCookie(); |
862 ASSERT_TRUE(tester.ContainsCookie()); | 862 ASSERT_TRUE(tester.ContainsCookie()); |
863 | 863 |
864 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 864 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
865 BrowsingDataRemover::REMOVE_COOKIES, false); | 865 BrowsingDataRemover::REMOVE_COOKIES, false); |
866 | 866 |
867 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 867 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 EXPECT_EQ(1u, tester.clear_count()); | 1749 EXPECT_EQ(1u, tester.clear_count()); |
1750 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); | 1750 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
1751 } | 1751 } |
1752 | 1752 |
1753 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { | 1753 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { |
1754 BlockUntilBrowsingDataRemoved( | 1754 BlockUntilBrowsingDataRemoved( |
1755 BrowsingDataRemover::EVERYTHING, | 1755 BrowsingDataRemover::EVERYTHING, |
1756 BrowsingDataRemover::REMOVE_HISTORY | | 1756 BrowsingDataRemover::REMOVE_HISTORY | |
1757 BrowsingDataRemover::REMOVE_COOKIES, false); | 1757 BrowsingDataRemover::REMOVE_COOKIES, false); |
1758 } | 1758 } |
OLD | NEW |