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

Unified Diff: chrome/browser/extensions/api/browsing_data/browsing_data_test.cc

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Rebase over codereview.chromium.org/2815913005 Created 3 years, 8 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/extensions/api/browsing_data/browsing_data_test.cc
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
index e48434737d11601043090f63ebcd51491404695a..300f0a74c83e3ff50fc87f601047b9dfc56cb5d8 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -11,8 +11,7 @@
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
-#include "chrome/browser/browsing_data/browsing_data_remover.h"
-#include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
+
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
@@ -23,6 +22,7 @@
#include "components/browsing_data/core/browsing_data_utils.h"
#include "components/browsing_data/core/pref_names.h"
#include "components/prefs/pref_service.h"
+#include "content/public/browser/browsing_data_remover.h"
using extension_function_test_utils::RunFunctionAndReturnError;
using extension_function_test_utils::RunFunctionAndReturnSingleResult;
@@ -30,8 +30,8 @@ using extension_function_test_utils::RunFunctionAndReturnSingleResult;
namespace {
enum OriginTypeMask {
- UNPROTECTED_WEB = BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB,
- PROTECTED_WEB = BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB,
+ UNPROTECTED_WEB = content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB,
+ PROTECTED_WEB = content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB,
EXTENSION = ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_EXTENSION
};
@@ -62,7 +62,7 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
protected:
void SetUpOnMainThread() override {
remover_ =
- BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile());
+ content::BrowserContext::GetBrowsingDataRemover(browser()->profile());
}
int GetAsMask(const base::DictionaryValue* dict, std::string path,
@@ -156,10 +156,10 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
PrefService* prefs = browser()->profile()->GetPrefs();
prefs->SetBoolean(
browsing_data::prefs::kDeleteCache,
- !!(data_type_flags & BrowsingDataRemover::DATA_TYPE_CACHE));
+ !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_CACHE));
prefs->SetBoolean(
browsing_data::prefs::kDeleteCookies,
- !!(data_type_flags & BrowsingDataRemover::DATA_TYPE_COOKIES));
+ !!(data_type_flags & content::BrowsingDataRemover::DATA_TYPE_COOKIES));
prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory,
!!(data_type_flags &
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY));
@@ -167,9 +167,9 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
browsing_data::prefs::kDeleteFormData,
!!(data_type_flags &
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA));
- prefs->SetBoolean(
- browsing_data::prefs::kDeleteDownloadHistory,
- !!(data_type_flags & BrowsingDataRemover::DATA_TYPE_DOWNLOADS));
+ prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory,
+ !!(data_type_flags &
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS));
prefs->SetBoolean(
browsing_data::prefs::kDeleteHostedAppsData,
!!(data_type_flags & ChromeBrowsingDataRemoverDelegate::
@@ -207,35 +207,35 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove));
int removal_mask =
GetAsMask(data_to_remove, "appcache",
- BrowsingDataRemover::DATA_TYPE_APP_CACHE) |
+ content::BrowsingDataRemover::DATA_TYPE_APP_CACHE) |
GetAsMask(data_to_remove, "cache",
- BrowsingDataRemover::DATA_TYPE_CACHE) |
+ content::BrowsingDataRemover::DATA_TYPE_CACHE) |
GetAsMask(data_to_remove, "cookies",
- BrowsingDataRemover::DATA_TYPE_COOKIES) |
+ content::BrowsingDataRemover::DATA_TYPE_COOKIES) |
GetAsMask(data_to_remove, "downloads",
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS) |
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS) |
GetAsMask(data_to_remove, "fileSystems",
- BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS) |
+ content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS) |
GetAsMask(data_to_remove, "formData",
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA) |
GetAsMask(data_to_remove, "history",
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY) |
GetAsMask(data_to_remove, "indexedDB",
- BrowsingDataRemover::DATA_TYPE_INDEXED_DB) |
+ content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB) |
GetAsMask(data_to_remove, "localStorage",
- BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE) |
+ content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE) |
GetAsMask(data_to_remove, "pluginData",
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA) |
GetAsMask(data_to_remove, "passwords",
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS) |
GetAsMask(data_to_remove, "serviceWorkers",
- BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS) |
+ content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS) |
GetAsMask(data_to_remove, "cacheStorage",
- BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE) |
+ content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE) |
GetAsMask(data_to_remove, "webSQL",
- BrowsingDataRemover::DATA_TYPE_WEB_SQL) |
+ content::BrowsingDataRemover::DATA_TYPE_WEB_SQL) |
GetAsMask(data_to_remove, "serverBoundCertificates",
- BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
+ content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
EXPECT_EQ(expected_removal_mask, removal_mask);
}
@@ -260,7 +260,7 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
private:
// Cached pointer to BrowsingDataRemover for access to testing methods.
- BrowsingDataRemover* remover_;
+ content::BrowsingDataRemover* remover_;
};
} // namespace
@@ -305,8 +305,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemoveBrowsingDataAll) {
EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime());
EXPECT_EQ(
(ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA |
- BrowsingDataRemover::DATA_TYPE_CACHE |
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
+ content::BrowsingDataRemover::DATA_TYPE_CACHE |
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS) &
@@ -353,34 +353,36 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginTypeMask) {
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
BrowsingDataRemovalMask) {
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "appcache", BrowsingDataRemover::DATA_TYPE_APP_CACHE);
+ "appcache", content::BrowsingDataRemover::DATA_TYPE_APP_CACHE);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cache", BrowsingDataRemover::DATA_TYPE_CACHE);
+ "cache", content::BrowsingDataRemover::DATA_TYPE_CACHE);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cookies", BrowsingDataRemover::DATA_TYPE_COOKIES);
+ "cookies", content::BrowsingDataRemover::DATA_TYPE_COOKIES);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "downloads", BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
+ "downloads", content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "fileSystems", BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS);
+ "fileSystems", content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
"formData", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
"history", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "indexedDB", BrowsingDataRemover::DATA_TYPE_INDEXED_DB);
+ "indexedDB", content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "localStorage", BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE);
+ "localStorage", content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "serverBoundCertificates", BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
+ "serverBoundCertificates",
+ content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
"passwords", ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS);
// We can't remove plugin data inside a test profile.
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "serviceWorkers", BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS);
+ "serviceWorkers",
+ content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cacheStorage", BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE);
+ "cacheStorage", content::BrowsingDataRemover::DATA_TYPE_CACHE_STORAGE);
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "webSQL", BrowsingDataRemover::DATA_TYPE_WEB_SQL);
+ "webSQL", content::BrowsingDataRemover::DATA_TYPE_WEB_SQL);
}
// Test an arbitrary combination of data types.
@@ -388,8 +390,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
BrowsingDataRemovalMaskCombination) {
RunBrowsingDataRemoveFunctionAndCompareRemovalMask(
"{\"appcache\": true, \"cookies\": true, \"history\": true}",
- BrowsingDataRemover::DATA_TYPE_APP_CACHE |
- BrowsingDataRemover::DATA_TYPE_COOKIES |
+ content::BrowsingDataRemover::DATA_TYPE_APP_CACHE |
+ content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY);
}
@@ -405,8 +407,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
prefs->SetBoolean(browsing_data::prefs::kDeleteHostedAppsData, false);
prefs->SetBoolean(browsing_data::prefs::kDeletePasswords, false);
prefs->SetBoolean(prefs::kClearPluginLSODataEnabled, false);
- int expected_mask = BrowsingDataRemover::DATA_TYPE_CACHE |
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
+ int expected_mask = content::BrowsingDataRemover::DATA_TYPE_CACHE |
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY;
std::string json;
// Scoping for the traces.
@@ -440,31 +442,31 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) {
RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>(
- BrowsingDataRemover::DATA_TYPE_APP_CACHE);
+ content::BrowsingDataRemover::DATA_TYPE_APP_CACHE);
RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>(
- BrowsingDataRemover::DATA_TYPE_CACHE);
+ content::BrowsingDataRemover::DATA_TYPE_CACHE);
RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>(
- BrowsingDataRemover::DATA_TYPE_COOKIES |
- BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
+ content::BrowsingDataRemover::DATA_TYPE_COOKIES |
+ content::BrowsingDataRemover::DATA_TYPE_CHANNEL_IDS);
RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>(
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>(
- BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS);
+ content::BrowsingDataRemover::DATA_TYPE_FILE_SYSTEMS);
RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA);
RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY);
RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>(
- BrowsingDataRemover::DATA_TYPE_INDEXED_DB);
+ content::BrowsingDataRemover::DATA_TYPE_INDEXED_DB);
RunAndCompareRemovalMask<BrowsingDataRemoveLocalStorageFunction>(
- BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE);
+ content::BrowsingDataRemover::DATA_TYPE_LOCAL_STORAGE);
// We can't remove plugin data inside a test profile.
RunAndCompareRemovalMask<BrowsingDataRemovePasswordsFunction>(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS);
RunAndCompareRemovalMask<BrowsingDataRemoveServiceWorkersFunction>(
- BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS);
+ content::BrowsingDataRemover::DATA_TYPE_SERVICE_WORKERS);
RunAndCompareRemovalMask<BrowsingDataRemoveWebSQLFunction>(
- BrowsingDataRemover::DATA_TYPE_WEB_SQL);
+ content::BrowsingDataRemover::DATA_TYPE_WEB_SQL);
}
// Test the processing of the 'delete since' preference.
@@ -482,16 +484,17 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionEmpty) {
// Test straightforward settings, mapped 1:1 to data types.
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSimple) {
- SetPrefsAndVerifySettings(BrowsingDataRemover::DATA_TYPE_CACHE, 0,
- BrowsingDataRemover::DATA_TYPE_CACHE);
+ SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_CACHE, 0,
+ content::BrowsingDataRemover::DATA_TYPE_CACHE);
SetPrefsAndVerifySettings(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 0,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY);
SetPrefsAndVerifySettings(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA, 0,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA);
- SetPrefsAndVerifySettings(BrowsingDataRemover::DATA_TYPE_DOWNLOADS, 0,
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
+ SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS,
+ 0,
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
SetPrefsAndVerifySettings(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS, 0,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS);
@@ -508,19 +511,19 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSiteData) {
site_data_no_durable_or_usage_or_external &
~ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA;
- SetPrefsAndVerifySettings(BrowsingDataRemover::DATA_TYPE_COOKIES,
+ SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES,
UNPROTECTED_WEB,
site_data_no_plugins_durable_usage_external);
SetPrefsAndVerifySettings(
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY,
PROTECTED_WEB, site_data_no_plugins_durable_usage_external);
- SetPrefsAndVerifySettings(BrowsingDataRemover::DATA_TYPE_COOKIES |
+ SetPrefsAndVerifySettings(content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::
DATA_TYPE_HOSTED_APP_DATA_TEST_ONLY,
PROTECTED_WEB | UNPROTECTED_WEB,
site_data_no_plugins_durable_usage_external);
SetPrefsAndVerifySettings(
- BrowsingDataRemover::DATA_TYPE_COOKIES |
+ content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA,
UNPROTECTED_WEB, site_data_no_durable_or_usage_or_external);
}
@@ -535,11 +538,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionAssorted) {
~ChromeBrowsingDataRemoverDelegate::DATA_TYPE_EXTERNAL_PROTOCOL_DATA;
SetPrefsAndVerifySettings(
- BrowsingDataRemover::DATA_TYPE_COOKIES |
+ content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY |
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS,
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS,
UNPROTECTED_WEB,
site_data_no_plugins_durable_usage_external |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY |
- BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
+ content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS);
}
« no previous file with comments | « chrome/browser/extensions/api/browsing_data/browsing_data_api.cc ('k') | chrome/browser/net/errorpage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698