Commit 681e82b3 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Use username from cicerone when doing sshfs for crostini mount

Chrome creates the container with default username derived from
the email address of the current logged in profile.
E.g. test.user@gmail.com gets username 'testuser'.

It is possible for users to change the username inside the container.
As long as the user keeps uid=1000, this does not cause issues
except for the sshfs mount where FilesApp connects to the container
using 'sshfs://username@hostname'.

Cicerone is now updated to return the container username in
ContainerStartedSignal and in SetUpLxdContainerUser.  CrostiniManager
can now use this for the sshfs mount.

Removed crostini_util ContainerHomeDirectoryForProfile which was
using the default username.  The container homedir is now available
in CrostiniManager::GetContainerInfo.

Bug: 916297
Change-Id: I27f41647c3b8809170521d741867a8ed430e5476
Reviewed-on: https://chromium-review.googlesource.com/c/1388124
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619897}
parent 09930537
...@@ -89,13 +89,11 @@ class CrostiniManager::CrostiniRestarter ...@@ -89,13 +89,11 @@ class CrostiniManager::CrostiniRestarter
base::WeakPtr<CrostiniManager> crostini_manager, base::WeakPtr<CrostiniManager> crostini_manager,
std::string vm_name, std::string vm_name,
std::string container_name, std::string container_name,
std::string container_username,
CrostiniManager::RestartCrostiniCallback callback) CrostiniManager::RestartCrostiniCallback callback)
: profile_(profile), : profile_(profile),
crostini_manager_(crostini_manager), crostini_manager_(crostini_manager),
vm_name_(std::move(vm_name)), vm_name_(std::move(vm_name)),
container_name_(std::move(container_name)), container_name_(std::move(container_name)),
container_username_(std::move(container_username)),
callback_(std::move(callback)), callback_(std::move(callback)),
restart_id_(next_restart_id_++) {} restart_id_(next_restart_id_++) {}
...@@ -303,7 +301,7 @@ class CrostiniManager::CrostiniRestarter ...@@ -303,7 +301,7 @@ class CrostiniManager::CrostiniRestarter
return; return;
} }
crostini_manager_->SetUpLxdContainerUser( crostini_manager_->SetUpLxdContainerUser(
vm_name_, container_name_, container_username_, vm_name_, container_name_, DefaultContainerUserNameForProfile(profile_),
base::BindOnce(&CrostiniRestarter::SetUpLxdContainerUserFinished, base::BindOnce(&CrostiniRestarter::SetUpLxdContainerUserFinished,
this)); this));
} }
...@@ -324,18 +322,21 @@ class CrostiniManager::CrostiniRestarter ...@@ -324,18 +322,21 @@ class CrostiniManager::CrostiniRestarter
// If default termina/penguin, then do sshfs mount and reshare folders, // If default termina/penguin, then do sshfs mount and reshare folders,
// else we are finished. // else we are finished.
auto info = crostini_manager_->GetContainerInfo(vm_name_, container_name_);
if (vm_name_ == kCrostiniDefaultVmName && if (vm_name_ == kCrostiniDefaultVmName &&
container_name_ == kCrostiniDefaultContainerName) { container_name_ == kCrostiniDefaultContainerName && info &&
!info->sshfs_mounted) {
crostini_manager_->GetContainerSshKeys( crostini_manager_->GetContainerSshKeys(
vm_name_, container_name_, vm_name_, container_name_,
base::BindOnce(&CrostiniRestarter::GetContainerSshKeysFinished, base::BindOnce(&CrostiniRestarter::GetContainerSshKeysFinished, this,
this)); info->username));
} else { } else {
FinishRestart(result); FinishRestart(result);
} }
} }
void GetContainerSshKeysFinished(crostini::CrostiniResult result, void GetContainerSshKeysFinished(const std::string& container_username,
crostini::CrostiniResult result,
const std::string& container_public_key, const std::string& container_public_key,
const std::string& host_private_key, const std::string& host_private_key,
const std::string& hostname) { const std::string& hostname) {
...@@ -358,7 +359,7 @@ class CrostiniManager::CrostiniRestarter ...@@ -358,7 +359,7 @@ class CrostiniManager::CrostiniRestarter
// Call to sshfs to mount. // Call to sshfs to mount.
source_path_ = base::StringPrintf( source_path_ = base::StringPrintf(
"sshfs://%s@%s:", container_username_.c_str(), hostname.c_str()); "sshfs://%s@%s:", container_username.c_str(), hostname.c_str());
dmgr->MountPath(source_path_, "", dmgr->MountPath(source_path_, "",
file_manager::util::GetCrostiniMountPointName(profile_), file_manager::util::GetCrostiniMountPointName(profile_),
file_manager::util::GetCrostiniMountOptions( file_manager::util::GetCrostiniMountOptions(
...@@ -388,6 +389,8 @@ class CrostiniManager::CrostiniRestarter ...@@ -388,6 +389,8 @@ class CrostiniManager::CrostiniRestarter
<< ", mount_type=" << mount_info.mount_type << ", mount_type=" << mount_info.mount_type
<< ", mount_condition=" << mount_info.mount_condition; << ", mount_condition=" << mount_info.mount_condition;
} else { } else {
crostini_manager_->SetContainerSshfsMounted(vm_name_, container_name_);
// Register filesystem and add volume to VolumeManager. // Register filesystem and add volume to VolumeManager.
base::FilePath mount_path = base::FilePath(mount_info.mount_path); base::FilePath mount_path = base::FilePath(mount_info.mount_path);
storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
...@@ -415,7 +418,6 @@ class CrostiniManager::CrostiniRestarter ...@@ -415,7 +418,6 @@ class CrostiniManager::CrostiniRestarter
std::string vm_name_; std::string vm_name_;
std::string container_name_; std::string container_name_;
std::string container_username_;
std::string source_path_; std::string source_path_;
CrostiniManager::RestartCrostiniCallback callback_; CrostiniManager::RestartCrostiniCallback callback_;
base::ObserverList<CrostiniManager::RestartObserver>::Unchecked base::ObserverList<CrostiniManager::RestartObserver>::Unchecked
...@@ -437,7 +439,7 @@ bool CrostiniManager::is_dev_kvm_present_ = true; ...@@ -437,7 +439,7 @@ bool CrostiniManager::is_dev_kvm_present_ = true;
void CrostiniManager::SetVmState(std::string vm_name, VmState vm_state) { void CrostiniManager::SetVmState(std::string vm_name, VmState vm_state) {
auto vm_info = running_vms_.find(std::move(vm_name)); auto vm_info = running_vms_.find(std::move(vm_name));
if (vm_info != running_vms_.end()) { if (vm_info != running_vms_.end()) {
vm_info->second.first = vm_state; vm_info->second.state = vm_state;
return; return;
} }
// This can happen normally when StopVm is called right after start up. // This can happen normally when StopVm is called right after start up.
...@@ -447,43 +449,62 @@ void CrostiniManager::SetVmState(std::string vm_name, VmState vm_state) { ...@@ -447,43 +449,62 @@ void CrostiniManager::SetVmState(std::string vm_name, VmState vm_state) {
bool CrostiniManager::IsVmRunning(std::string vm_name) { bool CrostiniManager::IsVmRunning(std::string vm_name) {
auto vm_info = running_vms_.find(std::move(vm_name)); auto vm_info = running_vms_.find(std::move(vm_name));
if (vm_info != running_vms_.end()) { if (vm_info != running_vms_.end()) {
return vm_info->second.first == VmState::STARTED; return vm_info->second.state == VmState::STARTED;
} }
return false; return false;
} }
base::Optional<vm_tools::concierge::VmInfo> CrostiniManager::GetVmInfo( base::Optional<VmInfo> CrostiniManager::GetVmInfo(std::string vm_name) {
std::string vm_name) {
auto it = running_vms_.find(std::move(vm_name)); auto it = running_vms_.find(std::move(vm_name));
if (it != running_vms_.end()) if (it != running_vms_.end())
return it->second.second; return it->second;
return base::nullopt; return base::nullopt;
} }
void CrostiniManager::AddRunningVmForTesting( void CrostiniManager::AddRunningVmForTesting(std::string vm_name) {
std::string vm_name, running_vms_[std::move(vm_name)] = VmInfo{VmState::STARTED};
vm_tools::concierge::VmInfo vm_info) {
running_vms_[std::move(vm_name)] =
std::make_pair(VmState::STARTED, std::move(vm_info));
} }
LinuxPackageInfo::LinuxPackageInfo() = default; LinuxPackageInfo::LinuxPackageInfo() = default;
LinuxPackageInfo::~LinuxPackageInfo() = default; LinuxPackageInfo::~LinuxPackageInfo() = default;
bool CrostiniManager::IsContainerRunning(std::string vm_name, ContainerInfo::ContainerInfo(std::string container_name,
std::string container_name) { std::string container_username,
std::string container_homedir)
: name(container_name),
username(container_username),
homedir(container_homedir) {}
ContainerInfo::~ContainerInfo() = default;
ContainerInfo::ContainerInfo(const ContainerInfo&) = default;
void CrostiniManager::SetContainerSshfsMounted(std::string vm_name,
std::string container_name) {
auto range = running_containers_.equal_range(std::move(vm_name));
for (auto it = range.first; it != range.second; ++it) {
if (it->second.name == container_name) {
it->second.sshfs_mounted = true;
}
}
}
base::Optional<ContainerInfo> CrostiniManager::GetContainerInfo(
std::string vm_name,
std::string container_name) {
if (!IsVmRunning(vm_name)) { if (!IsVmRunning(vm_name)) {
return false; return base::nullopt;
} }
// TODO(jopra): Ensure the container not marked running if the vm is not
// running.
auto range = running_containers_.equal_range(std::move(vm_name)); auto range = running_containers_.equal_range(std::move(vm_name));
for (auto it = range.first; it != range.second; ++it) { for (auto it = range.first; it != range.second; ++it) {
if (it->second == container_name) { if (it->second.name == container_name) {
return true; return it->second;
} }
} }
return false; return base::nullopt;
}
void CrostiniManager::AddRunningContainerForTesting(std::string vm_name,
ContainerInfo info) {
running_containers_.emplace(std::move(vm_name), info);
} }
void CrostiniManager::UpdateLaunchMetricsForEnterpriseReporting() { void CrostiniManager::UpdateLaunchMetricsForEnterpriseReporting() {
...@@ -1146,8 +1167,7 @@ CrostiniManager::RestartId CrostiniManager::RestartCrostini( ...@@ -1146,8 +1167,7 @@ CrostiniManager::RestartId CrostiniManager::RestartCrostini(
auto restarter = base::MakeRefCounted<CrostiniRestarter>( auto restarter = base::MakeRefCounted<CrostiniRestarter>(
profile_, weak_ptr_factory_.GetWeakPtr(), std::move(vm_name), profile_, weak_ptr_factory_.GetWeakPtr(), std::move(vm_name),
std::move(container_name), ContainerUserNameForProfile(profile_), std::move(container_name), std::move(callback));
std::move(callback));
if (observer) if (observer)
restarter->AddObserver(observer); restarter->AddObserver(observer);
auto key = std::make_pair(restarter->vm_name(), restarter->container_name()); auto key = std::make_pair(restarter->vm_name(), restarter->container_name());
...@@ -1316,7 +1336,7 @@ void CrostiniManager::OnStartTerminaVm( ...@@ -1316,7 +1336,7 @@ void CrostiniManager::OnStartTerminaVm(
// If the vm is already marked "running" run the callback. // If the vm is already marked "running" run the callback.
if (response.status() == vm_tools::concierge::VM_STATUS_RUNNING) { if (response.status() == vm_tools::concierge::VM_STATUS_RUNNING) {
running_vms_[vm_name] = running_vms_[vm_name] =
std::make_pair(VmState::STARTED, std::move(response.vm_info())); VmInfo{VmState::STARTED, std::move(response.vm_info())};
std::move(callback).Run(CrostiniResult::SUCCESS); std::move(callback).Run(CrostiniResult::SUCCESS);
return; return;
} }
...@@ -1327,7 +1347,7 @@ void CrostiniManager::OnStartTerminaVm( ...@@ -1327,7 +1347,7 @@ void CrostiniManager::OnStartTerminaVm(
VLOG(1) << "Awaiting TremplinStartedSignal for " << owner_id_ << ", " VLOG(1) << "Awaiting TremplinStartedSignal for " << owner_id_ << ", "
<< vm_name; << vm_name;
running_vms_[vm_name] = running_vms_[vm_name] =
std::make_pair(VmState::STARTING, std::move(response.vm_info())); VmInfo{VmState::STARTING, std::move(response.vm_info())};
// If we thought a container was running for this VM, we're wrong. This can // If we thought a container was running for this VM, we're wrong. This can
// happen if the vm was formerly running, then stopped via crosh. // happen if the vm was formerly running, then stopped via crosh.
running_containers_.erase(vm_name); running_containers_.erase(vm_name);
...@@ -1391,6 +1411,10 @@ void CrostiniManager::OnContainerStarted( ...@@ -1391,6 +1411,10 @@ void CrostiniManager::OnContainerStarted(
const vm_tools::cicerone::ContainerStartedSignal& signal) { const vm_tools::cicerone::ContainerStartedSignal& signal) {
if (signal.owner_id() != owner_id_) if (signal.owner_id() != owner_id_)
return; return;
running_containers_.emplace(
signal.vm_name(),
ContainerInfo(signal.container_name(), signal.container_username(),
signal.container_homedir()));
// Find the callbacks to call, then erase them from the map. // Find the callbacks to call, then erase them from the map.
auto range = start_container_callbacks_.equal_range( auto range = start_container_callbacks_.equal_range(
std::make_tuple(signal.vm_name(), signal.container_name())); std::make_tuple(signal.vm_name(), signal.container_name()));
...@@ -1398,7 +1422,6 @@ void CrostiniManager::OnContainerStarted( ...@@ -1398,7 +1422,6 @@ void CrostiniManager::OnContainerStarted(
std::move(it->second).Run(CrostiniResult::SUCCESS); std::move(it->second).Run(CrostiniResult::SUCCESS);
} }
start_container_callbacks_.erase(range.first, range.second); start_container_callbacks_.erase(range.first, range.second);
running_containers_.emplace(signal.vm_name(), signal.container_name());
} }
void CrostiniManager::OnContainerStartupFailed( void CrostiniManager::OnContainerStartupFailed(
...@@ -1419,12 +1442,22 @@ void CrostiniManager::OnContainerShutdown( ...@@ -1419,12 +1442,22 @@ void CrostiniManager::OnContainerShutdown(
if (signal.owner_id() != owner_id_) if (signal.owner_id() != owner_id_)
return; return;
// Find the callbacks to call, then erase them from the map. // Find the callbacks to call, then erase them from the map.
auto range = shutdown_container_callbacks_.equal_range( auto range_callbacks = shutdown_container_callbacks_.equal_range(
std::make_tuple(signal.vm_name(), signal.container_name())); std::make_tuple(signal.vm_name(), signal.container_name()));
for (auto it = range.first; it != range.second; ++it) { for (auto it = range_callbacks.first; it != range_callbacks.second; ++it) {
std::move(it->second).Run(); std::move(it->second).Run();
} }
shutdown_container_callbacks_.erase(range.first, range.second); shutdown_container_callbacks_.erase(range_callbacks.first,
range_callbacks.second);
// Remove from running containers multimap.
auto range_containers = running_containers_.equal_range(signal.vm_name());
for (auto it = range_containers.first; it != range_containers.second; ++it) {
if (it->second.name == signal.container_name()) {
running_containers_.erase(it);
break;
}
}
} }
void CrostiniManager::OnInstallLinuxPackageProgress( void CrostiniManager::OnInstallLinuxPackageProgress(
...@@ -1604,7 +1637,7 @@ void CrostiniManager::OnSetUpLxdContainerUser( ...@@ -1604,7 +1637,7 @@ void CrostiniManager::OnSetUpLxdContainerUser(
return; return;
} }
if (!IsContainerRunning(vm_name, container_name)) { if (!GetContainerInfo(vm_name, container_name)) {
start_container_callbacks_.emplace(std::make_tuple(vm_name, container_name), start_container_callbacks_.emplace(std::make_tuple(vm_name, container_name),
std::move(callback)); std::move(callback));
return; return;
......
...@@ -74,6 +74,22 @@ enum class UninstallPackageProgressStatus { ...@@ -74,6 +74,22 @@ enum class UninstallPackageProgressStatus {
UNINSTALLING, // In progress UNINSTALLING, // In progress
}; };
struct VmInfo {
VmState state;
vm_tools::concierge::VmInfo info;
};
struct ContainerInfo {
ContainerInfo(std::string name, std::string username, std::string homedir);
~ContainerInfo();
ContainerInfo(const ContainerInfo&);
std::string name;
std::string username;
base::FilePath homedir;
bool sshfs_mounted = false;
};
// Return type when getting app icons from within a container. // Return type when getting app icons from within a container.
struct Icon { struct Icon {
std::string desktop_file_id; std::string desktop_file_id;
...@@ -429,12 +445,16 @@ class CrostiniManager : public KeyedService, ...@@ -429,12 +445,16 @@ class CrostiniManager : public KeyedService,
void SetVmState(std::string vm_name, VmState vm_state); void SetVmState(std::string vm_name, VmState vm_state);
bool IsVmRunning(std::string vm_name); bool IsVmRunning(std::string vm_name);
// Returns null if VM is not running. // Returns null if VM is not running.
base::Optional<vm_tools::concierge::VmInfo> GetVmInfo(std::string vm_name); base::Optional<VmInfo> GetVmInfo(std::string vm_name);
void AddRunningVmForTesting(std::string vm_name, void AddRunningVmForTesting(std::string vm_name);
vm_tools::concierge::VmInfo vm_info);
bool IsContainerRunning(std::string vm_name, std::string container_name); void SetContainerSshfsMounted(std::string vm_name,
std::string container_name);
// Returns null if VM or container is not running.
base::Optional<ContainerInfo> GetContainerInfo(std::string vm_name,
std::string container_name);
void AddRunningContainerForTesting(std::string vm_name, ContainerInfo info);
// If the Crostini reporting policy is set, save the last app launch // If the Crostini reporting policy is set, save the last app launch
// time window and the Termina version in prefs for asynchronous reporting. // time window and the Termina version in prefs for asynchronous reporting.
...@@ -612,11 +632,10 @@ class CrostiniManager : public KeyedService, ...@@ -612,11 +632,10 @@ class CrostiniManager : public KeyedService,
// start. // start.
std::multimap<std::string, base::OnceClosure> tremplin_started_callbacks_; std::multimap<std::string, base::OnceClosure> tremplin_started_callbacks_;
std::map<std::string, std::pair<VmState, vm_tools::concierge::VmInfo>> std::map<std::string, VmInfo> running_vms_;
running_vms_;
// Running containers as keyed by vm name. // Running containers as keyed by vm name.
std::multimap<std::string, std::string> running_containers_; std::multimap<std::string, ContainerInfo> running_containers_;
std::vector<RemoveCrostiniCallback> remove_crostini_callbacks_; std::vector<RemoveCrostiniCallback> remove_crostini_callbacks_;
......
...@@ -715,6 +715,10 @@ TEST_F(CrostiniManagerRestartTest, MountForTerminaPenguin) { ...@@ -715,6 +715,10 @@ TEST_F(CrostiniManagerRestartTest, MountForTerminaPenguin) {
EXPECT_TRUE(fake_concierge_client_->create_disk_image_called()); EXPECT_TRUE(fake_concierge_client_->create_disk_image_called());
EXPECT_TRUE(fake_concierge_client_->start_termina_vm_called()); EXPECT_TRUE(fake_concierge_client_->start_termina_vm_called());
EXPECT_TRUE(fake_concierge_client_->get_container_ssh_keys_called()); EXPECT_TRUE(fake_concierge_client_->get_container_ssh_keys_called());
EXPECT_TRUE(crostini_manager()
->GetContainerInfo(kCrostiniDefaultVmName,
kCrostiniDefaultContainerName)
->sshfs_mounted);
EXPECT_EQ(1, restart_crostini_callback_count_); EXPECT_EQ(1, restart_crostini_callback_count_);
base::FilePath path; base::FilePath path;
EXPECT_TRUE( EXPECT_TRUE(
...@@ -741,7 +745,7 @@ TEST_F(CrostiniManagerRestartTest, IsContainerRunningFalseIfVmNotStarted) { ...@@ -741,7 +745,7 @@ TEST_F(CrostiniManagerRestartTest, IsContainerRunningFalseIfVmNotStarted) {
EXPECT_EQ(1, restart_crostini_callback_count_); EXPECT_EQ(1, restart_crostini_callback_count_);
EXPECT_TRUE(crostini_manager()->IsVmRunning(kVmName)); EXPECT_TRUE(crostini_manager()->IsVmRunning(kVmName));
EXPECT_TRUE(crostini_manager()->IsContainerRunning(kVmName, kContainerName)); EXPECT_TRUE(crostini_manager()->GetContainerInfo(kVmName, kContainerName));
// Now call StartTerminaVm again. The default response state is "STARTING", // Now call StartTerminaVm again. The default response state is "STARTING",
// so no container should be considered running. // so no container should be considered running.
...@@ -754,7 +758,7 @@ TEST_F(CrostiniManagerRestartTest, IsContainerRunningFalseIfVmNotStarted) { ...@@ -754,7 +758,7 @@ TEST_F(CrostiniManagerRestartTest, IsContainerRunningFalseIfVmNotStarted) {
base::Unretained(this), run_loop2.QuitClosure())); base::Unretained(this), run_loop2.QuitClosure()));
run_loop2.Run(); run_loop2.Run();
EXPECT_TRUE(crostini_manager()->IsVmRunning(kVmName)); EXPECT_TRUE(crostini_manager()->IsVmRunning(kVmName));
EXPECT_FALSE(crostini_manager()->IsContainerRunning(kVmName, kContainerName)); EXPECT_FALSE(crostini_manager()->GetContainerInfo(kVmName, kContainerName));
} }
} // namespace crostini } // namespace crostini
...@@ -48,13 +48,13 @@ void OnVmRestartedForSeneschal( ...@@ -48,13 +48,13 @@ void OnVmRestartedForSeneschal(
vm_tools::seneschal::SharePathRequest request, vm_tools::seneschal::SharePathRequest request,
crostini::CrostiniResult result) { crostini::CrostiniResult result) {
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile); auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile);
base::Optional<vm_tools::concierge::VmInfo> vm_info = base::Optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(std::move(vm_name)); crostini_manager->GetVmInfo(std::move(vm_name));
if (!vm_info) { if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
std::move(callback).Run(false, "VM could not be started"); std::move(callback).Run(false, "VM could not be started");
return; return;
} }
request.set_handle(vm_info->seneschal_server_handle()); request.set_handle(vm_info->info.seneschal_server_handle());
chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath( chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath(
request, request,
base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback))); base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback)));
...@@ -240,9 +240,9 @@ void CrostiniSharePath::CallSeneschalSharePath( ...@@ -240,9 +240,9 @@ void CrostiniSharePath::CallSeneschalSharePath(
// Restart VM if not currently running. // Restart VM if not currently running.
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_); auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_);
base::Optional<vm_tools::concierge::VmInfo> vm_info = base::Optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(vm_name); crostini_manager->GetVmInfo(vm_name);
if (!vm_info) { if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
crostini_manager->RestartCrostini( crostini_manager->RestartCrostini(
vm_name, crostini::kCrostiniDefaultContainerName, vm_name, crostini::kCrostiniDefaultContainerName,
base::BindOnce(&OnVmRestartedForSeneschal, profile_, std::move(vm_name), base::BindOnce(&OnVmRestartedForSeneschal, profile_, std::move(vm_name),
...@@ -251,7 +251,7 @@ void CrostiniSharePath::CallSeneschalSharePath( ...@@ -251,7 +251,7 @@ void CrostiniSharePath::CallSeneschalSharePath(
return; return;
} }
request.set_handle(vm_info->seneschal_server_handle()); request.set_handle(vm_info->info.seneschal_server_handle());
chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath( chromeos::DBusThreadManager::Get()->GetSeneschalClient()->SharePath(
request, request,
base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback))); base::BindOnce(&OnSeneschalSharePathResponse, std::move(callback)));
...@@ -263,9 +263,9 @@ void CrostiniSharePath::CallSeneschalUnsharePath( ...@@ -263,9 +263,9 @@ void CrostiniSharePath::CallSeneschalUnsharePath(
base::OnceCallback<void(bool, std::string)> callback) { base::OnceCallback<void(bool, std::string)> callback) {
// Return success if VM is not currently running. // Return success if VM is not currently running.
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_); auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_);
base::Optional<vm_tools::concierge::VmInfo> vm_info = base::Optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(vm_name); crostini_manager->GetVmInfo(std::move(vm_name));
if (!vm_info) { if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
std::move(callback).Run(true, "VM not running"); std::move(callback).Run(true, "VM not running");
return; return;
} }
...@@ -292,7 +292,7 @@ void CrostiniSharePath::CallSeneschalUnsharePath( ...@@ -292,7 +292,7 @@ void CrostiniSharePath::CallSeneschalUnsharePath(
} }
vm_tools::seneschal::UnsharePathRequest request; vm_tools::seneschal::UnsharePathRequest request;
request.set_handle(vm_info->seneschal_server_handle()); request.set_handle(vm_info->info.seneschal_server_handle());
request.set_path(unshare_path.value()); request.set_path(unshare_path.value());
chromeos::DBusThreadManager::Get()->GetSeneschalClient()->UnsharePath( chromeos::DBusThreadManager::Get()->GetSeneschalClient()->UnsharePath(
request, request,
......
...@@ -208,9 +208,8 @@ class CrostiniSharePathTest : public testing::Test { ...@@ -208,9 +208,8 @@ class CrostiniSharePathTest : public testing::Test {
volume_downloads_ = file_manager::Volume::CreateForDownloads(downloads_); volume_downloads_ = file_manager::Volume::CreateForDownloads(downloads_);
// Create 'vm-running' VM instance which is running. // Create 'vm-running' VM instance which is running.
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
"vm-running", vm_info); "vm-running");
} }
void TearDown() override { void TearDown() override {
...@@ -499,9 +498,8 @@ TEST_F(CrostiniSharePathTest, SharePersistedPaths) { ...@@ -499,9 +498,8 @@ TEST_F(CrostiniSharePathTest, SharePersistedPaths) {
features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles); features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles);
base::FilePath share_path2_ = downloads_.AppendASCII("path-to-share-2"); base::FilePath share_path2_ = downloads_.AppendASCII("path-to-share-2");
ASSERT_TRUE(base::CreateDirectory(share_path2_)); ASSERT_TRUE(base::CreateDirectory(share_path2_));
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
base::ListValue shared_paths = base::ListValue(); base::ListValue shared_paths = base::ListValue();
shared_paths.GetList().push_back(base::Value(share_path_.value())); shared_paths.GetList().push_back(base::Value(share_path_.value()));
shared_paths.GetList().push_back(base::Value(share_path2_.value())); shared_paths.GetList().push_back(base::Value(share_path2_.value()));
...@@ -695,9 +693,8 @@ TEST_F(CrostiniSharePathTest, GetPersistedSharedPaths) { ...@@ -695,9 +693,8 @@ TEST_F(CrostiniSharePathTest, GetPersistedSharedPaths) {
TEST_F(CrostiniSharePathTest, ShareOnMountSuccessParentMount) { TEST_F(CrostiniSharePathTest, ShareOnMountSuccessParentMount) {
features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles); features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
crostini_share_path_->SetMountEventSeneschalCallbackForTesting( crostini_share_path_->SetMountEventSeneschalCallbackForTesting(
base::BindRepeating(&CrostiniSharePathTest::MountEventSharePathCallback, base::BindRepeating(&CrostiniSharePathTest::MountEventSharePathCallback,
base::Unretained(this), "share-on-mount", base::Unretained(this), "share-on-mount",
...@@ -711,9 +708,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountSuccessParentMount) { ...@@ -711,9 +708,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountSuccessParentMount) {
TEST_F(CrostiniSharePathTest, ShareOnMountSuccessSelfMount) { TEST_F(CrostiniSharePathTest, ShareOnMountSuccessSelfMount) {
features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles); features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
auto volume_shared_path = auto volume_shared_path =
file_manager::Volume::CreateForDownloads(shared_path_); file_manager::Volume::CreateForDownloads(shared_path_);
crostini_share_path_->SetMountEventSeneschalCallbackForTesting( crostini_share_path_->SetMountEventSeneschalCallbackForTesting(
...@@ -729,9 +725,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountSuccessSelfMount) { ...@@ -729,9 +725,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountSuccessSelfMount) {
TEST_F(CrostiniSharePathTest, ShareOnMountFeatureNotEnabled) { TEST_F(CrostiniSharePathTest, ShareOnMountFeatureNotEnabled) {
features_.InitAndDisableFeature(chromeos::features::kCrostiniFiles); features_.InitAndDisableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
// Test mount. // Test mount.
crostini_share_path_->OnVolumeMounted(chromeos::MountError::MOUNT_ERROR_NONE, crostini_share_path_->OnVolumeMounted(chromeos::MountError::MOUNT_ERROR_NONE,
...@@ -746,9 +741,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountFeatureNotEnabled) { ...@@ -746,9 +741,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountFeatureNotEnabled) {
TEST_F(CrostiniSharePathTest, ShareOnMountMountError) { TEST_F(CrostiniSharePathTest, ShareOnMountMountError) {
features_.InitAndDisableFeature(chromeos::features::kCrostiniFiles); features_.InitAndDisableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
// Test mount. // Test mount.
crostini_share_path_->OnVolumeMounted( crostini_share_path_->OnVolumeMounted(
...@@ -793,9 +787,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountVolumeUnrelated) { ...@@ -793,9 +787,8 @@ TEST_F(CrostiniSharePathTest, ShareOnMountVolumeUnrelated) {
TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessParentMount) { TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessParentMount) {
features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles); features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
crostini_share_path_->SetMountEventSeneschalCallbackForTesting( crostini_share_path_->SetMountEventSeneschalCallbackForTesting(
base::BindRepeating( base::BindRepeating(
&CrostiniSharePathTest::MountEventUnsharePathCallback, &CrostiniSharePathTest::MountEventUnsharePathCallback,
...@@ -809,9 +802,8 @@ TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessParentMount) { ...@@ -809,9 +802,8 @@ TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessParentMount) {
TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessSelfMount) { TEST_F(CrostiniSharePathTest, UnshareOnUnmountSuccessSelfMount) {
features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles); features_.InitAndEnableFeature(chromeos::features::kCrostiniFiles);
vm_tools::concierge::VmInfo vm_info;
CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting( CrostiniManager::GetForProfile(profile())->AddRunningVmForTesting(
kCrostiniDefaultVmName, vm_info); kCrostiniDefaultVmName);
auto volume_shared_path = auto volume_shared_path =
file_manager::Volume::CreateForDownloads(shared_path_); file_manager::Volume::CreateForDownloads(shared_path_);
crostini_share_path_->SetMountEventSeneschalCallbackForTesting( crostini_share_path_->SetMountEventSeneschalCallbackForTesting(
......
...@@ -384,7 +384,7 @@ std::string CryptohomeIdForProfile(Profile* profile) { ...@@ -384,7 +384,7 @@ std::string CryptohomeIdForProfile(Profile* profile) {
return id.empty() ? "test" : id; return id.empty() ? "test" : id;
} }
std::string ContainerUserNameForProfile(Profile* profile) { std::string DefaultContainerUserNameForProfile(Profile* profile) {
// Get rid of the @domain.name in the profile user name (an email address). // Get rid of the @domain.name in the profile user name (an email address).
std::string container_username = profile->GetProfileUserName(); std::string container_username = profile->GetProfileUserName();
if (container_username.find('@') != std::string::npos) { if (container_username.find('@') != std::string::npos) {
...@@ -396,10 +396,6 @@ std::string ContainerUserNameForProfile(Profile* profile) { ...@@ -396,10 +396,6 @@ std::string ContainerUserNameForProfile(Profile* profile) {
return container_username; return container_username;
} }
base::FilePath ContainerHomeDirectoryForProfile(Profile* profile) {
return base::FilePath("/home/" + ContainerUserNameForProfile(profile));
}
base::FilePath ContainerChromeOSBaseDirectory() { base::FilePath ContainerChromeOSBaseDirectory() {
return base::FilePath("/mnt/chromeos"); return base::FilePath("/mnt/chromeos");
} }
......
...@@ -78,10 +78,7 @@ std::string CryptohomeIdForProfile(Profile* profile); ...@@ -78,10 +78,7 @@ std::string CryptohomeIdForProfile(Profile* profile);
// Retrieves username from profile. This is the text until '@' in // Retrieves username from profile. This is the text until '@' in
// profile->GetProfileUserName() email address. // profile->GetProfileUserName() email address.
std::string ContainerUserNameForProfile(Profile* profile); std::string DefaultContainerUserNameForProfile(Profile* profile);
// Returns the home directory within the container for a given profile.
base::FilePath ContainerHomeDirectoryForProfile(Profile* profile);
// Returns the mount directory within the container where paths from the Chrome // Returns the mount directory within the container where paths from the Chrome
// OS host such as within Downloads are shared with the container. // OS host such as within Downloads are shared with the container.
......
...@@ -551,9 +551,11 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Crostini) { ...@@ -551,9 +551,11 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Crostini) {
crostini::CrostiniManager* crostini_manager = crostini::CrostiniManager* crostini_manager =
crostini::CrostiniManager::GetForProfile(browser()->profile()); crostini::CrostiniManager::GetForProfile(browser()->profile());
crostini_manager->set_skip_restart_for_testing(); crostini_manager->set_skip_restart_for_testing();
vm_tools::concierge::VmInfo vm_info; crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName);
crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName, crostini_manager->AddRunningContainerForTesting(
std::move(vm_info)); crostini::kCrostiniDefaultVmName,
crostini::ContainerInfo(crostini::kCrostiniDefaultContainerName,
"testuser", "/home/testuser"));
ExpectCrostiniMount(); ExpectCrostiniMount();
...@@ -585,8 +587,17 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Crostini) { ...@@ -585,8 +587,17 @@ IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, Crostini) {
IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, CrostiniIncognito) { IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, CrostiniIncognito) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
EnableCrostiniForProfile(&scoped_feature_list); EnableCrostiniForProfile(&scoped_feature_list);
crostini::CrostiniManager::GetForProfile(browser()->profile())
->set_skip_restart_for_testing(); // Setup CrostiniManager for testing.
crostini::CrostiniManager* crostini_manager =
crostini::CrostiniManager::GetForProfile(browser()->profile());
crostini_manager->set_skip_restart_for_testing();
crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName);
crostini_manager->AddRunningContainerForTesting(
crostini::kCrostiniDefaultVmName,
crostini::ContainerInfo(crostini::kCrostiniDefaultContainerName,
"testuser", "/home/testuser"));
ExpectCrostiniMount(); ExpectCrostiniMount();
scoped_refptr<extensions::FileManagerPrivateMountCrostiniFunction> function( scoped_refptr<extensions::FileManagerPrivateMountCrostiniFunction> function(
......
...@@ -1252,13 +1252,21 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() { ...@@ -1252,13 +1252,21 @@ void FileManagerBrowserTestBase::SetUpOnMainThread() {
drive_volume_ = drive_volumes_[profile()->GetOriginalProfile()].get(); drive_volume_ = drive_volumes_[profile()->GetOriginalProfile()].get();
test_util::WaitUntilDriveMountPointIsAdded(profile()); test_util::WaitUntilDriveMountPointIsAdded(profile());
// Init crostini. Set prefs to enable crostini and register // Init crostini. Set prefs to enable crostini, set VM and container
// CustomMountPointCallback. TODO(joelhockey): It would be better if the // running for testing, and register CustomMountPointCallback.
// crostini interface allowed for testing without such tight coupling. // TODO(joelhockey): It would be better if the crostini interface allowed
// for testing without such tight coupling.
crostini_volume_ = std::make_unique<CrostiniTestVolume>(); crostini_volume_ = std::make_unique<CrostiniTestVolume>();
profile()->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled, true); profile()->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled, true);
crostini::CrostiniManager::GetForProfile(profile()->GetOriginalProfile()) crostini::CrostiniManager* crostini_manager =
->set_skip_restart_for_testing(); crostini::CrostiniManager::GetForProfile(
profile()->GetOriginalProfile());
crostini_manager->set_skip_restart_for_testing();
crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName);
crostini_manager->AddRunningContainerForTesting(
crostini::kCrostiniDefaultVmName,
crostini::ContainerInfo(crostini::kCrostiniDefaultContainerName,
"testuser", "/home/testuser"));
chromeos::DBusThreadManager* dbus_thread_manager = chromeos::DBusThreadManager* dbus_thread_manager =
chromeos::DBusThreadManager::Get(); chromeos::DBusThreadManager::Get();
static_cast<chromeos::FakeCrosDisksClient*>( static_cast<chromeos::FakeCrosDisksClient*>(
...@@ -1733,13 +1741,7 @@ base::FilePath FileManagerBrowserTestBase::MaybeMountCrostini( ...@@ -1733,13 +1741,7 @@ base::FilePath FileManagerBrowserTestBase::MaybeMountCrostini(
if (source_url.scheme() != "sshfs") { if (source_url.scheme() != "sshfs") {
return {}; return {};
} }
// Mount crostini volume, and set VM now running for CrostiniManager.
CHECK(crostini_volume_->Mount(profile())); CHECK(crostini_volume_->Mount(profile()));
crostini::CrostiniManager* crostini_manager =
crostini::CrostiniManager::GetForProfile(profile()->GetOriginalProfile());
vm_tools::concierge::VmInfo vm_info;
crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName,
std::move(vm_info));
return crostini_volume_->mount_path(); return crostini_volume_->mount_path();
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h"
#include "chrome/browser/chromeos/arc/fileapi/chrome_content_provider_url_util.h" #include "chrome/browser/chromeos/arc/fileapi/chrome_content_provider_url_util.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/fileapi/external_file_url_util.h" #include "chrome/browser/chromeos/fileapi/external_file_url_util.h"
...@@ -270,7 +271,14 @@ bool ConvertFileSystemURLToPathInsideCrostini( ...@@ -270,7 +271,14 @@ bool ConvertFileSystemURLToPathInsideCrostini(
base::FilePath base_to_exclude(id); base::FilePath base_to_exclude(id);
if (id == GetCrostiniMountPointName(profile)) { if (id == GetCrostiniMountPointName(profile)) {
// Crostini. // Crostini.
*inside = crostini::ContainerHomeDirectoryForProfile(profile); base::Optional<crostini::ContainerInfo> container_info =
crostini::CrostiniManager::GetForProfile(profile)->GetContainerInfo(
crostini::kCrostiniDefaultVmName,
crostini::kCrostiniDefaultContainerName);
if (!container_info) {
return false;
}
*inside = container_info->homedir;
} else if (id == GetDownloadsMountPointName(profile)) { } else if (id == GetDownloadsMountPointName(profile)) {
// MyFiles or Downloads. // MyFiles or Downloads.
if (base::FeatureList::IsEnabled(chromeos::features::kMyFilesVolume)) { if (base::FeatureList::IsEnabled(chromeos::features::kMyFilesVolume)) {
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h" #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_util.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h" #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h" #include "chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h"
...@@ -26,6 +28,7 @@ ...@@ -26,6 +28,7 @@
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h" #include "chrome/test/base/testing_profile_manager.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/arc/arc_bridge_service.h" #include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
...@@ -327,6 +330,15 @@ TEST(FileManagerPathUtilTest, ConvertFileSystemURLToPathInsideCrostini) { ...@@ -327,6 +330,15 @@ TEST(FileManagerPathUtilTest, ConvertFileSystemURLToPathInsideCrostini) {
AccountId::FromUserEmailGaiaId(profile.GetProfileUserName(), "12345")); AccountId::FromUserEmailGaiaId(profile.GetProfileUserName(), "12345"));
profile.GetPrefs()->SetString(drive::prefs::kDriveFsProfileSalt, "a"); profile.GetPrefs()->SetString(drive::prefs::kDriveFsProfileSalt, "a");
// Initialize DBUS and running container.
chromeos::DBusThreadManager::Initialize();
crostini::CrostiniManager* crostini_manager =
crostini::CrostiniManager::GetForProfile(&profile);
crostini_manager->AddRunningVmForTesting(crostini::kCrostiniDefaultVmName);
crostini_manager->AddRunningContainerForTesting(
crostini::kCrostiniDefaultVmName,
crostini::ContainerInfo(crostini::kCrostiniDefaultContainerName,
"testuser", "/home/testuser"));
{ {
base::test::ScopedFeatureList features; base::test::ScopedFeatureList features;
features.InitAndEnableFeature(chromeos::features::kDriveFs); features.InitAndEnableFeature(chromeos::features::kDriveFs);
...@@ -362,7 +374,7 @@ TEST(FileManagerPathUtilTest, ConvertFileSystemURLToPathInsideCrostini) { ...@@ -362,7 +374,7 @@ TEST(FileManagerPathUtilTest, ConvertFileSystemURLToPathInsideCrostini) {
GURL(), "crostini_0123456789abcdef_termina_penguin", GURL(), "crostini_0123456789abcdef_termina_penguin",
base::FilePath("path/in/crostini")), base::FilePath("path/in/crostini")),
&inside)); &inside));
EXPECT_EQ("/home/testing_profile/path/in/crostini", inside.value()); EXPECT_EQ("/home/testuser/path/in/crostini", inside.value());
EXPECT_TRUE(ConvertFileSystemURLToPathInsideCrostini( EXPECT_TRUE(ConvertFileSystemURLToPathInsideCrostini(
&profile, &profile,
......
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