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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/reading_list/reading_list_entry.h" 5 #include "ios/chrome/browser/reading_list/reading_list_entry.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT_EQ(2, e.TimeUntilNextTry().InSeconds()); 123 ASSERT_EQ(2, e.TimeUntilNextTry().InSeconds());
124 124
125 // Action. 125 // Action.
126 e.SetDistilledURL(GURL("http://example.com")); 126 e.SetDistilledURL(GURL("http://example.com"));
127 127
128 // Test. 128 // Test.
129 EXPECT_EQ(0, e.TimeUntilNextTry().InSeconds()); 129 EXPECT_EQ(0, e.TimeUntilNextTry().InSeconds());
130 e.SetDistilledState(ReadingListEntry::ERROR); 130 e.SetDistilledState(ReadingListEntry::ERROR);
131 EXPECT_EQ(1, e.TimeUntilNextTry().InSeconds()); 131 EXPECT_EQ(1, e.TimeUntilNextTry().InSeconds());
132 } 132 }
133
134 // Tests that the failed download counter is incremented when the state change
135 // from non-error to error.
136 TEST(ReadingListEntry, FailedDownloadCounter) {
137 ReadingListEntry e(GURL("http://example.com"), "bar");
138
139 ASSERT_EQ(0, e.FailedDownloadCounter());
140
141 e.SetDistilledState(ReadingListEntry::ERROR);
142 EXPECT_EQ(1, e.FailedDownloadCounter());
143 e.SetDistilledState(ReadingListEntry::WILL_RETRY);
144 EXPECT_EQ(1, e.FailedDownloadCounter());
145
146 e.SetDistilledState(ReadingListEntry::PROCESSING);
147 EXPECT_EQ(1, e.FailedDownloadCounter());
148
149 e.SetDistilledState(ReadingListEntry::WILL_RETRY);
150 EXPECT_EQ(2, e.FailedDownloadCounter());
151 e.SetDistilledState(ReadingListEntry::ERROR);
152 EXPECT_EQ(2, e.FailedDownloadCounter());
153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698