OLD | NEW |
---|---|
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/memory/ptr_util.h" | |
8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "base/test/scoped_feature_list.h" | 12 #include "base/test/scoped_feature_list.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 14 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
16 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 18 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 | 724 |
724 base::Time AnHourAgo() { | 725 base::Time AnHourAgo() { |
725 return base::Time::Now() - base::TimeDelta::FromHours(1); | 726 return base::Time::Now() - base::TimeDelta::FromHours(1); |
726 } | 727 } |
727 | 728 |
728 class RemoveDownloadsTester { | 729 class RemoveDownloadsTester { |
729 public: | 730 public: |
730 explicit RemoveDownloadsTester(TestingProfile* testing_profile) | 731 explicit RemoveDownloadsTester(TestingProfile* testing_profile) |
731 : download_manager_(new content::MockDownloadManager()), | 732 : download_manager_(new content::MockDownloadManager()), |
732 chrome_download_manager_delegate_(testing_profile) { | 733 chrome_download_manager_delegate_(testing_profile) { |
733 content::BrowserContext::SetDownloadManagerForTesting(testing_profile, | 734 content::BrowserContext::SetDownloadManagerForTesting( |
734 download_manager_); | 735 testing_profile, base::WrapUnique(download_manager_)); |
Nico
2017/04/14 15:46:58
Same here.
Avi (use Gerrit)
2017/04/14 18:17:51
Done.
| |
735 EXPECT_EQ(download_manager_, | 736 EXPECT_EQ(download_manager_, |
736 content::BrowserContext::GetDownloadManager(testing_profile)); | 737 content::BrowserContext::GetDownloadManager(testing_profile)); |
737 | 738 |
738 EXPECT_CALL(*download_manager_, GetDelegate()) | 739 EXPECT_CALL(*download_manager_, GetDelegate()) |
739 .WillOnce(Return(&chrome_download_manager_delegate_)); | 740 .WillOnce(Return(&chrome_download_manager_delegate_)); |
740 EXPECT_CALL(*download_manager_, Shutdown()); | 741 EXPECT_CALL(*download_manager_, Shutdown()); |
741 } | 742 } |
742 | 743 |
743 ~RemoveDownloadsTester() { chrome_download_manager_delegate_.Shutdown(); } | 744 ~RemoveDownloadsTester() { chrome_download_manager_delegate_.Shutdown(); } |
744 | 745 |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1988 EXPECT_FALSE(Match(kOrigin1, kProtected, nullptr)); | 1989 EXPECT_FALSE(Match(kOrigin1, kProtected, nullptr)); |
1989 EXPECT_FALSE(Match(kOriginExt, kProtected, nullptr)); | 1990 EXPECT_FALSE(Match(kOriginExt, kProtected, nullptr)); |
1990 EXPECT_FALSE(Match(kOriginDevTools, kProtected, nullptr)); | 1991 EXPECT_FALSE(Match(kOriginDevTools, kProtected, nullptr)); |
1991 | 1992 |
1992 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1993 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1993 EXPECT_FALSE(Match(kOrigin1, kExtension, nullptr)); | 1994 EXPECT_FALSE(Match(kOrigin1, kExtension, nullptr)); |
1994 EXPECT_TRUE(Match(kOriginExt, kExtension, nullptr)); | 1995 EXPECT_TRUE(Match(kOriginExt, kExtension, nullptr)); |
1995 EXPECT_FALSE(Match(kOriginDevTools, kExtension, nullptr)); | 1996 EXPECT_FALSE(Match(kOriginDevTools, kExtension, nullptr)); |
1996 #endif | 1997 #endif |
1997 } | 1998 } |
OLD | NEW |