Commit c14c1049 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Minor cleanup of sign-in screen exts auto-update test

Improve variables naming and comments.

Bug: 1012892
Change-Id: I72aa8b832711041bc71f0aff3742306beaeb7ad2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003177Reviewed-by: default avatarAlexander Hendrich <hendrich@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732846}
parent e30fa55e
......@@ -147,22 +147,24 @@ class ExtensionBackgroundPageReadyObserver final {
// Observer that allows waiting until the specified version of the given
// extension/app gets installed.
class ExtensionInstallObserver final
class ExtensionVersionInstallObserver final
: public extensions::ExtensionRegistryObserver {
public:
ExtensionInstallObserver(Profile* profile,
const std::string& extension_id,
const base::Version& awaited_version)
ExtensionVersionInstallObserver(Profile* profile,
const std::string& extension_id,
const base::Version& awaited_version)
: profile_(profile),
extension_id_(extension_id),
awaited_version_(awaited_version) {
extensions::ExtensionRegistry::Get(profile)->AddObserver(this);
}
ExtensionInstallObserver(const ExtensionInstallObserver&) = delete;
ExtensionInstallObserver& operator=(const ExtensionInstallObserver&) = delete;
ExtensionVersionInstallObserver(const ExtensionVersionInstallObserver&) =
delete;
ExtensionVersionInstallObserver& operator=(
const ExtensionVersionInstallObserver&) = delete;
~ExtensionInstallObserver() override {
~ExtensionVersionInstallObserver() override {
extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this);
}
......@@ -479,7 +481,7 @@ class SigninProfileExtensionsAutoUpdatePolicyTest
extensions::ExtensionRegistry::Get(GetInitialProfile()),
kWhitelistedAppId);
test_extension_latest_version_install_observer_ =
std::make_unique<ExtensionInstallObserver>(
std::make_unique<ExtensionVersionInstallObserver>(
GetInitialProfile(), kWhitelistedAppId,
base::Version(kWhitelistedAppLatestVersion));
......@@ -553,7 +555,7 @@ class SigninProfileExtensionsAutoUpdatePolicyTest
std::unique_ptr<extensions::TestExtensionRegistryObserver>
test_extension_registry_observer_;
std::unique_ptr<ExtensionInstallObserver>
std::unique_ptr<ExtensionVersionInstallObserver>
test_extension_latest_version_install_observer_;
};
......@@ -571,14 +573,17 @@ IN_PROC_BROWSER_TEST_F(SigninProfileExtensionsAutoUpdatePolicyTest,
// This is the second preparation step for the actual test. Here the new version
// of the app is served, and it gets fetched and installed.
IN_PROC_BROWSER_TEST_F(SigninProfileExtensionsAutoUpdatePolicyTest, PRE_Test) {
// Let the extensions system to load the previously fetched version before
// Let the extensions system load the previously fetched version before
// starting to serve the newer version, to avoid hitting flaky DCHECKs in the
// extensions system internals (see https://crbug.com/810799).
WaitForTestExtensionLoaded();
EXPECT_EQ(GetTestExtensionVersion(),
base::Version(kWhitelistedAppOlderVersion));
// Start serving the newer version and verify that it gets installed.
// Start serving the newer version. The extensions system should eventually
// fetch this version due to the retry mechanism when the fetch request to the
// update servers was failing. We verify that the new version eventually gets
// installed.
StartServingTestExtension(kWhitelistedAppLatestVersion);
WaitForTestExtensionLatestVersionInstalled();
}
......
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