Make sure channel ends with -channel.
Also changed to_more_stable_channel() to return true for arbitrary channels.
Bug: 72259103
Test: update_engine_unittests
Change-Id: Ifddbc5f28563c956241c69141523c5a73ba53151
diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc
index 6705c71..2de45de 100644
--- a/omaha_request_params_unittest.cc
+++ b/omaha_request_params_unittest.cc
@@ -170,6 +170,8 @@
EXPECT_FALSE(params_.IsValidChannel(""));
params_.image_props_.allow_arbitrary_channels = true;
EXPECT_TRUE(params_.IsValidChannel("some-channel"));
+ EXPECT_FALSE(params_.IsValidChannel("wrong-suffix"));
+ EXPECT_FALSE(params_.IsValidChannel(""));
}
TEST_F(OmahaRequestParamsTest, SetTargetChannelWorks) {
@@ -231,6 +233,12 @@
params_.image_props_.current_channel = "canary-channel";
params_.download_channel_ = "stable-channel";
EXPECT_TRUE(params_.to_more_stable_channel());
+ params_.image_props_.current_channel = "stable-channel";
+ EXPECT_FALSE(params_.to_more_stable_channel());
+ params_.download_channel_ = "beta-channel";
+ EXPECT_FALSE(params_.to_more_stable_channel());
+ params_.download_channel_ = "some-channel";
+ EXPECT_TRUE(params_.to_more_stable_channel());
}
TEST_F(OmahaRequestParamsTest, CollectECFWVersionsTest) {