Chromium Code Reviews| 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) {} |
|
sky
2013/07/23 13:59:37
nit: member initialize history_service_ to NULL.
rmcilroy
2013/07/23 14:30:50
Done.
|
| + |
| + bool Initialize(TestingProfile* profile) WARN_UNUSED_RESULT { |
|
sky
2013/07/23 13:59:37
nit: we generally call this Init.
rmcilroy
2013/07/23 14:30:50
I had Init before, but have been hit by the "don't
sky
2013/07/23 14:36:09
Some times the style guide is at odds with itself:
|
| + 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); |