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

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

Issue 2525663002: Refactor Reading List Model to use URL as key. (Closed)
Patch Set: format Created 4 years, 1 month 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: ios/chrome/browser/reading_list/reading_list_store_unittest.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_store_unittest.cc b/ios/chrome/browser/reading_list/reading_list_store_unittest.cc
index 5edc178e39d25f1568a14166c94e85d16cd0ab74..f2cacbb400b2a467c5d4f0bf598d9b082d5c153c 100644
--- a/ios/chrome/browser/reading_list/reading_list_store_unittest.cc
+++ b/ios/chrome/browser/reading_list/reading_list_store_unittest.cc
@@ -114,14 +114,12 @@ class ReadingListStoreTest : public testing::Test,
}
// These three mathods handle callbacks from a ReadingListStore.
- void StoreLoaded(std::unique_ptr<ReadingListEntries> unread,
- std::unique_ptr<ReadingListEntries> read) override {}
+ void StoreLoaded(std::unique_ptr<ReadingListEntries> entries) override {}
// Handle sync events.
- void SyncAddEntry(std::unique_ptr<ReadingListEntry> entry,
- bool read) override {
+ void SyncAddEntry(std::unique_ptr<ReadingListEntry> entry) override {
sync_add_called_++;
- sync_added_[entry->URL().spec()] = read;
+ sync_added_[entry->URL().spec()] = entry->IsRead();
}
void SyncRemoveEntry(const GURL& gurl) override {
@@ -129,11 +127,11 @@ class ReadingListStoreTest : public testing::Test,
sync_removed_.insert(gurl.spec());
}
- ReadingListEntry* SyncMergeEntry(std::unique_ptr<ReadingListEntry> entry,
- bool read) override {
+ ReadingListEntry* SyncMergeEntry(
+ std::unique_ptr<ReadingListEntry> entry) override {
sync_merge_called_++;
- sync_merged_[entry->URL().spec()] = read;
- return model_->SyncMergeEntry(std::move(entry), read);
+ sync_merged_[entry->URL().spec()] = entry->IsRead();
+ return model_->SyncMergeEntry(std::move(entry));
}
// In memory model type store needs a MessageLoop.
@@ -161,7 +159,8 @@ TEST_F(ReadingListStoreTest, CheckEmpties) {
TEST_F(ReadingListStoreTest, SaveOneRead) {
ReadingListEntry entry(GURL("http://read.example.com/"), "read title");
- reading_list_store_->SaveEntry(entry, true);
+ entry.SetRead(true);
+ reading_list_store_->SaveEntry(&entry);
AssertCounts(1, 0, 0, 0, 0);
syncer::EntityData* data = put_multimap_["http://read.example.com/"].get();
const sync_pb::ReadingListSpecifics& specifics =
@@ -173,7 +172,7 @@ TEST_F(ReadingListStoreTest, SaveOneRead) {
TEST_F(ReadingListStoreTest, SaveOneUnread) {
ReadingListEntry entry(GURL("http://unread.example.com/"), "unread title");
- reading_list_store_->SaveEntry(entry, false);
+ reading_list_store_->SaveEntry(&entry);
AssertCounts(1, 0, 0, 0, 0);
syncer::EntityData* data = put_multimap_["http://unread.example.com/"].get();
const sync_pb::ReadingListSpecifics& specifics =
@@ -186,8 +185,9 @@ TEST_F(ReadingListStoreTest, SaveOneUnread) {
TEST_F(ReadingListStoreTest, SyncMergeOneEntry) {
syncer::EntityDataMap remote_input;
ReadingListEntry entry(GURL("http://read.example.com/"), "read title");
+ entry.SetRead(true);
std::unique_ptr<sync_pb::ReadingListSpecifics> specifics =
- entry.AsReadingListSpecifics(true);
+ entry.AsReadingListSpecifics();
syncer::EntityData data;
data.client_tag_hash = "http://read.example.com/";
@@ -208,8 +208,9 @@ TEST_F(ReadingListStoreTest, SyncMergeOneEntry) {
TEST_F(ReadingListStoreTest, ApplySyncChangesOneAdd) {
syncer::EntityDataMap remote_input;
ReadingListEntry entry(GURL("http://read.example.com/"), "read title");
+ entry.SetRead(true);
std::unique_ptr<sync_pb::ReadingListSpecifics> specifics =
- entry.AsReadingListSpecifics(true);
+ entry.AsReadingListSpecifics();
syncer::EntityData data;
data.client_tag_hash = "http://read.example.com/";
*data.specifics.mutable_reading_list() = *specifics;
@@ -234,8 +235,9 @@ TEST_F(ReadingListStoreTest, ApplySyncChangesOneMerge) {
ReadingListEntry new_entry(GURL("http://unread.example.com/"),
"unread title");
+ new_entry.SetRead(true);
std::unique_ptr<sync_pb::ReadingListSpecifics> specifics =
- new_entry.AsReadingListSpecifics(true);
+ new_entry.AsReadingListSpecifics();
syncer::EntityData data;
data.client_tag_hash = "http://unread.example.com/";
*data.specifics.mutable_reading_list() = *specifics;
@@ -261,7 +263,7 @@ TEST_F(ReadingListStoreTest, ApplySyncChangesOneIgnored) {
AssertCounts(0, 0, 0, 0, 0);
std::unique_ptr<sync_pb::ReadingListSpecifics> specifics =
- old_entry.AsReadingListSpecifics(true);
+ old_entry.AsReadingListSpecifics();
syncer::EntityData data;
data.client_tag_hash = "http://unread.example.com/";
*data.specifics.mutable_reading_list() = *specifics;

Powered by Google App Engine
This is Rietveld 408576698