Commit 9ac7d98d authored by Fergus Dall's avatar Fergus Dall Committed by Commit Bot

Don't fail to start crostini when cros-termina is updating

Currently we consider this an error condition, but since we are now
able to distinguish this from other failure sources we can retry
instead. This CL arbitrarily sets the retry frequency to 5 seconds,
which is hopefully fast enough to not be annoying.

Bug: 1065817
Change-Id: I532efeb2f4f7ef1aea4be248e1396061edb65d71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126967
Commit-Queue: Fergus Dall <sidereal@google.com>
Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754829}
parent f44e3c47
...@@ -1094,7 +1094,15 @@ void CrostiniManager::OnInstallTerminaComponent( ...@@ -1094,7 +1094,15 @@ void CrostiniManager::OnInstallTerminaComponent(
if (!is_successful) { if (!is_successful) {
if (error == if (error ==
component_updater::CrOSComponentManager::Error::UPDATE_IN_PROGRESS) { component_updater::CrOSComponentManager::Error::UPDATE_IN_PROGRESS) {
result = CrostiniResult::LOAD_COMPONENT_UPDATE_IN_PROGRESS; // Something else triggered an update that we have to wait on. We don't
// know what, or when they will be finished, so just retry every 5 seconds
// until we get a different result.
base::PostDelayedTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&CrostiniManager::InstallTerminaComponent,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
base::TimeDelta::FromSeconds(5));
return;
} else { } else {
result = CrostiniResult::LOAD_COMPONENT_FAILED; result = CrostiniResult::LOAD_COMPONENT_FAILED;
} }
......
...@@ -1439,6 +1439,29 @@ TEST_F(CrostiniManagerRestartTest, RestartWhileShuttingDown) { ...@@ -1439,6 +1439,29 @@ TEST_F(CrostiniManagerRestartTest, RestartWhileShuttingDown) {
// of shutting down chrome while a restart is running. // of shutting down chrome while a restart is running.
} }
TEST_F(CrostiniManagerRestartTest, ComponentUpdateInProgress) {
crostini_manager()->set_component_manager_load_error_for_testing(
component_updater::CrOSComponentManager::Error::UPDATE_IN_PROGRESS);
crostini_manager()->RestartCrostini(
kVmName, kContainerName,
base::BindOnce(&CrostiniManagerRestartTest::RestartCrostiniCallback,
base::Unretained(this), run_loop()->QuitClosure()));
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::BindOnce(
&CrostiniManager::set_component_manager_load_error_for_testing,
base::Unretained(crostini_manager()),
component_updater::CrOSComponentManager::Error::NONE),
base::TimeDelta::FromSeconds(3));
run_loop()->Run();
ExpectRestarterUmaCount(1);
ExpectCrostiniRestartResult(CrostiniResult::SUCCESS);
}
class CrostiniManagerEnterpriseReportingTest class CrostiniManagerEnterpriseReportingTest
: public CrostiniManagerRestartTest { : public CrostiniManagerRestartTest {
public: public:
......
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