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/mock_system_state.h b/mock_system_state.h
index 2f82345..bb6ee98 100644
--- a/mock_system_state.h
+++ b/mock_system_state.h
@@ -41,7 +41,7 @@
     return prefs_;
   }
 
-  virtual PayloadState* payload_state() {
+  virtual PayloadStateInterface* payload_state() {
     return &mock_payload_state_;
   }
 
@@ -70,7 +70,7 @@
   // These are Mock objects or objects we own.
   MetricsLibraryMock mock_metrics_lib_;
   testing::NiceMock<PrefsMock> mock_prefs_;
-  MockPayloadState mock_payload_state_;
+  testing::NiceMock<MockPayloadState> mock_payload_state_;
 
   // These are pointers to objects which caller can override.
   PrefsInterface* prefs_;