Commit 77cd9e48 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

User data snapshot: Delete snapshot when user deletes browsing data

When the user deletes browsing data, snapshot files are deleted if they
are in relation to the deleted data. Prefs are deleted if one of the
deleted data also affects the prefs. Snapshotted data created before the
start of the time range where browsing data is deleted will not be
affected.

Bug: 1052788
Change-Id: I560a844183905a58cdab2c2266869dd91c5b0f63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066564
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748254}
parent ae7007aa
......@@ -39,6 +39,7 @@
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/domain_reliability/service_factory.h"
#include "chrome/browser/downgrade/user_data_downgrade.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/heavy_ad_intervention/heavy_ad_blocklist.h"
......@@ -1183,6 +1184,21 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
// Remove external protocol data.
if (remove_mask & DATA_TYPE_EXTERNAL_PROTOCOL_DATA)
ExternalProtocolHandler::ClearData(profile_);
#if BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING)
//////////////////////////////////////////////////////////////////////////////
// Remove data for this profile contained in any snapshots.
if (remove_mask &&
filter_builder->GetMode() == BrowsingDataFilterBuilder::BLACKLIST) {
base::PostTaskAndReply(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE,
base::MayBlock()},
base::BindOnce(&downgrade::RemoveDataForProfile, delete_begin_,
profile_->GetPath(), remove_mask),
CreateTaskCompletionClosure(TracingDataType::kUserDataSnapshot));
}
#endif // BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING)
}
void ChromeBrowsingDataRemoverDelegate::OnTaskStarted(
......
......@@ -228,7 +228,8 @@ class ChromeBrowsingDataRemoverDelegate
kLeakedCredentials = 32, // deprecated
kFieldInfo = 33,
kCompromisedCredentials = 34,
kMaxValue = kCompromisedCredentials,
kUserDataSnapshot = 35,
kMaxValue = kUserDataSnapshot,
};
// Called by CreateTaskCompletionClosure().
......
......@@ -7,6 +7,7 @@
#include <utility>
#include "build/build_config.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/common/chrome_constants.h"
#include "components/autofill/core/browser/payments/strike_database.h"
......@@ -15,6 +16,7 @@
#include "components/password_manager/core/browser/password_manager_constants.h"
#include "components/sessions/core/session_constants.h"
#include "components/webdata/common/webdata_constants.h"
#include "content/public/browser/browsing_data_remover.h"
#if defined(OS_WIN)
#include "chrome/browser/profiles/profile_shortcut_manager_win.h"
......@@ -24,74 +26,106 @@
namespace downgrade {
SnapshotItemDetails::SnapshotItemDetails(base::FilePath path,
ItemType item_type)
: path(std::move(path)), is_directory(item_type == ItemType::kDirectory) {}
ItemType item_type,
int data_types)
: path(std::move(path)),
is_directory(item_type == ItemType::kDirectory),
data_types(data_types) {}
// Returns a list of items to snapshot that should be directly under the user
// data directory.
std::vector<SnapshotItemDetails> CollectUserDataItems(uint16_t version) {
std::vector<SnapshotItemDetails> CollectUserDataItems() {
std::vector<SnapshotItemDetails> user_data_items{
SnapshotItemDetails(base::FilePath(chrome::kLocalStateFilename),
SnapshotItemDetails::ItemType::kDirectory),
SnapshotItemDetails::ItemType::kFile, 0),
SnapshotItemDetails(base::FilePath(profiles::kHighResAvatarFolderName),
SnapshotItemDetails::ItemType::kDirectory)};
SnapshotItemDetails::ItemType::kDirectory, 0)};
#if defined(OS_WIN)
user_data_items.emplace_back(
SnapshotItemDetails(base::FilePath(web_app::kLastBrowserFile),
SnapshotItemDetails::ItemType::kFile));
user_data_items.emplace_back(base::FilePath(web_app::kLastBrowserFile),
SnapshotItemDetails::ItemType::kFile, 0);
#endif // defined(OS_WIN)
return user_data_items;
}
// Returns a list of items to snapshot that should be under a profile directory.
std::vector<SnapshotItemDetails> CollectProfileItems(uint16_t version) {
std::vector<SnapshotItemDetails> CollectProfileItems() {
// Data mask to delete the pref files if any of the following types is
// deleted. When cookies are deleted, the kZeroSuggestCachedResults pref has
// to be reset. When history and isolated origins are deleted, the
// kPrefLastLaunchTime and kUserTriggeredIsolatedOrigins prefs have to be
// reset. When data type content is deleted, blacklisted sites are deleted
// from the translation prefs.
int pref_data_type =
content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_ISOLATED_ORIGINS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CONTENT_SETTINGS;
std::vector<SnapshotItemDetails> profile_items{
// General Profile files
SnapshotItemDetails(base::FilePath(chrome::kPreferencesFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile, pref_data_type),
SnapshotItemDetails(base::FilePath(chrome::kSecurePreferencesFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile, pref_data_type),
// History files
SnapshotItemDetails(base::FilePath(history::kHistoryFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY),
SnapshotItemDetails(base::FilePath(history::kFaviconsFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY),
SnapshotItemDetails(base::FilePath(history::kTopSitesFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY),
// Bookmarks
SnapshotItemDetails(base::FilePath(bookmarks::kBookmarksFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails(
base::FilePath(bookmarks::kBookmarksFileName),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS),
// Tab Restore and sessions
SnapshotItemDetails(base::FilePath(sessions::kCurrentTabSessionFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY),
SnapshotItemDetails(base::FilePath(sessions::kCurrentSessionFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY),
// Sign-in state
SnapshotItemDetails(base::FilePath(profiles::kGAIAPictureFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile, 0),
// Password / Autofill
SnapshotItemDetails(
base::FilePath(password_manager::kAffiliationDatabaseFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA),
SnapshotItemDetails(
base::FilePath(password_manager::kLoginDataForProfileFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA),
SnapshotItemDetails(
base::FilePath(password_manager::kLoginDataForAccountFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails(base::FilePath(kWebDataFilename),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails(base::FilePath(autofill::kStrikeDatabaseFileName),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA),
SnapshotItemDetails(
base::FilePath(kWebDataFilename),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA),
SnapshotItemDetails(
base::FilePath(autofill::kStrikeDatabaseFileName),
SnapshotItemDetails::ItemType::kFile,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA),
// Cookies
SnapshotItemDetails(base::FilePath(chrome::kCookieFilename),
SnapshotItemDetails::ItemType::kFile)};
SnapshotItemDetails::ItemType::kFile,
content::BrowsingDataRemover::DATA_TYPE_COOKIES)};
#if defined(OS_WIN)
// Sign-in state
profile_items.emplace_back(
SnapshotItemDetails(base::FilePath(profiles::kProfileIconFileName),
SnapshotItemDetails::ItemType::kFile));
profile_items.emplace_back(base::FilePath(profiles::kProfileIconFileName),
SnapshotItemDetails::ItemType::kFile, 0);
#endif // defined(OS_WIN)
return profile_items;
}
......
......@@ -14,18 +14,22 @@ namespace downgrade {
struct SnapshotItemDetails {
enum class ItemType { kFile, kDirectory };
SnapshotItemDetails(base::FilePath path, ItemType type);
SnapshotItemDetails(base::FilePath path, ItemType type, int data_types);
~SnapshotItemDetails() = default;
const base::FilePath path;
const bool is_directory;
// Bitfield from ChromeBrowsingDataRemoverDelegate::DataType representing
// the data types affected by this item.
int data_types;
};
// Returns a list of items to snapshot that should be directly under the user
// data directory.
std::vector<SnapshotItemDetails> CollectUserDataItems(uint16_t version);
std::vector<SnapshotItemDetails> CollectUserDataItems();
// Returns a list of items to snapshot that should be under a profile directory.
std::vector<SnapshotItemDetails> CollectProfileItems(uint16_t version);
std::vector<SnapshotItemDetails> CollectProfileItems();
} // namespace downgrade
......
......@@ -13,6 +13,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/downgrade/downgrade_utils.h"
#include "chrome/browser/downgrade/snapshot_file_collector.h"
#include "chrome/browser/downgrade/user_data_downgrade.h"
......@@ -154,16 +155,15 @@ void SnapshotManager::TakeSnapshot(const base::Version& version) {
SnapshotOperationResult::kFailedToCreateSnapshotDirectory);
return;
}
const uint16_t milestone = version.components()[0];
// Copy items to be preserved at the top-level of User Data.
for (const auto& file : GetUserSnapshotItemDetails(milestone)) {
for (const auto& file : GetUserSnapshotItemDetails()) {
record_success_error(
CopyItemToSnapshotDirectory(base::FilePath(file.path), user_data_dir_,
snapshot_dir, file.is_directory));
}
auto profile_snapshot_item_details = GetProfileSnapshotItemDetails(milestone);
const auto profile_snapshot_item_details = GetProfileSnapshotItemDetails();
// Copy items to be preserved in each Profile directory.
for (const auto& profile_dir : GetUserProfileDirectories(user_data_dir_)) {
......@@ -324,14 +324,64 @@ void SnapshotManager::PurgeInvalidAndOldSnapshots(
}
}
std::vector<SnapshotItemDetails> SnapshotManager::GetProfileSnapshotItemDetails(
uint16_t milestone) const {
return CollectProfileItems(milestone);
void SnapshotManager::DeleteSnapshotDataForProfile(
base::Time delete_begin,
const base::FilePath& profile_base_name,
int remove_mask) {
using DataType = ChromeBrowsingDataRemoverDelegate;
bool delete_all =
(((remove_mask & DataType::WIPE_PROFILE) == DataType::WIPE_PROFILE) ||
((remove_mask & DataType::ALL_DATA_TYPES) ==
DataType::ALL_DATA_TYPES)) &&
delete_begin.is_null();
std::vector<base::FilePath> files_to_delete;
if (!delete_all) {
for (const auto& item : CollectProfileItems()) {
if (item.data_types & remove_mask)
files_to_delete.push_back(item.path);
}
}
if (!delete_all && files_to_delete.empty())
return;
const auto snapshot_dir = user_data_dir_.Append(kSnapshotsDir);
auto available_snapshots = GetAvailableSnapshots(snapshot_dir);
base::File::Info file_info;
for (const auto& snapshot : available_snapshots) {
auto snapshot_path = snapshot_dir.AppendASCII(snapshot.GetString());
// If we are not able to get the file info, it probably has been deleted.
if (!base::GetFileInfo(snapshot_path, &file_info))
continue;
auto profile_absolute_path = snapshot_path.Append(profile_base_name);
// Deletes the whole profile from the snapshots if it is being wiped
// regardless of |delete_begin|, otherwise deletes the required files from
// the snapshot if it was created after |delete_begin|.
if (delete_all) {
base::DeleteFile(profile_absolute_path, /*recursive=*/true);
} else if (delete_begin <= file_info.creation_time &&
base::PathExists(profile_absolute_path)) {
for (const auto& filename : files_to_delete) {
base::DeleteFile(profile_absolute_path.Append(filename),
/*recursive=*/true);
}
// Non recursive deletion will fail if the directory is not empty. In this
// case we only want to delete the directory if it is empty.
base::DeleteFile(profile_absolute_path, /*recursive=*/false);
}
}
}
std::vector<SnapshotItemDetails>
SnapshotManager::GetProfileSnapshotItemDetails() const {
return CollectProfileItems();
}
std::vector<SnapshotItemDetails> SnapshotManager::GetUserSnapshotItemDetails(
uint16_t milestone) const {
return CollectUserDataItems(milestone);
std::vector<SnapshotItemDetails> SnapshotManager::GetUserSnapshotItemDetails()
const {
return CollectUserDataItems();
}
} // namespace downgrade
......@@ -9,6 +9,7 @@
#include <vector>
#include "base/files/file_path.h"
#include "base/time/time.h"
#include "base/version.h"
namespace downgrade {
......@@ -44,11 +45,17 @@ class SnapshotManager {
// by moving invalid and older snapshots for later deletion.
void PurgeInvalidAndOldSnapshots(int max_number_of_snapshots) const;
// Deletes snapshot data created after |delete_begin| for |profile_base_name|.
// |remove_mask| (of bits from ChromeBrowsingDataRemoverDelegate::DataType)
// indicates the types of data to be cleared from the profile's snapshots.
void DeleteSnapshotDataForProfile(base::Time delete_begin,
const base::FilePath& profile_base_name,
int remove_mask);
private:
virtual std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails(
uint16_t milestone) const;
virtual std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails(
uint16_t milestone) const;
virtual std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails() const;
virtual std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails()
const;
const base::FilePath user_data_dir_;
};
......
......@@ -108,21 +108,20 @@ class TestSnapshotManager : public SnapshotManager {
~TestSnapshotManager() = default;
private:
std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails(
uint16_t milestone) const override {
std::vector<SnapshotItemDetails> GetUserSnapshotItemDetails() const override {
return std::vector<SnapshotItemDetails>{
SnapshotItemDetails(base::FilePath(kUserDataFile),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile, 0),
SnapshotItemDetails(base::FilePath(kUserDataFolder),
SnapshotItemDetails::ItemType::kDirectory)};
SnapshotItemDetails::ItemType::kDirectory, 0)};
}
std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails(
uint16_t milestone) const override {
std::vector<SnapshotItemDetails> GetProfileSnapshotItemDetails()
const override {
return std::vector<SnapshotItemDetails>{
SnapshotItemDetails(base::FilePath(kProfileDataFile),
SnapshotItemDetails::ItemType::kFile),
SnapshotItemDetails::ItemType::kFile, 0),
SnapshotItemDetails(base::FilePath(kProfileDataFolder),
SnapshotItemDetails::ItemType::kDirectory)};
SnapshotItemDetails::ItemType::kDirectory, 0)};
}
};
......
......@@ -14,6 +14,7 @@
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/downgrade/snapshot_manager.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
......@@ -34,6 +35,12 @@ base::Version GetVersionFromFileName(const base::FilePath& path) {
#endif // OS_WIN
}
bool IsValidSnapshotDirectory(const base::FilePath& path) {
base::Version snapshot_version = GetVersionFromFileName(path);
return snapshot_version.IsValid() &&
base::PathExists(path.Append(kDowngradeLastVersionFile));
}
} // namespace
const base::FilePath::StringPieceType kDowngradeLastVersionFile(
......@@ -95,11 +102,8 @@ std::vector<base::FilePath> GetInvalidSnapshots(
base::FileEnumerator::DIRECTORIES);
for (base::FilePath path = enumerator.Next(); !path.empty();
path = enumerator.Next()) {
base::Version snapshot_version = GetVersionFromFileName(path);
if (!snapshot_version.IsValid() ||
!base::PathExists(path.Append(kDowngradeLastVersionFile))) {
if (!IsValidSnapshotDirectory(path))
result.push_back(std::move(path));
}
}
return result;
}
......@@ -116,4 +120,12 @@ base::Optional<base::Version> GetSnapshotToRestore(
return base::nullopt;
}
void RemoveDataForProfile(base::Time delete_begin,
const base::FilePath& profile_path,
int remove_mask) {
SnapshotManager snapshot_manager(profile_path.DirName());
snapshot_manager.DeleteSnapshotDataForProfile(
delete_begin, profile_path.BaseName(), remove_mask);
}
} // namespace downgrade
......@@ -8,8 +8,13 @@
#include "base/containers/flat_set.h"
#include "base/files/file_path.h"
#include "base/optional.h"
#include "base/time/time.h"
#include "base/version.h"
namespace base {
class Time;
}
namespace downgrade {
// The suffix of pending deleted directory.
......@@ -50,6 +55,13 @@ base::Optional<base::Version> GetSnapshotToRestore(
const base::Version& version,
const base::FilePath& user_data_dir);
// Removes snapshot data created after |delete_begin| for |profile_path|.
// |remove_mask| (of bits from ChromeBrowsingDataRemoverDelegate::DataType)
// indicates the types of data to be cleared from the profile's snapshots.
void RemoveDataForProfile(base::Time delete_begin,
const base::FilePath& profile_path,
int remove_mask);
} // namespace downgrade
#endif // CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
......@@ -10,6 +10,10 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/optional.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/downgrade/snapshot_file_collector.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/browser/browsing_data_remover.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace downgrade {
......@@ -93,4 +97,91 @@ TEST(UserDataDowngradeTests, GetSnapshotToRestore) {
base::Version("30.0.0"));
}
TEST(UserDataDowngradeTests, RemoveDataForProfile) {
base::ScopedTempDir user_data_dir;
ASSERT_TRUE(user_data_dir.CreateUniqueTempDir());
const base::FilePath snapshot_dir =
user_data_dir.GetPath().Append(kSnapshotsDir);
const auto profile_path_default =
user_data_dir.GetPath().AppendASCII("Default");
const auto profile_path_1 = user_data_dir.GetPath().AppendASCII("Profile 1");
const auto snapshot_profile_path_default =
snapshot_dir.AppendASCII("1").AppendASCII("Default");
const auto snapshot_profile_path_1 =
snapshot_dir.AppendASCII("1").AppendASCII("Profile 1");
ASSERT_TRUE(base::CreateDirectory(profile_path_default));
ASSERT_TRUE(base::CreateDirectory(profile_path_1));
ASSERT_TRUE(base::CreateDirectory(snapshot_profile_path_default));
ASSERT_TRUE(base::CreateDirectory(snapshot_profile_path_1));
base::File(profile_path_default.Append(kDowngradeLastVersionFile),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
base::File(profile_path_1.Append(kDowngradeLastVersionFile),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
base::File(snapshot_dir.AppendASCII("1").Append(kDowngradeLastVersionFile),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
const auto profile_items = CollectProfileItems();
DCHECK(!profile_items.empty());
for (const auto& item : profile_items) {
if (item.is_directory) {
ASSERT_TRUE(base::CreateDirectory(
snapshot_profile_path_default.Append(item.path)));
ASSERT_TRUE(
base::CreateDirectory(snapshot_profile_path_1.Append(item.path)));
} else {
base::File(snapshot_profile_path_default.Append(item.path),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
base::File(snapshot_profile_path_1.Append(item.path),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
}
}
base::File::Info snapshot_info;
ASSERT_TRUE(base::GetFileInfo(snapshot_dir, &snapshot_info));
// Test that data is deleted only if it was created after the deletion time
// range start.
RemoveDataForProfile(base::Time::Now(), profile_path_default,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS);
RemoveDataForProfile(snapshot_info.creation_time, profile_path_1,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS);
EXPECT_TRUE(base::PathExists(
snapshot_profile_path_default.Append(chrome::kPreferencesFilename)));
EXPECT_TRUE(base::PathExists(
snapshot_profile_path_1.Append(chrome::kPreferencesFilename)));
EXPECT_TRUE(base::PathExists(snapshot_profile_path_default.Append(
chrome::kSecurePreferencesFilename)));
EXPECT_TRUE(base::PathExists(
snapshot_profile_path_1.Append(chrome::kSecurePreferencesFilename)));
for (const auto& item : profile_items) {
EXPECT_TRUE(
base::PathExists(snapshot_profile_path_default.Append(item.path)));
EXPECT_EQ((item.data_types &
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS) == 0,
base::PathExists(snapshot_profile_path_1.Append(item.path)));
}
const auto remove_mask =
content::BrowsingDataRemover::DATA_TYPE_COOKIES |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_ISOLATED_ORIGINS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CONTENT_SETTINGS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PASSWORDS |
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA;
// Delete some data from default profile.
RemoveDataForProfile(snapshot_info.creation_time, profile_path_default,
remove_mask);
for (const auto& item : profile_items) {
EXPECT_EQ(
(item.data_types & remove_mask) == 0,
base::PathExists(snapshot_profile_path_default.Append(item.path)));
}
// Wipe profile 1
RemoveDataForProfile(base::Time(), profile_path_1,
ChromeBrowsingDataRemoverDelegate::WIPE_PROFILE);
EXPECT_FALSE(base::PathExists(snapshot_profile_path_1));
}
} // namespace downgrade
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment