Commit 2244b8e0 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Fix flaky test UserDataDowngradeTests.RemoveDataForProfile

This test was flaking due to being overly sensitive to the granularity
of base::Time::Now. This CL fixes it by using wider data ranges.

Bug: 1059863
Change-Id: I87030c66de38df1704b9488f8baf2ac994885786
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106415
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751667}
parent 1ae3e205
......@@ -139,11 +139,12 @@ TEST(UserDataDowngradeTests, RemoveDataForProfile) {
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,
// Nothing should be deleted from |profile_path_default| since delete_begin
// is after the snapshot has been created.
RemoveDataForProfile(base::Time::Max(), profile_path_default,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS);
RemoveDataForProfile(snapshot_info.creation_time, profile_path_1,
// Only the bookmarks should be deleted.
RemoveDataForProfile(base::Time::Min(), profile_path_1,
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_BOOKMARKS);
EXPECT_TRUE(base::PathExists(
snapshot_profile_path_default.Append(chrome::kPreferencesFilename)));
......@@ -171,8 +172,7 @@ TEST(UserDataDowngradeTests, RemoveDataForProfile) {
ChromeBrowsingDataRemoverDelegate::DATA_TYPE_FORM_DATA;
// Delete some data from default profile.
RemoveDataForProfile(snapshot_info.creation_time, profile_path_default,
remove_mask);
RemoveDataForProfile(base::Time::Min(), profile_path_default, remove_mask);
for (const auto& item : profile_items) {
EXPECT_EQ(
(item.data_types & remove_mask) == 0,
......
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