Commit 25bbfce2 authored by Austin Tankiang's avatar Austin Tankiang Committed by Commit Bot

Clean up crostini code using legacy drive sync client

DriveFS is going to be used regardless of its feature flag, and the
legacy drive sync client will be deleted, so clean up code that relies
on the legacy drive sync client.

Bug: 1002339
Change-Id: I2bf7f3d587ab856f493802a27a7f6f8333551f94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1800139Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Austin Tankiang <austinct@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697071}
parent e2c021f5
...@@ -1128,13 +1128,11 @@ void CrostiniManager::StartLxdContainer(std::string vm_name, ...@@ -1128,13 +1128,11 @@ void CrostiniManager::StartLxdContainer(std::string vm_name,
request.set_container_name(std::move(container_name)); request.set_container_name(std::move(container_name));
request.set_owner_id(owner_id_); request.set_owner_id(owner_id_);
request.set_async(true); request.set_async(true);
if (base::FeatureList::IsEnabled(chromeos::features::kDriveFs)) {
if (auto* integration_service = if (auto* integration_service =
drive::DriveIntegrationServiceFactory::GetForProfile(profile_)) { drive::DriveIntegrationServiceFactory::GetForProfile(profile_)) {
request.set_drivefs_mount_path( request.set_drivefs_mount_path(
integration_service->GetMountPointPath().value()); integration_service->GetMountPointPath().value());
} }
}
GetCiceroneClient()->StartLxdContainer( GetCiceroneClient()->StartLxdContainer(
std::move(request), std::move(request),
base::BindOnce(&CrostiniManager::OnStartLxdContainer, base::BindOnce(&CrostiniManager::OnStartLxdContainer,
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h" #include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chromeos/components/drivefs/mojom/drivefs.mojom.h" #include "chromeos/components/drivefs/mojom/drivefs.mojom.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/dbus/concierge/service.pb.h" #include "chromeos/dbus/concierge/service.pb.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/seneschal_client.h" #include "chromeos/dbus/seneschal_client.h"
...@@ -211,11 +210,8 @@ void GuestOsSharePath::CallSeneschalSharePath(const std::string& vm_name, ...@@ -211,11 +210,8 @@ void GuestOsSharePath::CallSeneschalSharePath(const std::string& vm_name,
vm_tools::seneschal::SharePathRequest request; vm_tools::seneschal::SharePathRequest request;
base::FilePath drivefs_path; base::FilePath drivefs_path;
base::FilePath relative_path; base::FilePath relative_path;
drive::DriveIntegrationService* integration_service = nullptr; drive::DriveIntegrationService* integration_service =
if (base::FeatureList::IsEnabled(chromeos::features::kDriveFs)) {
integration_service =
drive::DriveIntegrationServiceFactory::GetForProfile(profile_); drive::DriveIntegrationServiceFactory::GetForProfile(profile_);
}
base::FilePath drivefs_mount_point_path; base::FilePath drivefs_mount_point_path;
base::FilePath drivefs_mount_name; base::FilePath drivefs_mount_name;
...@@ -230,8 +226,7 @@ void GuestOsSharePath::CallSeneschalSharePath(const std::string& vm_name, ...@@ -230,8 +226,7 @@ void GuestOsSharePath::CallSeneschalSharePath(const std::string& vm_name,
request.set_storage_location( request.set_storage_location(
vm_tools::seneschal::SharePathRequest::MY_FILES); vm_tools::seneschal::SharePathRequest::MY_FILES);
request.set_owner_id(crostini::CryptohomeIdForProfile(profile_)); request.set_owner_id(crostini::CryptohomeIdForProfile(profile_));
} else if (base::FeatureList::IsEnabled(chromeos::features::kDriveFs) && } else if (integration_service &&
integration_service &&
(drivefs_mount_point_path = (drivefs_mount_point_path =
integration_service->GetMountPointPath()) integration_service->GetMountPointPath())
.AppendRelativePath(path, &drivefs_path) && .AppendRelativePath(path, &drivefs_path) &&
......
...@@ -347,7 +347,6 @@ TEST_F(GuestOsSharePathTest, SuccessPluginVm) { ...@@ -347,7 +347,6 @@ TEST_F(GuestOsSharePathTest, SuccessPluginVm) {
} }
TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDrive) { TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDrive) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("root").Append("my"), PERSIST_NO, "vm-running", drivefs_.Append("root").Append("my"), PERSIST_NO,
...@@ -359,20 +358,7 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDrive) { ...@@ -359,20 +358,7 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDrive) {
run_loop()->Run(); run_loop()->Run();
} }
TEST_F(GuestOsSharePathTest, FailureDriveFsDisabled) {
features_.InitWithFeatures({}, {chromeos::features::kDriveFs});
SetUpVolume();
guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("root").Append("my"), PERSIST_NO,
base::BindOnce(&GuestOsSharePathTest::SharePathCallback,
base::Unretained(this), "vm-running", Persist::NO,
SeneschalClientCalled::NO, nullptr, "my", Success::NO,
"Path is not allowed"));
run_loop()->Run();
}
TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDriveRoot) { TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDriveRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("root"), PERSIST_NO, "vm-running", drivefs_.Append("root"), PERSIST_NO,
...@@ -385,7 +371,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDriveRoot) { ...@@ -385,7 +371,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsMyDriveRoot) {
} }
TEST_F(GuestOsSharePathTest, FailDriveFsRoot) { TEST_F(GuestOsSharePathTest, FailDriveFsRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_, PERSIST_NO, "vm-running", drivefs_, PERSIST_NO,
...@@ -397,7 +382,6 @@ TEST_F(GuestOsSharePathTest, FailDriveFsRoot) { ...@@ -397,7 +382,6 @@ TEST_F(GuestOsSharePathTest, FailDriveFsRoot) {
} }
TEST_F(GuestOsSharePathTest, SuccessDriveFsTeamDrives) { TEST_F(GuestOsSharePathTest, SuccessDriveFsTeamDrives) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("team_drives").Append("team"), PERSIST_NO, "vm-running", drivefs_.Append("team_drives").Append("team"), PERSIST_NO,
...@@ -411,7 +395,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsTeamDrives) { ...@@ -411,7 +395,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsTeamDrives) {
// TODO(crbug.com/917920): Enable when DriveFS enforces allowed write paths. // TODO(crbug.com/917920): Enable when DriveFS enforces allowed write paths.
TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputersGrandRoot) { TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputersGrandRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("Computers"), PERSIST_NO, "vm-running", drivefs_.Append("Computers"), PERSIST_NO,
...@@ -425,7 +408,6 @@ TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputersGrandRoot) { ...@@ -425,7 +408,6 @@ TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputersGrandRoot) {
// TODO(crbug.com/917920): Remove when DriveFS enforces allowed write paths. // TODO(crbug.com/917920): Remove when DriveFS enforces allowed write paths.
TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputersGrandRoot) { TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputersGrandRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("Computers"), PERSIST_NO, "vm-running", drivefs_.Append("Computers"), PERSIST_NO,
...@@ -438,7 +420,6 @@ TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputersGrandRoot) { ...@@ -438,7 +420,6 @@ TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputersGrandRoot) {
// TODO(crbug.com/917920): Enable when DriveFS enforces allowed write paths. // TODO(crbug.com/917920): Enable when DriveFS enforces allowed write paths.
TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputerRoot) { TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputerRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("Computers").Append("pc"), PERSIST_NO, "vm-running", drivefs_.Append("Computers").Append("pc"), PERSIST_NO,
...@@ -452,7 +433,6 @@ TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputerRoot) { ...@@ -452,7 +433,6 @@ TEST_F(GuestOsSharePathTest, DISABLED_SuccessDriveFsComputerRoot) {
// TODO(crbug.com/917920): Remove when DriveFS enforces allowed write paths. // TODO(crbug.com/917920): Remove when DriveFS enforces allowed write paths.
TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputerRoot) { TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputerRoot) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append("Computers").Append("pc"), PERSIST_NO, "vm-running", drivefs_.Append("Computers").Append("pc"), PERSIST_NO,
...@@ -464,7 +444,6 @@ TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputerRoot) { ...@@ -464,7 +444,6 @@ TEST_F(GuestOsSharePathTest, Bug917920DriveFsComputerRoot) {
} }
TEST_F(GuestOsSharePathTest, SuccessDriveFsComputersLevel3) { TEST_F(GuestOsSharePathTest, SuccessDriveFsComputersLevel3) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", "vm-running",
...@@ -479,7 +458,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsComputersLevel3) { ...@@ -479,7 +458,6 @@ TEST_F(GuestOsSharePathTest, SuccessDriveFsComputersLevel3) {
} }
TEST_F(GuestOsSharePathTest, FailDriveFsTrash) { TEST_F(GuestOsSharePathTest, FailDriveFsTrash) {
features_.InitWithFeatures({chromeos::features::kDriveFs}, {});
SetUpVolume(); SetUpVolume();
guest_os_share_path_->SharePath( guest_os_share_path_->SharePath(
"vm-running", drivefs_.Append(".Trash").Append("in-the-trash"), "vm-running", drivefs_.Append(".Trash").Append("in-the-trash"),
......
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