Return the error reason to the caller of SetTargetChannel.
This patch sends back to the caller an error message indicating why the
channel change didn't work.
Bug: 25595865
Test: Deployed on a device and attempted to change to "foo" channel. Error message lists available channels.
Test: FEATURES=test emerge-link update_engine
Change-Id: Idcc67d5c7878ce7af60652d7bf5bf81135325f97
diff --git a/mock_omaha_request_params.h b/mock_omaha_request_params.h
index 38d370c..5d5d47b 100644
--- a/mock_omaha_request_params.h
+++ b/mock_omaha_request_params.h
@@ -38,7 +38,7 @@
ON_CALL(*this, GetAppId())
.WillByDefault(testing::Invoke(
this, &MockOmahaRequestParams::FakeGetAppId));
- ON_CALL(*this, SetTargetChannel(testing::_, testing::_))
+ ON_CALL(*this, SetTargetChannel(testing::_, testing::_, testing::_))
.WillByDefault(testing::Invoke(
this, &MockOmahaRequestParams::FakeSetTargetChannel));
ON_CALL(*this, UpdateDownloadChannel())
@@ -51,8 +51,9 @@
MOCK_CONST_METHOD0(to_more_stable_channel, bool(void));
MOCK_CONST_METHOD0(GetAppId, std::string(void));
- MOCK_METHOD2(SetTargetChannel, bool(const std::string& channel,
- bool is_powerwash_allowed));
+ MOCK_METHOD3(SetTargetChannel, bool(const std::string& channel,
+ bool is_powerwash_allowed,
+ std::string* error));
MOCK_METHOD0(UpdateDownloadChannel, void(void));
MOCK_CONST_METHOD0(is_powerwash_allowed, bool(void));
MOCK_CONST_METHOD0(IsUpdateUrlOfficial, bool(void));
@@ -69,8 +70,11 @@
}
bool FakeSetTargetChannel(const std::string& channel,
- bool is_powerwash_allowed) {
- return OmahaRequestParams::SetTargetChannel(channel, is_powerwash_allowed);
+ bool is_powerwash_allowed,
+ std::string* error) {
+ return OmahaRequestParams::SetTargetChannel(channel,
+ is_powerwash_allowed,
+ error);
}
void FakeUpdateDownloadChannel() {