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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover_unittest.cc

Issue 19616004: Add asserts to TestingProfile::CreateHistoryService to ensure files are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add WARN_UNUSED_RESULT and assert_true in every caller. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_remover_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 03b176a28e020cbcc5173eaeb3b360bfd0595d07..a5cc61b4956988f052815b4d8b1fb8eb612212e8 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -335,11 +335,14 @@ class RemoveServerBoundCertTester : public net::SSLConfigService::Observer {
class RemoveHistoryTester {
public:
- explicit RemoveHistoryTester(TestingProfile* profile)
- : query_url_success_(false) {
- profile->CreateHistoryService(true, false);
+ RemoveHistoryTester() : query_url_success_(false) {}
+
+ bool Initialize(TestingProfile* profile) WARN_UNUSED_RESULT {
+ if (!profile->CreateHistoryService(true, false))
+ return false;
history_service_ = HistoryServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS);
+ return true;
}
// Returns true, if the given URL exists in the history service.
@@ -828,7 +831,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) {
}
TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) {
- RemoveHistoryTester tester(GetProfile());
+ RemoveHistoryTester tester;
+ ASSERT_TRUE(tester.Initialize(GetProfile()));
tester.AddHistory(kOrigin1, base::Time::Now());
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1));
@@ -842,7 +846,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) {
}
TEST_F(BrowsingDataRemoverTest, RemoveHistoryForLastHour) {
- RemoveHistoryTester tester(GetProfile());
+ RemoveHistoryTester tester;
+ ASSERT_TRUE(tester.Initialize(GetProfile()));
base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);
@@ -888,7 +893,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveHistoryProhibited) {
TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypes) {
// Add some history.
- RemoveHistoryTester history_tester(GetProfile());
+ RemoveHistoryTester history_tester;
+ ASSERT_TRUE(history_tester.Initialize(GetProfile()));
history_tester.AddHistory(kOrigin1, base::Time::Now());
ASSERT_TRUE(history_tester.HistoryContainsURL(kOrigin1));
@@ -1290,7 +1296,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) {
}
TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) {
- RemoveHistoryTester tester(GetProfile());
+ RemoveHistoryTester tester;
+ ASSERT_TRUE(tester.Initialize(GetProfile()));
base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);
@@ -1311,7 +1318,8 @@ TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) {
}
TEST_F(BrowsingDataRemoverTest, OriginAndTimeBasedHistoryRemoval) {
- RemoveHistoryTester tester(GetProfile());
+ RemoveHistoryTester tester;
+ ASSERT_TRUE(tester.Initialize(GetProfile()));
base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);

Powered by Google App Engine
This is Rietveld 408576698