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

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

Issue 2697123004: Convert RemoveDataMask from enum to pointers and split it between content and embedder (Closed)
Patch Set: More compilation error fixes. Created 3 years, 10 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 7cbdbbb51e4c6622129ee93575b62772a8e2bebc..c0c92809d1f47d11785a894a944202852e4f77e0 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -13,6 +13,7 @@
#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_types.h"
#include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/profiles/profile.h"
@@ -25,6 +26,7 @@
using extension_function_test_utils::RunFunctionAndReturnError;
using extension_function_test_utils::RunFunctionAndReturnSingleResult;
+using content::BrowsingDataType;
namespace {
@@ -44,13 +46,18 @@ const char kRemoveEverythingArguments[] =
"\"webSQL\": true"
"}]";
+inline bool MaskContains(const std::set<const BrowsingDataType*>& remove_mask,
+ const BrowsingDataType* data_type) {
+ return remove_mask.find(data_type) != remove_mask.end();
+}
+
class ExtensionBrowsingDataTest : public InProcessBrowserTest {
public:
const base::Time& GetBeginTime() {
return remover_->GetLastUsedBeginTime();
}
- int GetRemovalMask() {
+ const std::set<const BrowsingDataType*>& GetRemovalMask() {
return remover_->GetLastUsedRemovalMask();
}
@@ -71,9 +78,17 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
return result ? mask_value : 0;
}
+ const BrowsingDataType* GetAsMask(
+ const base::DictionaryValue* dict, std::string path,
+ const BrowsingDataType* mask_value) {
+ bool result;
+ EXPECT_TRUE(dict->GetBoolean(path, &result)) << "for " << path;
+ return result ? mask_value : nullptr;
+ }
+
void RunBrowsingDataRemoveFunctionAndCompareRemovalMask(
const std::string& data_types,
- int expected_mask) {
+ const std::set<const BrowsingDataType*>& expected_mask) {
scoped_refptr<BrowsingDataRemoveFunction> function =
new BrowsingDataRemoveFunction();
SCOPED_TRACE(data_types);
@@ -87,7 +102,7 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
void RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
const std::string& key,
- int expected_mask) {
+ const std::set<const BrowsingDataType*>& expected_mask) {
RunBrowsingDataRemoveFunctionAndCompareRemovalMask(
std::string("{\"") + key + "\": true}", expected_mask);
}
@@ -106,7 +121,8 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
}
template<class ShortcutFunction>
- void RunAndCompareRemovalMask(int expected_mask) {
+ void RunAndCompareRemovalMask(
+ const std::set<const BrowsingDataType*>& expected_mask) {
scoped_refptr<ShortcutFunction> function =
new ShortcutFunction();
SCOPED_TRACE(ShortcutFunction::function_name());
@@ -148,27 +164,27 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
EXPECT_LE(expected_since, since + 10.0 * 1000.0);
}
- void SetPrefsAndVerifySettings(int data_type_flags,
- int expected_origin_type_mask,
- int expected_removal_mask) {
+ void SetPrefsAndVerifySettings(
+ const std::set<const BrowsingDataType*>& data_type_flags,
+ int expected_origin_type_mask,
+ const std::set<const BrowsingDataType*>& expected_removal_mask) {
PrefService* prefs = browser()->profile()->GetPrefs();
prefs->SetBoolean(browsing_data::prefs::kDeleteCache,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_CACHE));
+ MaskContains(data_type_flags, &kBrowsingDataTypeCache));
prefs->SetBoolean(browsing_data::prefs::kDeleteCookies,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_COOKIES));
+ MaskContains(data_type_flags, &kBrowsingDataTypeCookies));
prefs->SetBoolean(browsing_data::prefs::kDeleteBrowsingHistory,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_HISTORY));
+ MaskContains(data_type_flags, &kBrowsingDataTypeHistory));
prefs->SetBoolean(browsing_data::prefs::kDeleteFormData,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_FORM_DATA));
+ MaskContains(data_type_flags, &kBrowsingDataTypeFormData));
prefs->SetBoolean(browsing_data::prefs::kDeleteDownloadHistory,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_DOWNLOADS));
+ MaskContains(data_type_flags, &kBrowsingDataTypeDownloads));
prefs->SetBoolean(browsing_data::prefs::kDeleteHostedAppsData,
- !!(data_type_flags &
- BrowsingDataRemover::REMOVE_HOSTED_APP_DATA_TESTONLY));
+ MaskContains(data_type_flags, &kBrowsingDataTypeHostedAppDataTestOnly));
prefs->SetBoolean(browsing_data::prefs::kDeletePasswords,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_PASSWORDS));
+ MaskContains(data_type_flags, &kBrowsingDataTypePasswords));
prefs->SetBoolean(prefs::kClearPluginLSODataEnabled,
- !!(data_type_flags & BrowsingDataRemover::REMOVE_PLUGIN_DATA));
+ MaskContains(data_type_flags, &kBrowsingDataTypePluginData));
scoped_refptr<BrowsingDataSettingsFunction> function =
new BrowsingDataSettingsFunction();
@@ -192,36 +208,48 @@ class ExtensionBrowsingDataTest : public InProcessBrowserTest {
base::DictionaryValue* data_to_remove;
EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove));
- int removal_mask =
- GetAsMask(data_to_remove, "appcache",
- BrowsingDataRemover::REMOVE_APPCACHE) |
- GetAsMask(data_to_remove, "cache", BrowsingDataRemover::REMOVE_CACHE) |
- GetAsMask(data_to_remove, "cookies",
- BrowsingDataRemover::REMOVE_COOKIES) |
+ std::set<const BrowsingDataType*> removal_mask;
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "appcache", &kBrowsingDataTypeAppCache));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "cache", &kBrowsingDataTypeCache));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "cookies", &kBrowsingDataTypeCookies));
+ removal_mask.insert(
GetAsMask(data_to_remove, "downloads",
- BrowsingDataRemover::REMOVE_DOWNLOADS) |
+ &kBrowsingDataTypeDownloads));
+ removal_mask.insert(
GetAsMask(data_to_remove, "fileSystems",
- BrowsingDataRemover::REMOVE_FILE_SYSTEMS) |
- GetAsMask(data_to_remove, "formData",
- BrowsingDataRemover::REMOVE_FORM_DATA) |
- GetAsMask(data_to_remove, "history",
- BrowsingDataRemover::REMOVE_HISTORY) |
- GetAsMask(data_to_remove, "indexedDB",
- BrowsingDataRemover::REMOVE_INDEXEDDB) |
+ &kBrowsingDataTypeFileSystems));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "formData", &kBrowsingDataTypeFormData));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "history", &kBrowsingDataTypeHistory));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "indexedDB", &kBrowsingDataTypeIndexedDB));
+ removal_mask.insert(
GetAsMask(data_to_remove, "localStorage",
- BrowsingDataRemover::REMOVE_LOCAL_STORAGE) |
+ &kBrowsingDataTypeLocalStorage));
+ removal_mask.insert(
GetAsMask(data_to_remove, "pluginData",
- BrowsingDataRemover::REMOVE_PLUGIN_DATA) |
- GetAsMask(data_to_remove, "passwords",
- BrowsingDataRemover::REMOVE_PASSWORDS) |
+ &kBrowsingDataTypePluginData));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "passwords", &kBrowsingDataTypePasswords));
+ removal_mask.insert(
GetAsMask(data_to_remove, "serviceWorkers",
- BrowsingDataRemover::REMOVE_SERVICE_WORKERS) |
+ &kBrowsingDataTypeServiceWorkers));
+ removal_mask.insert(
GetAsMask(data_to_remove, "cacheStorage",
- BrowsingDataRemover::REMOVE_CACHE_STORAGE) |
- GetAsMask(data_to_remove, "webSQL",
- BrowsingDataRemover::REMOVE_WEBSQL) |
+ &kBrowsingDataTypeCacheStorage));
+ removal_mask.insert(
+ GetAsMask(data_to_remove, "webSQL", &kBrowsingDataTypeWebSQL));
+ removal_mask.insert(
GetAsMask(data_to_remove, "serverBoundCertificates",
- BrowsingDataRemover::REMOVE_CHANNEL_IDS);
+ &kBrowsingDataTypeChannelIDs));
+
+ // GetAsMask() adds a nullptr for excluded types.
+ removal_mask.erase(nullptr);
+
EXPECT_EQ(expected_removal_mask, removal_mask);
}
@@ -288,21 +316,23 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemoveBrowsingDataAll) {
browser()));
EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime());
- EXPECT_EQ((BrowsingDataRemover::REMOVE_SITE_DATA |
- BrowsingDataRemover::REMOVE_CACHE |
- BrowsingDataRemover::REMOVE_DOWNLOADS |
- BrowsingDataRemover::REMOVE_FORM_DATA |
- BrowsingDataRemover::REMOVE_HISTORY |
- BrowsingDataRemover::REMOVE_PASSWORDS) &
- // TODO(benwells): implement clearing of site usage data via the
- // browsing data API. https://crbug.com/500801.
- ~BrowsingDataRemover::REMOVE_SITE_USAGE_DATA &
- // TODO(dmurph): implement clearing of durable storage permission
- // via the browsing data API. https://crbug.com/500801.
- ~BrowsingDataRemover::REMOVE_DURABLE_PERMISSION &
- // We can't remove plugin data inside a test profile.
- ~BrowsingDataRemover::REMOVE_PLUGIN_DATA,
- GetRemovalMask());
+ std::set<const BrowsingDataType*> expected_mask =
+ kBrowsingDataTypeSetSiteData;
+ expected_mask.insert(&kBrowsingDataTypeCache);
+ expected_mask.insert(&kBrowsingDataTypeDownloads);
+ expected_mask.insert(&kBrowsingDataTypeFormData);
+ expected_mask.insert(&kBrowsingDataTypeHistory);
+ expected_mask.insert(&kBrowsingDataTypePasswords);
+ // TODO(benwells): implement clearing of site usage data via the
+ // browsing data API. https://crbug.com/500801.
+ expected_mask.erase(&kBrowsingDataTypeSiteUsageData);
+ // TODO(dmurph): implement clearing of durable storage permission
+ // via the browsing data API. https://crbug.com/500801.
+ expected_mask.erase(&kBrowsingDataTypeDurablePermission);
+ // We can't remove plugin data inside a test profile.
+ expected_mask.erase(&kBrowsingDataTypePluginData);
+
+ EXPECT_EQ(expected_mask, GetRemovalMask());
}
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginTypeMask) {
@@ -334,35 +364,34 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginTypeMask) {
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
BrowsingDataRemovalMask) {
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "appcache", BrowsingDataRemover::REMOVE_APPCACHE);
+ "appcache", {&kBrowsingDataTypeAppCache});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cache", BrowsingDataRemover::REMOVE_CACHE);
+ "cache", {&kBrowsingDataTypeCache});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cookies", BrowsingDataRemover::REMOVE_COOKIES);
+ "cookies", {&kBrowsingDataTypeCookies});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "downloads", BrowsingDataRemover::REMOVE_DOWNLOADS);
+ "downloads", {&kBrowsingDataTypeDownloads});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "fileSystems", BrowsingDataRemover::REMOVE_FILE_SYSTEMS);
+ "fileSystems", {&kBrowsingDataTypeFileSystems});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "formData", BrowsingDataRemover::REMOVE_FORM_DATA);
+ "formData", {&kBrowsingDataTypeFormData});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "history", BrowsingDataRemover::REMOVE_HISTORY);
+ "history", {&kBrowsingDataTypeHistory});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB);
+ "indexedDB", {&kBrowsingDataTypeIndexedDB});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "localStorage", BrowsingDataRemover::REMOVE_LOCAL_STORAGE);
+ "localStorage", {&kBrowsingDataTypeLocalStorage});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "serverBoundCertificates",
- BrowsingDataRemover::REMOVE_CHANNEL_IDS);
+ "serverBoundCertificates", {&kBrowsingDataTypeChannelIDs});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "passwords", BrowsingDataRemover::REMOVE_PASSWORDS);
+ "passwords", {&kBrowsingDataTypePasswords});
// We can't remove plugin data inside a test profile.
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "serviceWorkers", BrowsingDataRemover::REMOVE_SERVICE_WORKERS);
+ "serviceWorkers", {&kBrowsingDataTypeServiceWorkers});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "cacheStorage", BrowsingDataRemover::REMOVE_CACHE_STORAGE);
+ "cacheStorage", {&kBrowsingDataTypeCacheStorage});
RunBrowsingDataRemoveWithKeyAndCompareRemovalMask(
- "webSQL", BrowsingDataRemover::REMOVE_WEBSQL);
+ "webSQL", {&kBrowsingDataTypeWebSQL});
}
// Test an arbitrary combination of data types.
@@ -370,9 +399,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
BrowsingDataRemovalMaskCombination) {
RunBrowsingDataRemoveFunctionAndCompareRemovalMask(
"{\"appcache\": true, \"cookies\": true, \"history\": true}",
- BrowsingDataRemover::REMOVE_APPCACHE |
- BrowsingDataRemover::REMOVE_COOKIES |
- BrowsingDataRemover::REMOVE_HISTORY);
+ {&kBrowsingDataTypeAppCache,
+ &kBrowsingDataTypeCookies,
+ &kBrowsingDataTypeHistory});
}
// Make sure the remove() function accepts the format produced by settings().
@@ -387,9 +416,11 @@ 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::REMOVE_CACHE |
- BrowsingDataRemover::REMOVE_DOWNLOADS |
- BrowsingDataRemover::REMOVE_HISTORY;
+ const std::set<const BrowsingDataType*>& expected_mask = {
+ &kBrowsingDataTypeCache,
+ &kBrowsingDataTypeDownloads,
+ &kBrowsingDataTypeHistory
+ };
std::string json;
// Scoping for the traces.
{
@@ -422,31 +453,30 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest,
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) {
RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>(
- BrowsingDataRemover::REMOVE_APPCACHE);
+ {&kBrowsingDataTypeAppCache});
RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>(
- BrowsingDataRemover::REMOVE_CACHE);
+ {&kBrowsingDataTypeCache});
RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>(
- BrowsingDataRemover::REMOVE_COOKIES |
- BrowsingDataRemover::REMOVE_CHANNEL_IDS);
+ {&kBrowsingDataTypeCookies, &kBrowsingDataTypeChannelIDs});
RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>(
- BrowsingDataRemover::REMOVE_DOWNLOADS);
+ {&kBrowsingDataTypeDownloads});
RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>(
- BrowsingDataRemover::REMOVE_FILE_SYSTEMS);
+ {&kBrowsingDataTypeFileSystems});
RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>(
- BrowsingDataRemover::REMOVE_FORM_DATA);
+ {&kBrowsingDataTypeFormData});
RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>(
- BrowsingDataRemover::REMOVE_HISTORY);
+ {&kBrowsingDataTypeHistory});
RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>(
- BrowsingDataRemover::REMOVE_INDEXEDDB);
+ {&kBrowsingDataTypeIndexedDB});
RunAndCompareRemovalMask<BrowsingDataRemoveLocalStorageFunction>(
- BrowsingDataRemover::REMOVE_LOCAL_STORAGE);
+ {&kBrowsingDataTypeLocalStorage});
// We can't remove plugin data inside a test profile.
RunAndCompareRemovalMask<BrowsingDataRemovePasswordsFunction>(
- BrowsingDataRemover::REMOVE_PASSWORDS);
+ {&kBrowsingDataTypePasswords});
RunAndCompareRemovalMask<BrowsingDataRemoveServiceWorkersFunction>(
- BrowsingDataRemover::REMOVE_SERVICE_WORKERS);
+ {&kBrowsingDataTypeServiceWorkers});
RunAndCompareRemovalMask<BrowsingDataRemoveWebSQLFunction>(
- BrowsingDataRemover::REMOVE_WEBSQL);
+ {&kBrowsingDataTypeWebSQL});
}
// Test the processing of the 'delete since' preference.
@@ -459,65 +489,64 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSince) {
}
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionEmpty) {
- SetPrefsAndVerifySettings(0, 0, 0);
+ std::set<const BrowsingDataType*> empty_mask;
+ SetPrefsAndVerifySettings(empty_mask, 0, empty_mask);
}
// Test straightforward settings, mapped 1:1 to data types.
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSimple) {
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_CACHE, 0,
- BrowsingDataRemover::REMOVE_CACHE);
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_HISTORY, 0,
- BrowsingDataRemover::REMOVE_HISTORY);
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_FORM_DATA, 0,
- BrowsingDataRemover::REMOVE_FORM_DATA);
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_DOWNLOADS, 0,
- BrowsingDataRemover::REMOVE_DOWNLOADS);
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_PASSWORDS, 0,
- BrowsingDataRemover::REMOVE_PASSWORDS);
+ SetPrefsAndVerifySettings({&kBrowsingDataTypeCache}, 0,
+ {&kBrowsingDataTypeCache});
+ SetPrefsAndVerifySettings({&kBrowsingDataTypeHistory}, 0,
+ {&kBrowsingDataTypeHistory});
+ SetPrefsAndVerifySettings({&kBrowsingDataTypeFormData}, 0,
+ {&kBrowsingDataTypeFormData});
+ SetPrefsAndVerifySettings({&kBrowsingDataTypeDownloads}, 0,
+ {&kBrowsingDataTypeDownloads});
+ SetPrefsAndVerifySettings({&kBrowsingDataTypePasswords}, 0,
+ {&kBrowsingDataTypePasswords});
}
// Test cookie and app data settings.
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSiteData) {
- int site_data_no_durable_or_usage =
- BrowsingDataRemover::REMOVE_SITE_DATA &
- ~BrowsingDataRemover::REMOVE_SITE_USAGE_DATA &
- ~BrowsingDataRemover::REMOVE_DURABLE_PERMISSION;
- int site_data_no_plugins_durable_usage =
- site_data_no_durable_or_usage & ~BrowsingDataRemover::REMOVE_PLUGIN_DATA;
-
- SetPrefsAndVerifySettings(BrowsingDataRemover::REMOVE_COOKIES,
- UNPROTECTED_WEB,
+ std::set<const BrowsingDataType*> site_data_no_durable_or_usage =
+ kBrowsingDataTypeSetSiteData;
+ site_data_no_durable_or_usage.erase(&kBrowsingDataTypeSiteUsageData);
+ site_data_no_durable_or_usage.erase(&kBrowsingDataTypeDurablePermission);
+ std::set<const BrowsingDataType*> site_data_no_plugins_durable_usage =
+ site_data_no_durable_or_usage;
+ site_data_no_plugins_durable_usage.erase(&kBrowsingDataTypePluginData);
+
+ SetPrefsAndVerifySettings({&kBrowsingDataTypeCookies}, UNPROTECTED_WEB,
site_data_no_plugins_durable_usage);
SetPrefsAndVerifySettings(
- BrowsingDataRemover::REMOVE_HOSTED_APP_DATA_TESTONLY,
- PROTECTED_WEB,
+ {&kBrowsingDataTypeHostedAppDataTestOnly}, PROTECTED_WEB,
site_data_no_plugins_durable_usage);
SetPrefsAndVerifySettings(
- BrowsingDataRemover::REMOVE_COOKIES |
- BrowsingDataRemover::REMOVE_HOSTED_APP_DATA_TESTONLY,
- PROTECTED_WEB | UNPROTECTED_WEB,
- site_data_no_plugins_durable_usage);
+ {&kBrowsingDataTypeCookies, &kBrowsingDataTypeHostedAppDataTestOnly},
+ PROTECTED_WEB | UNPROTECTED_WEB, site_data_no_plugins_durable_usage);
SetPrefsAndVerifySettings(
- BrowsingDataRemover::REMOVE_COOKIES |
- BrowsingDataRemover::REMOVE_PLUGIN_DATA,
- UNPROTECTED_WEB,
- site_data_no_durable_or_usage);
+ {&kBrowsingDataTypeCookies, &kBrowsingDataTypePluginData},
+ UNPROTECTED_WEB, site_data_no_durable_or_usage);
}
// Test an arbitrary assortment of settings.
IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionAssorted) {
- int site_data_no_plugins_durable_usage =
- BrowsingDataRemover::REMOVE_SITE_DATA &
- ~BrowsingDataRemover::REMOVE_DURABLE_PERMISSION &
- ~BrowsingDataRemover::REMOVE_SITE_USAGE_DATA &
- ~BrowsingDataRemover::REMOVE_PLUGIN_DATA;
+ std::set<const BrowsingDataType*> site_data_no_plugins_durable_usage =
+ kBrowsingDataTypeSetSiteData;
+ site_data_no_plugins_durable_usage.erase(&kBrowsingDataTypeDurablePermission);
+ site_data_no_plugins_durable_usage.erase(&kBrowsingDataTypeSiteUsageData);
+ site_data_no_plugins_durable_usage.erase(&kBrowsingDataTypePluginData);
+
+ std::set<const BrowsingDataType*> expected_mask =
+ site_data_no_plugins_durable_usage;
+ expected_mask.insert(&kBrowsingDataTypeHistory);
+ expected_mask.insert(&kBrowsingDataTypeDownloads);
SetPrefsAndVerifySettings(
- BrowsingDataRemover::REMOVE_COOKIES |
- BrowsingDataRemover::REMOVE_HISTORY |
- BrowsingDataRemover::REMOVE_DOWNLOADS,
+ {&kBrowsingDataTypeCookies,
+ &kBrowsingDataTypeHistory,
+ &kBrowsingDataTypeDownloads},
UNPROTECTED_WEB,
- site_data_no_plugins_durable_usage |
- BrowsingDataRemover::REMOVE_HISTORY |
- BrowsingDataRemover::REMOVE_DOWNLOADS);
+ expected_mask);
}

Powered by Google App Engine
This is Rietveld 408576698