Commit 599c821b authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Promote the updater to `active` after --install w/o appid.

When updatersetup.exe without an argument, or when updater.exe --install
is run, it only installs the updater. As a post-condition, the updater
must be made active.

This change is calling ControlService::Run(), which has the result of
starting the COM server, mode check the install, and promote it to
active, if needed.

As a side effect, an update check is performed.

Bug: 1122739
Change-Id: I820304d4674d35e00a8000d6701c9326e32618a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380492
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802740}
parent 32b50786
......@@ -59,8 +59,16 @@ TEST_F(IntegrationTest, InstallUninstall) {
TEST_F(IntegrationTest, InstallAndPromote) {
Install();
ExpectInstalled();
// TODO(crbug.com/1109231): resolve implementation inconsistencies for
// different platforms. In this case, Windows promotes during Install, and
// as a post-condition, the version of the updater is active before --wake
// runs.
#if defined(OS_WIN)
ExpectActiveVersion(UPDATER_VERSION_STRING);
#else
ExpectActiveVersion("0");
RunWake(0); // Candidate qualifies and promotes to active.
#endif
ExpectQualified();
ExpectActiveVersion(UPDATER_VERSION_STRING);
ExpectActive();
......
......@@ -38,11 +38,11 @@
#include "chrome/updater/app/app.h"
#include "chrome/updater/configurator.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/control_service.h"
#include "chrome/updater/installer.h"
#include "chrome/updater/persisted_data.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/update_service.h"
#include "chrome/updater/update_service_in_process.h"
#include "chrome/updater/updater_version.h"
#include "chrome/updater/win/install_progress_observer.h"
#include "chrome/updater/win/setup/setup.h"
......@@ -50,7 +50,6 @@
#include "chrome/updater/win/ui/resources/resources.grh"
#include "chrome/updater/win/ui/splash_screen.h"
#include "chrome/updater/win/ui/util.h"
#include "chrome/updater/win/update_service_out_of_process.h"
#include "chrome/updater/win/util.h"
#include "components/prefs/pref_service.h"
......@@ -754,17 +753,26 @@ void AppInstall::SetupDone(int result) {
void AppInstall::HandleAppId() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const auto app_id =
// This releases the prefs lock, and the RPC server can be started.
global_prefs_ = nullptr;
local_prefs_ = nullptr;
// If no app id is provided, then invoke ControlService::Run to wake
// this version of the updater, to do an update check, and possibly promote
// it as a result.
const std::string app_id =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(kAppIdSwitch);
if (app_id.empty()) {
Shutdown(0);
// The instance of |CreateControlService| has sequence affinity. Bind it
// in the closure to ensure it is released in this sequence.
scoped_refptr<ControlService> control_service = CreateControlService();
control_service->Run(base::BindOnce(
[](scoped_refptr<ControlService> /*control_service*/,
scoped_refptr<AppInstall> app_install) { app_install->Shutdown(0); },
control_service, base::WrapRefCounted(this)));
return;
}
// This releases the prefs lock, and the RPC server can be started.
global_prefs_ = nullptr;
local_prefs_ = nullptr;
app_install_controller_ = base::MakeRefCounted<AppInstallController>();
app_install_controller_->InstallApp(
app_id, base::BindOnce(&AppInstall::Shutdown, this));
......
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