Classify errors and advance URL index according to the error code.

In CL https://gerrit.chromium.org/gerrit/39638, we always incremented
the URL index irrespective of the error code. That would cause the first
URL to be given up too quickly in favor of the second one even for
transient errors such as when user closes a lid and reopens after some
time.

The right behavior in this case is to just count those failures towards
the URL and only after repeated failures with no progress should we
advance the URL index.

This CL implements this logic and completes the multiple URL-related
work items outlined in the design doc.

BUG=chromium-os:37206
TEST=Tested all uses cases on my ZGB. Added and updated unit tests.

Change-Id: Ida0cfbfeb9bfab732144049d1b27e3b8958bc252
Reviewed-on: https://gerrit.chromium.org/gerrit/39885
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/action_processor.h b/action_processor.h
index 3f8dcee..ba0e512 100644
--- a/action_processor.h
+++ b/action_processor.h
@@ -64,7 +64,13 @@
   kActionCodeDownloadOperationHashMissingError = 38,
   kActionCodeDownloadMetadataSignatureMissingError = 39,
 
-  // Any code above this is sent to both Omaha and UMA as-is.
+  // Note: When adding new error codes, please remember to add the
+  // error into one of the buckets in PayloadState::UpdateFailed method so
+  // that the retries across URLs and the payload back-off mechanism work
+  // correctly for those new error codes.
+
+  // Any code above this is sent to both Omaha and UMA as-is, except
+  // kActionCodeOmahaErrorInHTTPResponse (see error code 2000 for more details).
   // Codes/flags below this line is sent only to Omaha and not to UMA.
 
   // kActionCodeUmaReportedMax is not an error code per se, it's just the count