Commit 2fe1a951 authored by Joshua Pawlicki's avatar Joshua Pawlicki Committed by Commit Bot

Updater: Allow branding in uninstall.cmd and enable --uninstall test.

Bug: 1070206, 1062285
Change-Id: Ia5c5222efcf2b90e41f1db9f5cac216a15befb4f
Fixed: 1070206
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147752
Commit-Queue: Joshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758812}
parent 07f83f12
......@@ -215,7 +215,10 @@ if (is_win || is_mac) {
deps += [ "//chrome/updater/win:updater_tests" ]
data_deps = [ "//chrome/updater/win:updater" ]
data_deps = [
"//chrome/updater/win:updater",
"//chrome/updater/win/installer",
]
}
if (is_mac) {
......
......@@ -4,6 +4,7 @@
#include "chrome/updater/test/integration_tests.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -22,15 +23,12 @@ class IntegrationTest : public ::testing::Test {
ExpectClean();
Clean();
}
private:
base::test::TaskEnvironment environment_;
};
// TODO(crbug.com/1063064): Fix the test on Windows.
#if defined(OS_WIN)
#define MAYBE_InstallUninstall DISABLED_InstallUninstall
#else
#define MAYBE_InstallUninstall InstallUninstall
#endif
TEST_F(IntegrationTest, MAYBE_InstallUninstall) {
TEST_F(IntegrationTest, InstallUninstall) {
Install();
ExpectInstalled();
Uninstall();
......
......@@ -8,6 +8,9 @@
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -32,6 +35,15 @@ bool Run(base::CommandLine command_line, int* exit_code) {
if (!process.WaitForExitWithTimeout(base::TimeDelta::FromSeconds(60),
exit_code))
return false;
base::WaitableEvent sleep(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
// The process will exit before it is done uninstalling: sleep for five
// seconds to allow uninstall to complete.
base::ThreadPool::PostDelayedTask(
FROM_HERE, {base::MayBlock()},
base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(&sleep)),
base::TimeDelta::FromSeconds(5));
sleep.Wait();
return true;
}
......@@ -68,7 +80,7 @@ void ExpectClean() {
// Files must not exist on the file system.
// EXPECT_FALSE(base::PathExists(GetProductPath()));
EXPECT_FALSE(base::PathExists(GetProductPath()));
}
void ExpectInstalled() {
......
......@@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/util/process_version.gni")
import("//chrome/process_version_rc_template.gni")
import("//chrome/updater/branding.gni")
import("//testing/test.gni")
# This target builds the updater executable, its installer, and unittests.
......@@ -33,9 +35,16 @@ executable("updater") {
data_deps = [ ":uninstall.cmd" ]
}
copy("uninstall.cmd") {
sources = [ "setup/uninstall.cmd" ]
outputs = [ "$target_gen_dir/uninstall.cmd" ]
process_version("uninstall.cmd") {
template_file = "setup/uninstall.cmd"
output = "$target_gen_dir/uninstall.cmd"
process_only = true
extra_args = [
"-e",
"PRODUCT_FULLNAME=\"$updater_product_full_name\"",
"-e",
"COMPANY_SHORTNAME=\"$updater_company_short_name\"",
]
}
process_version_rc_template("version_resources") {
......
rem Deletes the script's parent directory if \AppData\Local\ChromeUpdater\ is
rem anywhere in the directory path. Sleeps 3 seconds and tries 3 times to
rem delete the directory.
rem Deletes the script's parent directory if
rem \AppData\Local\@COMPANY_SHORTNAME@\@PRODUCT_FULLNAME@\ is anywhere in the
rem directory path. Sleeps 3 seconds and tries 3 times to delete the
rem directory.
@echo off
set Directory=%~dp0
@echo %Directory% | FindStr /R \\AppData\\Local\\Google\\GoogleUpdater\\ > nul
@echo %Directory% | FindStr /R \\AppData\\Local\\@COMPANY_SHORTNAME@\\@PRODUCT_FULLNAME@\\ > nul
IF %ERRORLEVEL% NEQ 0 exit 1
@echo Deleting "%Directory%"...
for /L %%G IN (1,1,3) do (
......
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