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

Side by Side 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 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 "components/reading_list/ios/reading_list_model.h" 5 #include "components/reading_list/ios/reading_list_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #import "base/test/ios/wait_util.h" 9 #import "base/test/ios/wait_util.h"
10 #include "components/reading_list/ios/reading_list_model_impl.h" 10 #include "components/reading_list/ios/reading_list_model_impl.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 EXPECT_EQ(distilled_url, entry->DistilledURL()); 676 EXPECT_EQ(distilled_url, entry->DistilledURL());
677 } 677 }
678 678
679 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed. 679 // Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed.
680 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) { 680 TEST_F(ReadingListModelTest, CallbackModelBeingDeleted) {
681 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0); 681 AssertObserverCount(1, 0, 0, 0, 0, 0, 0, 0, 0);
682 model_.reset(); 682 model_.reset();
683 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0); 683 AssertObserverCount(1, 0, 0, 1, 0, 0, 0, 0, 0);
684 } 684 }
685 685
686 // Tests that new line characters and spaces are collapsed in title.
687 TEST_F(ReadingListModelTest, TestTrimmingTitle) {
688 const GURL gurl("http://example.com");
689 std::string title = "\n This\ttitle \n contains new line \n characters ";
690 model_->AddEntry(gurl, title, reading_list::ADDED_VIA_CURRENT_APP);
691 model_->SetReadStatus(gurl, true);
692 const ReadingListEntry* entry = model_->GetEntryByURL(gurl);
693 EXPECT_EQ(entry->Title(), "This title contains new line characters");
694 model_->SetEntryTitle(gurl, "test");
695 EXPECT_EQ(entry->Title(), "test");
696 model_->SetEntryTitle(gurl, title);
697 EXPECT_EQ(entry->Title(), "This title contains new line characters");
698 }
699
686 } // namespace 700 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698