buffet: Fix command progress update JSON for GCD server
GCD server expects command progress updates to contain a device-specific
JSON object, while buffet was providing just an integer. Make GCD server
happy by creating an object instead by sticking another "progress" property
as in {"progress":{"progress":100}}.
Also added some unit tests to cover the rest of UpdateCommand notifications.
BUG=brillo:779
TEST=`FEATURES=test emerge-link libchromeos buffet`
Change-Id: I210de62abae7fa1c357449b0c07b5298e8606ec0
Reviewed-on: https://chromium-review.googlesource.com/264867
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_instance_unittest.cc b/buffet/commands/command_instance_unittest.cc
index 48d54b9..e1d874b 100644
--- a/buffet/commands/command_instance_unittest.cc
+++ b/buffet/commands/command_instance_unittest.cc
@@ -209,7 +209,7 @@
json->MergeDictionary(CreateDictionaryValue(R"({
'id': 'testId',
- 'progress': 15,
+ 'progress': {'progress': 15},
'state': 'inProgress',
'results': {'testResult': 17}
})").get());