buffet: Add abstract CloudCommandUpdateInterface
Added a simple interface for DeviceRegistrationInfo class that just deals
with updating the command status on the cloud without having to use the
DeviceRegistrationInfo class directly.
This will allow to mock out that class more easily in the tests for
subsequent CLs.
BUG=brillo:1202
TEST=`FEATURES=test emerge-link buffet`
Change-Id: I04b931bb2c54e18206e2e3cf588b2e2ce86d9507
Reviewed-on: https://chromium-review.googlesource.com/282260
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/device_registration_info.h b/buffet/device_registration_info.h
index 43c70a4..bce8c6f 100644
--- a/buffet/device_registration_info.h
+++ b/buffet/device_registration_info.h
@@ -22,6 +22,7 @@
#include <chromeos/http/http_transport.h>
#include "buffet/buffet_config.h"
+#include "buffet/commands/cloud_command_update_interface.h"
#include "buffet/commands/command_manager.h"
#include "buffet/notification/notification_channel.h"
#include "buffet/notification/notification_delegate.h"
@@ -50,7 +51,8 @@
extern const char kErrorDomainGCDServer[];
// The DeviceRegistrationInfo class represents device registration information.
-class DeviceRegistrationInfo : public NotificationDelegate {
+class DeviceRegistrationInfo : public NotificationDelegate,
+ public CloudCommandUpdateInterface {
public:
using OnRegistrationChangedCallback =
base::Callback<void(RegistrationStatus)>;
@@ -129,11 +131,11 @@
std::string RegisterDevice(const std::string& ticket_id,
chromeos::ErrorPtr* error);
- // Updates a command.
+ // Updates a command (override from buffet::CloudCommandUpdateInterface).
void UpdateCommand(const std::string& command_id,
const base::DictionaryValue& command_patch,
const base::Closure& on_success,
- const base::Closure& on_error);
+ const base::Closure& on_error) override;
// Updates basic device information.
bool UpdateDeviceInfo(const std::string& name,