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

Unified Diff: components/reading_list/ios/reading_list_model_unittest.mm

Issue 2690003004: [Reading List iOS] Collapse whitespace on item title. (Closed)
Patch Set: use url as title Created 3 years, 10 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: components/reading_list/ios/reading_list_model_unittest.mm
diff --git a/components/reading_list/ios/reading_list_model_unittest.mm b/components/reading_list/ios/reading_list_model_unittest.mm
index d92b042518d9a962183b498f20a203b41cb9332b..bbdb4c91deed32143e2873dc42307cb21292b3b2 100644
--- a/components/reading_list/ios/reading_list_model_unittest.mm
+++ b/components/reading_list/ios/reading_list_model_unittest.mm
@@ -683,4 +683,18 @@ TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) {
AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0);
}
+// Tests that new line characters and spaces are collapsed in title.
+TEST_F(ReadingListModelTest, TestTrimmingTitle) {
+ const GURL gurl("http://example.com");
+ std::string title = "\n This\ttitle \n contains new line \n characters ";
+ model_->AddEntry(gurl, title, reading_list::ADDED_VIA_CURRENT_APP);
+ model_->SetReadStatus(gurl, true);
+ const ReadingListEntry* entry = model_->GetEntryByURL(gurl);
+ EXPECT_EQ(entry->Title(), "This title contains new line characters");
+ model_->SetEntryTitle(gurl, "test");
+ EXPECT_EQ(entry->Title(), "test");
+ model_->SetEntryTitle(gurl, title);
+ EXPECT_EQ(entry->Title(), "This title contains new line characters");
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698