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

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: 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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 #if BUILDFLAG(ANDROID_JAVA_UI) 1004 #if BUILDFLAG(ANDROID_JAVA_UI)
1004 BrowsingDataRemover* remover = 1005 BrowsingDataRemover* remover =
1005 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); 1006 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get());
1006 remover->OverrideWebappRegistryForTesting( 1007 remover->OverrideWebappRegistryForTesting(
1007 std::unique_ptr<WebappRegistry>(new TestWebappRegistry())); 1008 std::unique_ptr<WebappRegistry>(new TestWebappRegistry()));
1008 #endif 1009 #endif
1009 } 1010 }
1010 1011
1011 ~BrowsingDataRemoverTest() override {} 1012 ~BrowsingDataRemoverTest() override {}
1012 1013
1014 void SetUp() override { OSCryptMocker::SetUpWithSingleton(); }
msramek 2016/05/24 13:40:57 Drive by! Wouldn't it suffice to call this in Remo
cfroussios 2016/05/25 13:13:09 Done (assuming below meant above)
1015
1013 void TearDown() override { 1016 void TearDown() override {
1014 #if defined(ENABLE_EXTENSIONS) 1017 #if defined(ENABLE_EXTENSIONS)
1015 mock_policy_ = nullptr; 1018 mock_policy_ = nullptr;
1016 #endif 1019 #endif
1017 1020
1021 OSCryptMocker::TearDown();
1022
1018 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor 1023 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor
1019 // posts a message to the WEBKIT thread to delete some of its member 1024 // posts a message to the WEBKIT thread to delete some of its member
1020 // variables. We need to ensure that the profile is destroyed, and that 1025 // variables. We need to ensure that the profile is destroyed, and that
1021 // the message loop is cleared out, before destroying the threads and loop. 1026 // the message loop is cleared out, before destroying the threads and loop.
1022 // Otherwise we leak memory. 1027 // Otherwise we leak memory.
1023 profile_.reset(); 1028 profile_.reset();
1024 base::MessageLoop::current()->RunUntilIdle(); 1029 base::MessageLoop::current()->RunUntilIdle();
1025 1030
1026 TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); 1031 TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr);
1027 } 1032 }
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( 2533 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate(
2529 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, 2534 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
2530 base::Bind(&MatchPrimaryPattern, http_pattern)); 2535 base::Bind(&MatchPrimaryPattern, http_pattern));
2531 // Verify we only have one, and it's url1. 2536 // Verify we only have one, and it's url1.
2532 host_content_settings_map->GetSettingsForOneType( 2537 host_content_settings_map->GetSettingsForOneType(
2533 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); 2538 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings);
2534 EXPECT_EQ(1u, host_settings.size()); 2539 EXPECT_EQ(1u, host_settings.size());
2535 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), 2540 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1),
2536 host_settings[0].primary_pattern); 2541 host_settings[0].primary_pattern);
2537 } 2542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698