Commit b910c2fc authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Clean up tests to revoke system external mount points

I noticed these when I was having some failures in
FileManagerPathUtilTest.  These were not actually causing any issues,
but it is still better to revoke any registered system mount points at
the end of tests.

Change-Id: Ic58ff6c560de35a4839d58483d5f1d0dde13152d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2237434
Commit-Queue: François Degros <fdegros@chromium.org>
Reviewed-by: default avatarFrançois Degros <fdegros@chromium.org>
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776823}
parent 0d5d8643
...@@ -146,9 +146,7 @@ class CrostiniExportImportTest : public testing::Test { ...@@ -146,9 +146,7 @@ class CrostiniExportImportTest : public testing::Test {
profile()->GetPrefs()->SetBoolean( profile()->GetPrefs()->SetBoolean(
crostini::prefs::kUserCrostiniExportImportUIAllowedByPolicy, true); crostini::prefs::kUserCrostiniExportImportUIAllowedByPolicy, true);
storage::ExternalMountPoints* mount_points = storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
storage::ExternalMountPoints::GetSystemInstance();
mount_points->RegisterFileSystem(
file_manager::util::GetDownloadsMountPointName(profile()), file_manager::util::GetDownloadsMountPointName(profile()),
storage::kFileSystemTypeNativeLocal, storage::FileSystemMountOption(), storage::kFileSystemTypeNativeLocal, storage::FileSystemMountOption(),
file_manager::util::GetMyFilesFolderForProfile(profile())); file_manager::util::GetMyFilesFolderForProfile(profile()));
...@@ -157,6 +155,8 @@ class CrostiniExportImportTest : public testing::Test { ...@@ -157,6 +155,8 @@ class CrostiniExportImportTest : public testing::Test {
} }
void TearDown() override { void TearDown() override {
storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
file_manager::util::GetDownloadsMountPointName(profile()));
crostini_export_import_.reset(); crostini_export_import_.reset();
// If the file has been created (by an export), then delete it, but first // If the file has been created (by an export), then delete it, but first
// shutdown GuestOsSharePath to ensure watchers are destroyed, otherwise // shutdown GuestOsSharePath to ensure watchers are destroyed, otherwise
......
...@@ -215,6 +215,8 @@ class CrostiniPackageServiceTest : public testing::Test { ...@@ -215,6 +215,8 @@ class CrostiniPackageServiceTest : public testing::Test {
void TearDown() override { void TearDown() override {
// Complete all CrostiniManager queued tasks before deleting it. // Complete all CrostiniManager queued tasks before deleting it.
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
file_manager::util::GetDownloadsMountPointName(profile_.get()));
service_.reset(); service_.reset();
notification_display_service_tester_.reset(); notification_display_service_tester_.reset();
crostini_test_helper_.reset(); crostini_test_helper_.reset();
......
...@@ -46,19 +46,22 @@ class RecentDiskSourceTest : public testing::Test { ...@@ -46,19 +46,22 @@ class RecentDiskSourceTest : public testing::Test {
mount_point_name_ = mount_point_name_ =
file_manager::util::GetDownloadsMountPointName(profile_.get()); file_manager::util::GetDownloadsMountPointName(profile_.get());
storage::ExternalMountPoints* mount_points =
storage::ExternalMountPoints::GetSystemInstance();
mount_points->RevokeFileSystem(mount_point_name_); ASSERT_TRUE(
ASSERT_TRUE(mount_points->RegisterFileSystem( storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
mount_point_name_, storage::kFileSystemTypeTest, mount_point_name_, storage::kFileSystemTypeTest,
storage::FileSystemMountOption(), base::FilePath())); storage::FileSystemMountOption(), base::FilePath()));
source_ = std::make_unique<RecentDiskSource>( source_ = std::make_unique<RecentDiskSource>(
mount_point_name_, false /* ignore_dotfiles */, 0 /* max_depth */, mount_point_name_, false /* ignore_dotfiles */, 0 /* max_depth */,
uma_histogram_name_); uma_histogram_name_);
} }
void TearDown() override {
storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
mount_point_name_);
}
protected: protected:
bool CreateEmptyFile(const std::string& filename, const base::Time& time) { bool CreateEmptyFile(const std::string& filename, const base::Time& time) {
base::File file(temp_dir_.GetPath().Append(filename), base::File file(temp_dir_.GetPath().Append(filename),
......
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