Commit 704c72ee authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Component updater should use testsource=dev in addition to testrequest=1

With this change, the configurator code injects both values.

extra_info_["testrequest"] = "1";
extra_info_["testsource"] = "dev";

Bug: 906641
Change-Id: I4cd3f68b9b292f2d76b95d3678bd6df0cd437e73
Reviewed-on: https://chromium-review.googlesource.com/c/1343294Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609500}
parent 9e369e32
...@@ -52,8 +52,10 @@ ConfiguratorImpl::ConfiguratorImpl( ...@@ -52,8 +52,10 @@ ConfiguratorImpl::ConfiguratorImpl(
require_encryption_(require_encryption), require_encryption_(require_encryption),
url_source_override_(config_policy.UrlSourceOverride()), url_source_override_(config_policy.UrlSourceOverride()),
initial_delay_(config_policy.InitialDelay()) { initial_delay_(config_policy.InitialDelay()) {
if (config_policy.TestRequest()) if (config_policy.TestRequest()) {
extra_info_["testrequest"] = "1"; extra_info_["testrequest"] = "1";
extra_info_["testsource"] = "dev";
}
} }
ConfiguratorImpl::~ConfiguratorImpl() {} ConfiguratorImpl::~ConfiguratorImpl() {}
......
...@@ -139,4 +139,41 @@ TEST_F(ComponentUpdaterConfiguratorImplTest, InitialDelay) { ...@@ -139,4 +139,41 @@ TEST_F(ComponentUpdaterConfiguratorImplTest, InitialDelay) {
} }
} }
TEST_F(ComponentUpdaterConfiguratorImplTest, TestRequest) {
class CommandLineConfigPolicy
: public update_client::CommandLineConfigPolicy {
public:
CommandLineConfigPolicy() = default;
// update_client::CommandLineConfigPolicy overrides.
bool BackgroundDownloadsEnabled() const override { return false; }
bool DeltaUpdatesEnabled() const override { return false; }
bool FastUpdate() const override { return false; }
bool PingsEnabled() const override { return false; }
bool TestRequest() const override { return test_request_; }
GURL UrlSourceOverride() const override { return GURL(); }
int InitialDelay() const override { return 0; };
void set_test_request(bool test_request) { test_request_ = test_request; }
private:
bool test_request_ = false;
};
auto config = std::make_unique<ConfiguratorImpl>(
update_client::CommandLineConfigPolicy(), false);
EXPECT_TRUE(config->ExtraRequestParams().empty());
CommandLineConfigPolicy clcp;
config = std::make_unique<ConfiguratorImpl>(clcp, false);
auto extra_request_params = config->ExtraRequestParams();
EXPECT_EQ(0u, extra_request_params.count("testrequest"));
EXPECT_EQ(0u, extra_request_params.count("testsource"));
clcp.set_test_request(true);
config = std::make_unique<ConfiguratorImpl>(clcp, false);
extra_request_params = config->ExtraRequestParams();
EXPECT_EQ("1", extra_request_params["testrequest"]);
EXPECT_EQ("dev", extra_request_params["testsource"]);
}
} // namespace component_updater } // namespace component_updater
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