| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 EXPECT_EQ(removal_data.remove_mask, | 848 EXPECT_EQ(removal_data.remove_mask, |
| 849 StoragePartition::REMOVE_DATA_MASK_COOKIES); | 849 StoragePartition::REMOVE_DATA_MASK_COOKIES); |
| 850 // Removing with time period other than EVERYTHING should not clear | 850 // Removing with time period other than EVERYTHING should not clear |
| 851 // persistent storage data. | 851 // persistent storage data. |
| 852 EXPECT_EQ(removal_data.quota_storage_remove_mask, | 852 EXPECT_EQ(removal_data.quota_storage_remove_mask, |
| 853 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); | 853 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
| 854 EXPECT_TRUE(removal_data.remove_origin.is_empty()); | 854 EXPECT_TRUE(removal_data.remove_origin.is_empty()); |
| 855 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); | 855 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); |
| 856 } | 856 } |
| 857 | 857 |
| 858 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 858 #if defined(SAFE_BROWSING_SERVICE) |
| 859 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { | 859 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { |
| 860 RemoveSafeBrowsingCookieTester tester; | 860 RemoveSafeBrowsingCookieTester tester; |
| 861 | 861 |
| 862 tester.AddCookie(); | 862 tester.AddCookie(); |
| 863 ASSERT_TRUE(tester.ContainsCookie()); | 863 ASSERT_TRUE(tester.ContainsCookie()); |
| 864 | 864 |
| 865 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 865 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
| 866 BrowsingDataRemover::REMOVE_COOKIES, false); | 866 BrowsingDataRemover::REMOVE_COOKIES, false); |
| 867 | 867 |
| 868 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); | 868 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 EXPECT_EQ(1u, tester.clear_count()); | 1750 EXPECT_EQ(1u, tester.clear_count()); |
| 1751 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); | 1751 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
| 1752 } | 1752 } |
| 1753 | 1753 |
| 1754 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { | 1754 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { |
| 1755 BlockUntilBrowsingDataRemoved( | 1755 BlockUntilBrowsingDataRemoved( |
| 1756 BrowsingDataRemover::EVERYTHING, | 1756 BrowsingDataRemover::EVERYTHING, |
| 1757 BrowsingDataRemover::REMOVE_HISTORY | | 1757 BrowsingDataRemover::REMOVE_HISTORY | |
| 1758 BrowsingDataRemover::REMOVE_COOKIES, false); | 1758 BrowsingDataRemover::REMOVE_COOKIES, false); |
| 1759 } | 1759 } |
| OLD | NEW |