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

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

Issue 2436743002: Add GetEntryFromURL method to the ReadingListModel. (Closed)
Patch Set: Fixed test. 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_impl.cc ('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 873b3304700e82d573d009913152ebbfb98144f2..ed51c3c18a67bcc419abf9f6d25ab51a966df58d 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,24 @@ TEST_F(ReadingListModelTest, ReadEntry) {
EXPECT_EQ("sample", other_entry.Title());
}
+TEST_F(ReadingListModelTest, EntryFromURL) {
+ GURL url1("http://example.com");
+ GURL url2("http://example2.com");
+ std::string entry1_title = "foo bar qux";
+ model_->AddEntry(url1, entry1_title);
+
+ const ReadingListEntry* entry1 = model_->GetEntryFromURL(url1);
+ EXPECT_NE(nullptr, entry1);
+ EXPECT_EQ(entry1_title, entry1->Title());
+ model_->MarkReadByURL(url1);
+ entry1 = model_->GetEntryFromURL(url1);
+ EXPECT_NE(nullptr, entry1);
+ EXPECT_EQ(entry1_title, entry1->Title());
+
+ const ReadingListEntry* entry2 = model_->GetEntryFromURL(url2);
+ EXPECT_EQ(nullptr, entry2);
+}
+
TEST_F(ReadingListModelTest, UnreadEntry) {
// Setup.
model_->AddEntry(GURL("http://example.com"), "sample");
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_model_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698