Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: ios/chrome/browser/reading_list/reading_list_entry_unittest.cc

Issue 2351113003: Reading list downloader retries on recoverable error (Closed)
Patch Set: Use weak pointer Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/reading_list/reading_list_entry_unittest.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_entry_unittest.cc b/ios/chrome/browser/reading_list/reading_list_entry_unittest.cc
index 6539246a7ce72d93c17f2eedb1af6c5581862d30..579e464f18441fe28ae38c4e45ca6232c29b3c37 100644
--- a/ios/chrome/browser/reading_list/reading_list_entry_unittest.cc
+++ b/ios/chrome/browser/reading_list/reading_list_entry_unittest.cc
@@ -130,3 +130,24 @@ TEST(ReadingListEntry, ResetTimeUntilNextTry) {
e.SetDistilledState(ReadingListEntry::ERROR);
EXPECT_EQ(1, e.TimeUntilNextTry().InSeconds());
}
+
+// Tests that the failed download counter is incremented when the state change
+// from non-error to error.
+TEST(ReadingListEntry, FailedDownloadCounter) {
+ ReadingListEntry e(GURL("http://example.com"), "bar");
+
+ ASSERT_EQ(0, e.FailedDownloadCounter());
+
+ e.SetDistilledState(ReadingListEntry::ERROR);
+ EXPECT_EQ(1, e.FailedDownloadCounter());
+ e.SetDistilledState(ReadingListEntry::WILL_RETRY);
+ EXPECT_EQ(1, e.FailedDownloadCounter());
+
+ e.SetDistilledState(ReadingListEntry::PROCESSING);
+ EXPECT_EQ(1, e.FailedDownloadCounter());
+
+ e.SetDistilledState(ReadingListEntry::WILL_RETRY);
+ EXPECT_EQ(2, e.FailedDownloadCounter());
+ e.SetDistilledState(ReadingListEntry::ERROR);
+ EXPECT_EQ(2, e.FailedDownloadCounter());
+}

Powered by Google App Engine
This is Rietveld 408576698