Add Installer.PayloadFormat metric

Adds a new PayloadFormat metric with three different values: Delta, Full
and ForcedFull. The metric is send whenever an update is applied successfully
indicating the type of the used payload. The difference between Full and
ForcedFull is that in the ForcedFull, the request sent to omaha included a
directive saying that a delta payload wasn't accepted, where a Full payload
is one where a delta payload was accepted but a Full payload was provided.

BUG=chromium:225977
TEST=cros_workon_make update_engine --test # Three tests added, one for each condition.

Change-Id: If44cd96df325d320ed327114cc5e5de3d34a5c62
Reviewed-on: https://gerrit.chromium.org/gerrit/60318
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/utils.cc b/utils.cc
index 62581f4..2bcc311 100644
--- a/utils.cc
+++ b/utils.cc
@@ -802,7 +802,7 @@
   return (b ? "true" : "false");
 }
 
-std::string ToString(DownloadSource source) {
+string ToString(DownloadSource source) {
   switch (source) {
     case kDownloadSourceHttpsServer: return "HttpsServer";
     case kDownloadSourceHttpServer:  return "HttpServer";
@@ -814,6 +814,19 @@
   return "Unknown";
 }
 
+string ToString(PayloadType payload_type) {
+  switch (payload_type) {
+    case kPayloadTypeDelta:      return "Delta";
+    case kPayloadTypeFull:       return "Full";
+    case kPayloadTypeForcedFull: return "ForcedFull";
+    case kNumPayloadTypes:       return "Unknown";
+    // Don't add a default case to let the compiler warn about newly added
+    // payload types which should be added here.
+  }
+
+  return "Unknown";
+}
+
 ErrorCode GetBaseErrorCode(ErrorCode code) {
   // Ignore the higher order bits in the code by applying the mask as
   // we want the enumerations to be in the small contiguous range