Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc

Issue 2664253006: Clears out external protocol data when cookies and site data is cleared. (Closed)
Patch Set: a Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/chrome_browsing_data_remover_delegate.h" 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 BlockUntilBrowsingDataRemoved(AnHourAgo(), base::Time::Max(), 1049 BlockUntilBrowsingDataRemoved(AnHourAgo(), base::Time::Max(),
1050 removal_mask, false); 1050 removal_mask, false);
1051 EXPECT_EQ(removal_mask, GetRemovalMask()); 1051 EXPECT_EQ(removal_mask, GetRemovalMask());
1052 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); 1052 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask());
1053 1053
1054 // Verify that history was not deleted. 1054 // Verify that history was not deleted.
1055 EXPECT_TRUE(history_tester.HistoryContainsURL(kOrigin1)); 1055 EXPECT_TRUE(history_tester.HistoryContainsURL(kOrigin1));
1056 } 1056 }
1057 #endif 1057 #endif
1058 1058
1059 TEST_F(ChromeBrowsingDataRemoverDelegateTest, RemoveExternalProtocolData) {
1060 TestingProfile* profile = GetProfile();
1061 // Add external protocol data on profile.
1062 base::DictionaryValue prefs;
1063 prefs.SetBoolean("tel", true);
1064 profile->GetPrefs()->Set(prefs::kExcludedSchemes, prefs);
1065
1066 EXPECT_FALSE(
1067 profile->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
1068
1069 BlockUntilBrowsingDataRemoved(
1070 AnHourAgo(), base::Time::Max(),
1071 BrowsingDataRemover::REMOVE_EXTERNAL_PROTOCOL_DATA, false);
1072 EXPECT_TRUE(
1073 profile->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
1074 }
1075
1059 // Test that clearing history deletes favicons not associated with bookmarks. 1076 // Test that clearing history deletes favicons not associated with bookmarks.
1060 TEST_F(ChromeBrowsingDataRemoverDelegateTest, RemoveFaviconsForever) { 1077 TEST_F(ChromeBrowsingDataRemoverDelegateTest, RemoveFaviconsForever) {
1061 GURL page_url("http://a"); 1078 GURL page_url("http://a");
1062 1079
1063 RemoveFaviconTester favicon_tester; 1080 RemoveFaviconTester favicon_tester;
1064 ASSERT_TRUE(favicon_tester.Init(GetProfile())); 1081 ASSERT_TRUE(favicon_tester.Init(GetProfile()));
1065 favicon_tester.VisitAndAddFavicon(page_url); 1082 favicon_tester.VisitAndAddFavicon(page_url);
1066 ASSERT_TRUE(favicon_tester.HasFaviconForPageURL(page_url)); 1083 ASSERT_TRUE(favicon_tester.HasFaviconForPageURL(page_url));
1067 1084
1068 BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), 1085 BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(),
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 EXPECT_THAT(language_model->GetLanguageFrequency("es"), FloatEq(0.25)); 1785 EXPECT_THAT(language_model->GetLanguageFrequency("es"), FloatEq(0.25));
1769 1786
1770 // Clearing the full history does the trick. 1787 // Clearing the full history does the trick.
1771 BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), 1788 BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(),
1772 BrowsingDataRemover::REMOVE_HISTORY, false); 1789 BrowsingDataRemover::REMOVE_HISTORY, false);
1773 1790
1774 EXPECT_THAT(language_model->GetTopLanguages(), SizeIs(0)); 1791 EXPECT_THAT(language_model->GetTopLanguages(), SizeIs(0));
1775 EXPECT_THAT(language_model->GetLanguageFrequency("en"), FloatEq(0.0)); 1792 EXPECT_THAT(language_model->GetLanguageFrequency("en"), FloatEq(0.0));
1776 EXPECT_THAT(language_model->GetLanguageFrequency("es"), FloatEq(0.0)); 1793 EXPECT_THAT(language_model->GetLanguageFrequency("es"), FloatEq(0.0));
1777 } 1794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698