libchromeos: Added GetMapKeysAsVector() and unit tests
Added chromeos::GetMapKeysAsVector() helper function to obtain
the map as a vector<> instead of a set<>. Also added unit tests
for the map_utils.
BUG=None
TEST=FEATURES=test emerge-link libchromeos buffet
Change-Id: I689a3b0e2c2ddcb532101a5d0750aa789eb2bbda
Reviewed-on: https://chromium-review.googlesource.com/235714
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/test_daemon/main.cc b/buffet/test_daemon/main.cc
index ec26a82..4afc35d 100644
--- a/buffet/test_daemon/main.cc
+++ b/buffet/test_daemon/main.cc
@@ -77,9 +77,8 @@
printf(" ID: %s\n", command->id().c_str());
printf(" status: %s\n", command->status().c_str());
printf(" # of parameters: %" PRIuS "\n", command->parameters().size());
- auto set = chromeos::GetMapKeys(command->parameters());
- std::string param_names = chromeos::string_utils::Join(
- ", ", std::vector<std::string>(set.begin(), set.end()));
+ auto keys = chromeos::GetMapKeysAsVector(command->parameters());
+ std::string param_names = chromeos::string_utils::Join(", ", keys);
printf(" parameter names: %s\n", param_names.c_str());
OnCommandProgress(command, 0);
}