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()); |
+} |