Add Installer.[Full]PayloadAttemptNumber

This patch adds two new metrics with the attempt number of the
current payload. The difference with other similar metrics, like
Installer.AttemptsCount.Total is that this metric is send every
time the PayloadAttemptNumber is incremented, tracking also
abandoned payload attempts.

BUG=chromium:225973
TEST=cros_workon_make update_engine --test

Change-Id: I96828fdf0512bac0e04c63a40383ac46143c5908
Reviewed-on: https://gerrit.chromium.org/gerrit/61344
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/payload_state_unittest.cc b/payload_state_unittest.cc
index f94b756..f7665ae 100644
--- a/payload_state_unittest.cc
+++ b/payload_state_unittest.cc
@@ -496,6 +496,11 @@
 
   SetupPayloadStateWith2Urls("Hash8593", true, &payload_state, &response);
 
+  EXPECT_CALL(*mock_system_state.mock_metrics_lib(), SendToUMA(
+      "Installer.PayloadAttemptNumber", 1, _, _, _));
+  EXPECT_CALL(*mock_system_state.mock_metrics_lib(), SendToUMA(
+      "Installer.FullPayloadAttemptNumber", 1, _, _, _));
+
   // This should just advance the payload attempt number;
   EXPECT_EQ(0, payload_state.GetPayloadAttemptNumber());
   EXPECT_EQ(0, payload_state.GetFullPayloadAttemptNumber());
@@ -536,6 +541,13 @@
 
   SetupPayloadStateWith2Urls("Hash8593", true, &payload_state, &response);
 
+  // Metrics for Full payload attempt number is not sent with Delta payloads.
+  EXPECT_CALL(*mock_system_state.mock_metrics_lib(), SendToUMA(
+      "Installer.PayloadAttemptNumber", 1, _, _, _));
+  EXPECT_CALL(*mock_system_state.mock_metrics_lib(), SendToUMA(
+      "Installer.FullPayloadAttemptNumber", _, _, _, _))
+      .Times(0);
+
   // This should just advance the payload attempt number;
   EXPECT_EQ(0, payload_state.GetPayloadAttemptNumber());
   EXPECT_EQ(0, payload_state.GetFullPayloadAttemptNumber());