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

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

Issue 2434993002: Add methods to Reading List Model (Closed)
Patch Set: Remove ClearModelForTest Created 4 years, 2 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
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_model_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/reading_list/reading_list_model_unittest.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_model_unittest.cc b/ios/chrome/browser/reading_list/reading_list_model_unittest.cc
index e27ad4b9005049fe7ce56464fd67545f9024441d..873b3304700e82d573d009913152ebbfb98144f2 100644
--- a/ios/chrome/browser/reading_list/reading_list_model_unittest.cc
+++ b/ios/chrome/browser/reading_list/reading_list_model_unittest.cc
@@ -171,6 +171,28 @@ TEST_F(ReadingListModelTest, ReadEntry) {
EXPECT_EQ("sample", other_entry.Title());
}
+TEST_F(ReadingListModelTest, UnreadEntry) {
+ // Setup.
+ model_->AddEntry(GURL("http://example.com"), "sample");
+ model_->MarkReadByURL(GURL("http://example.com"));
+ ClearCounts();
+ ASSERT_EQ(0ul, model_->unread_size());
+ ASSERT_EQ(1ul, model_->read_size());
+
+ // Action.
+ model_->MarkUnreadByURL(GURL("http://example.com"));
+
+ // Tests.
+ AssertObserverCount(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+ EXPECT_EQ(1ul, model_->unread_size());
+ EXPECT_EQ(0ul, model_->read_size());
+ EXPECT_TRUE(model_->HasUnseenEntries());
+
+ const ReadingListEntry& other_entry = model_->GetUnreadEntryAtIndex(0);
+ EXPECT_EQ(GURL("http://example.com"), other_entry.URL());
+ EXPECT_EQ("sample", other_entry.Title());
+}
+
TEST_F(ReadingListModelTest, BatchUpdates) {
auto token = model_->BeginBatchUpdates();
AssertObserverCount(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_model_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698