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

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

Issue 2010463002: Mocker for OSCrypt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated doc Created 4 years, 7 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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "components/bookmarks/test/bookmark_test_helpers.h" 51 #include "components/bookmarks/test/bookmark_test_helpers.h"
52 #include "components/content_settings/core/browser/host_content_settings_map.h" 52 #include "components/content_settings/core/browser/host_content_settings_map.h"
53 #include "components/content_settings/core/common/content_settings.h" 53 #include "components/content_settings/core/common/content_settings.h"
54 #include "components/content_settings/core/common/content_settings_pattern.h" 54 #include "components/content_settings/core/common/content_settings_pattern.h"
55 #include "components/domain_reliability/clear_mode.h" 55 #include "components/domain_reliability/clear_mode.h"
56 #include "components/domain_reliability/monitor.h" 56 #include "components/domain_reliability/monitor.h"
57 #include "components/domain_reliability/service.h" 57 #include "components/domain_reliability/service.h"
58 #include "components/favicon/core/favicon_service.h" 58 #include "components/favicon/core/favicon_service.h"
59 #include "components/history/core/browser/history_service.h" 59 #include "components/history/core/browser/history_service.h"
60 #include "components/omnibox/browser/omnibox_pref_names.h" 60 #include "components/omnibox/browser/omnibox_pref_names.h"
61 #include "components/os_crypt/os_crypt_mocker.h"
61 #include "components/password_manager/core/browser/mock_password_store.h" 62 #include "components/password_manager/core/browser/mock_password_store.h"
62 #include "components/password_manager/core/browser/password_manager_test_utils.h " 63 #include "components/password_manager/core/browser/password_manager_test_utils.h "
63 #include "components/password_manager/core/browser/password_store_consumer.h" 64 #include "components/password_manager/core/browser/password_store_consumer.h"
64 #include "components/prefs/testing_pref_service.h" 65 #include "components/prefs/testing_pref_service.h"
65 #include "content/public/browser/browser_context.h" 66 #include "content/public/browser/browser_context.h"
66 #include "content/public/browser/cookie_store_factory.h" 67 #include "content/public/browser/cookie_store_factory.h"
67 #include "content/public/browser/dom_storage_context.h" 68 #include "content/public/browser/dom_storage_context.h"
68 #include "content/public/browser/local_storage_usage_info.h" 69 #include "content/public/browser/local_storage_usage_info.h"
69 #include "content/public/browser/storage_partition.h" 70 #include "content/public/browser/storage_partition.h"
70 #include "content/public/test/mock_download_manager.h" 71 #include "content/public/test/mock_download_manager.h"
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 public: 675 public:
675 explicit RemoveAutofillTester(TestingProfile* profile) 676 explicit RemoveAutofillTester(TestingProfile* profile)
676 : personal_data_manager_( 677 : personal_data_manager_(
677 autofill::PersonalDataManagerFactory::GetForProfile(profile)) { 678 autofill::PersonalDataManagerFactory::GetForProfile(profile)) {
678 autofill::test::DisableSystemServices(profile->GetPrefs()); 679 autofill::test::DisableSystemServices(profile->GetPrefs());
679 personal_data_manager_->AddObserver(this); 680 personal_data_manager_->AddObserver(this);
680 } 681 }
681 682
682 ~RemoveAutofillTester() override { 683 ~RemoveAutofillTester() override {
683 personal_data_manager_->RemoveObserver(this); 684 personal_data_manager_->RemoveObserver(this);
685 autofill::test::ReenableSystemServices();
684 } 686 }
685 687
686 // Returns true if there are autofill profiles. 688 // Returns true if there are autofill profiles.
687 bool HasProfile() { 689 bool HasProfile() {
688 return !personal_data_manager_->GetProfiles().empty() && 690 return !personal_data_manager_->GetProfiles().empty() &&
689 !personal_data_manager_->GetCreditCards().empty(); 691 !personal_data_manager_->GetCreditCards().empty();
690 } 692 }
691 693
692 bool HasOrigin(const std::string& origin) { 694 bool HasOrigin(const std::string& origin) {
693 const std::vector<autofill::AutofillProfile*>& profiles = 695 const std::vector<autofill::AutofillProfile*>& profiles =
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( 973 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
972 testing_profile, 974 testing_profile,
973 password_manager::BuildPasswordStore< 975 password_manager::BuildPasswordStore<
974 content::BrowserContext, 976 content::BrowserContext,
975 testing::NiceMock<password_manager::MockPasswordStore>>); 977 testing::NiceMock<password_manager::MockPasswordStore>>);
976 978
977 store_ = static_cast<password_manager::MockPasswordStore*>( 979 store_ = static_cast<password_manager::MockPasswordStore*>(
978 PasswordStoreFactory::GetInstance() 980 PasswordStoreFactory::GetInstance()
979 ->GetForProfile(testing_profile, ServiceAccessType::EXPLICIT_ACCESS) 981 ->GetForProfile(testing_profile, ServiceAccessType::EXPLICIT_ACCESS)
980 .get()); 982 .get());
983
984 OSCryptMocker::SetUpWithSingleton();
981 } 985 }
982 986
987 ~RemovePasswordsTester() { OSCryptMocker::TearDown(); }
988
983 password_manager::MockPasswordStore* store() { return store_; } 989 password_manager::MockPasswordStore* store() { return store_; }
984 990
985 private: 991 private:
986 password_manager::MockPasswordStore* store_; 992 password_manager::MockPasswordStore* store_;
987 993
988 DISALLOW_COPY_AND_ASSIGN(RemovePasswordsTester); 994 DISALLOW_COPY_AND_ASSIGN(RemovePasswordsTester);
989 }; 995 };
990 996
991 // Test Class ---------------------------------------------------------------- 997 // Test Class ----------------------------------------------------------------
992 998
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( 2534 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate(
2529 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, 2535 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
2530 base::Bind(&MatchPrimaryPattern, http_pattern)); 2536 base::Bind(&MatchPrimaryPattern, http_pattern));
2531 // Verify we only have one, and it's url1. 2537 // Verify we only have one, and it's url1.
2532 host_content_settings_map->GetSettingsForOneType( 2538 host_content_settings_map->GetSettingsForOneType(
2533 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); 2539 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings);
2534 EXPECT_EQ(1u, host_settings.size()); 2540 EXPECT_EQ(1u, host_settings.size());
2535 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), 2541 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1),
2536 host_settings[0].primary_pattern); 2542 host_settings[0].primary_pattern);
2537 } 2543 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698