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/dbus_service_unittest.cc b/dbus_service_unittest.cc
index 4ea7eec..db63b2d 100644
--- a/dbus_service_unittest.cc
+++ b/dbus_service_unittest.cc
@@ -80,7 +80,7 @@
EXPECT_CALL(*mock_update_attempter_, RefreshDevicePolicy());
// If SetTargetChannel is called it means the policy check passed.
EXPECT_CALL(*fake_system_state_.mock_request_params(),
- SetTargetChannel("stable-channel", true))
+ SetTargetChannel("stable-channel", true, _))
.WillOnce(Return(true));
EXPECT_TRUE(dbus_service_.SetChannel(&error_, "stable-channel", true));
ASSERT_EQ(nullptr, error_);
@@ -93,7 +93,7 @@
EXPECT_CALL(mock_device_policy, GetReleaseChannelDelegated(_))
.WillOnce(DoAll(SetArgumentPointee<0>(true), Return(true)));
EXPECT_CALL(*fake_system_state_.mock_request_params(),
- SetTargetChannel("beta-channel", true))
+ SetTargetChannel("beta-channel", true, _))
.WillOnce(Return(true));
EXPECT_TRUE(dbus_service_.SetChannel(&error_, "beta-channel", true));
@@ -105,7 +105,7 @@
TEST_F(UpdateEngineServiceTest, SetChannelWithInvalidChannel) {
EXPECT_CALL(*mock_update_attempter_, RefreshDevicePolicy());
EXPECT_CALL(*fake_system_state_.mock_request_params(),
- SetTargetChannel("foo-channel", true)).WillOnce(Return(false));
+ SetTargetChannel("foo-channel", true, _)).WillOnce(Return(false));
EXPECT_FALSE(dbus_service_.SetChannel(&error_, "foo-channel", true));
ASSERT_NE(nullptr, error_);