| OLD | NEW |
| 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_store.h" | 5 #include "components/reading_list/ios/reading_list_store.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 TEST_F(ReadingListStoreTest, SaveOneUnread) { | 172 TEST_F(ReadingListStoreTest, SaveOneUnread) { |
| 173 ReadingListEntry entry(GURL("http://unread.example.com/"), "unread title"); | 173 ReadingListEntry entry(GURL("http://unread.example.com/"), "unread title"); |
| 174 reading_list_store_->SaveEntry(entry); | 174 reading_list_store_->SaveEntry(entry); |
| 175 AssertCounts(1, 0, 0, 0, 0); | 175 AssertCounts(1, 0, 0, 0, 0); |
| 176 syncer::EntityData* data = put_multimap_["http://unread.example.com/"].get(); | 176 syncer::EntityData* data = put_multimap_["http://unread.example.com/"].get(); |
| 177 const sync_pb::ReadingListSpecifics& specifics = | 177 const sync_pb::ReadingListSpecifics& specifics = |
| 178 data->specifics.reading_list(); | 178 data->specifics.reading_list(); |
| 179 EXPECT_EQ(specifics.title(), "unread title"); | 179 EXPECT_EQ(specifics.title(), "unread title"); |
| 180 EXPECT_EQ(specifics.url(), "http://unread.example.com/"); | 180 EXPECT_EQ(specifics.url(), "http://unread.example.com/"); |
| 181 EXPECT_EQ(specifics.status(), sync_pb::ReadingListSpecifics::UNREAD); | 181 EXPECT_EQ(specifics.status(), sync_pb::ReadingListSpecifics::UNSEEN); |
| 182 } | 182 } |
| 183 | 183 |
| 184 TEST_F(ReadingListStoreTest, SyncMergeOneEntry) { | 184 TEST_F(ReadingListStoreTest, SyncMergeOneEntry) { |
| 185 syncer::EntityDataMap remote_input; | 185 syncer::EntityDataMap remote_input; |
| 186 ReadingListEntry entry(GURL("http://read.example.com/"), "read title"); | 186 ReadingListEntry entry(GURL("http://read.example.com/"), "read title"); |
| 187 entry.SetRead(true); | 187 entry.SetRead(true); |
| 188 std::unique_ptr<sync_pb::ReadingListSpecifics> specifics = | 188 std::unique_ptr<sync_pb::ReadingListSpecifics> specifics = |
| 189 entry.AsReadingListSpecifics(); | 189 entry.AsReadingListSpecifics(); |
| 190 | 190 |
| 191 syncer::EntityData data; | 191 syncer::EntityData data; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 TEST_F(ReadingListStoreTest, ApplySyncChangesOneRemove) { | 282 TEST_F(ReadingListStoreTest, ApplySyncChangesOneRemove) { |
| 283 syncer::EntityChangeList delete_changes; | 283 syncer::EntityChangeList delete_changes; |
| 284 delete_changes.push_back( | 284 delete_changes.push_back( |
| 285 syncer::EntityChange::CreateDelete("http://read.example.com/")); | 285 syncer::EntityChange::CreateDelete("http://read.example.com/")); |
| 286 syncer::SyncError error = reading_list_store_->ApplySyncChanges( | 286 syncer::SyncError error = reading_list_store_->ApplySyncChanges( |
| 287 reading_list_store_->CreateMetadataChangeList(), delete_changes); | 287 reading_list_store_->CreateMetadataChangeList(), delete_changes); |
| 288 AssertCounts(0, 0, 0, 1, 0); | 288 AssertCounts(0, 0, 0, 1, 0); |
| 289 EXPECT_EQ(sync_removed_.size(), 1u); | 289 EXPECT_EQ(sync_removed_.size(), 1u); |
| 290 EXPECT_EQ(sync_removed_.count("http://read.example.com/"), 1u); | 290 EXPECT_EQ(sync_removed_.count("http://read.example.com/"), 1u); |
| 291 } | 291 } |
| OLD | NEW |