Return 'component' in command JSON

BUG: 26730593
Change-Id: I7661511669de35ff0e67d1da06fbd5ff5df510e0
Reviewed-on: https://weave-review.googlesource.com/2887
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/commands/command_instance.cc b/src/commands/command_instance.cc
index 590bbb1..dfc3fbd 100644
--- a/src/commands/command_instance.cc
+++ b/src/commands/command_instance.cc
@@ -220,6 +220,7 @@
 
   json->SetString(commands::attributes::kCommand_Id, id_);
   json->SetString(commands::attributes::kCommand_Name, name_);
+  json->SetString(commands::attributes::kCommand_Component, component_);
   json->Set(commands::attributes::kCommand_Parameters, parameters_.DeepCopy());
   json->Set(commands::attributes::kCommand_Progress, progress_.DeepCopy());
   json->Set(commands::attributes::kCommand_Results, results_.DeepCopy());
diff --git a/src/commands/command_instance_unittest.cc b/src/commands/command_instance_unittest.cc
index 803d5b4..e06332f 100644
--- a/src/commands/command_instance_unittest.cc
+++ b/src/commands/command_instance_unittest.cc
@@ -103,6 +103,7 @@
 
 TEST(CommandInstanceTest, ToJson) {
   auto json = CreateDictionaryValue(R"({
+    'component': 'testComponent',
     'name': 'robot.jump',
     'parameters': {
       'height': 53,
@@ -121,6 +122,7 @@
                                  nullptr));
 
   json->MergeDictionary(CreateDictionaryValue(R"({
+    'component': 'testComponent',
     'id': 'testId',
     'progress': {'progress': 15},
     'state': 'done',
@@ -135,6 +137,7 @@
 
 TEST(CommandInstanceTest, ToJsonError) {
   auto json = CreateDictionaryValue(R"({
+    'component': 'testComponent',
     'name': 'base.reboot',
     'parameters': {}
   })");
@@ -147,6 +150,7 @@
   instance->Abort(error.get(), nullptr);
 
   json->MergeDictionary(CreateDictionaryValue(R"({
+    'component': 'testComponent',
     'id': 'testId',
     'state': 'aborted',
     'progress': {},