Chromium Code Reviews| Index: components/reading_list/ios/reading_list_entry_unittest.cc |
| diff --git a/components/reading_list/ios/reading_list_entry_unittest.cc b/components/reading_list/ios/reading_list_entry_unittest.cc |
| index 61f486ca83af0d6dfdbc8c29eb58ec0160935675..159a93749c9bd18d9fa0f0127655d53fb4bcb44d 100644 |
| --- a/components/reading_list/ios/reading_list_entry_unittest.cc |
| +++ b/components/reading_list/ios/reading_list_entry_unittest.cc |
| @@ -317,24 +317,45 @@ TEST(ReadingListEntry, FromReadingListLocal) { |
| } |
| // Tests that the merging of two ReadingListEntry. |
|
gambard
2016/12/06 17:02:22
Update comment
Olivier
2016/12/06 17:16:21
Done.
|
| -TEST(ReadingListEntry, MergeLocalStateFrom) { |
| +TEST(ReadingListEntry, MergeWithEntry) { |
| ReadingListEntry local_entry(GURL("http://example.com/"), "title"); |
| + local_entry.SetDistilledState(ReadingListEntry::ERROR); |
| base::Time next_call = base::Time::Now() + local_entry.TimeUntilNextTry(); |
| int64_t local_update_time_us = local_entry.UpdateTime(); |
| - local_entry.SetDistilledPath(base::FilePath("distilled/page.html")); |
| - ReadingListEntry sync_entry(GURL("http://example2.com/"), "title2"); |
| + ReadingListEntry sync_entry(GURL("http://example.com/"), "title2"); |
| sync_entry.SetDistilledState(ReadingListEntry::ERROR); |
| int64_t sync_update_time_us = sync_entry.UpdateTime(); |
| EXPECT_NE(local_update_time_us, sync_update_time_us); |
| - sync_entry.MergeLocalStateFrom(local_entry); |
| - EXPECT_EQ(sync_entry.URL().spec(), "http://example2.com/"); |
| - EXPECT_EQ(sync_entry.Title(), "title2"); |
| - EXPECT_EQ(sync_entry.UpdateTime(), sync_update_time_us); |
| - EXPECT_EQ(sync_entry.FailedDownloadCounter(), 0); |
| - EXPECT_EQ(sync_entry.DistilledState(), ReadingListEntry::PROCESSED); |
| - EXPECT_EQ(sync_entry.DistilledPath().value(), "distilled/page.html"); |
| - base::Time sync_next_call = base::Time::Now() + sync_entry.TimeUntilNextTry(); |
| - base::TimeDelta delta = next_call - sync_next_call; |
| + local_entry.MergeWithEntry(sync_entry); |
| + EXPECT_EQ(local_entry.URL().spec(), "http://example.com/"); |
| + EXPECT_EQ(local_entry.Title(), "title2"); |
| + EXPECT_FALSE(local_entry.HasBeenSeen()); |
| + EXPECT_EQ(local_entry.UpdateTime(), sync_update_time_us); |
| + EXPECT_EQ(local_entry.FailedDownloadCounter(), 1); |
| + EXPECT_EQ(local_entry.DistilledState(), ReadingListEntry::ERROR); |
| + base::Time merge_next_call = |
| + base::Time::Now() + local_entry.TimeUntilNextTry(); |
| + base::TimeDelta delta = merge_next_call - next_call; |
| EXPECT_NEAR(delta.InMillisecondsRoundedUp(), 0, 10); |
| } |
| + |
| +// Tests that the merging of two ReadingListEntry. |
|
gambard
2016/12/06 17:02:22
Update comment
Olivier
2016/12/06 17:16:21
Done.
|
| +TEST(ReadingListEntry, MergeWithEntrySeen) { |
| + ReadingListEntry local_entry(GURL("http://example.com/"), "title"); |
| + local_entry.SetRead(true); |
| + int64_t local_update_time_us = local_entry.UpdateTime(); |
| + local_entry.SetDistilledPath(base::FilePath("distilled/page.html")); |
| + |
| + ReadingListEntry sync_entry(GURL("http://example.com/"), "title2"); |
| + int64_t sync_update_time_us = sync_entry.UpdateTime(); |
| + EXPECT_NE(local_update_time_us, sync_update_time_us); |
| + local_entry.MergeWithEntry(sync_entry); |
| + EXPECT_EQ(local_entry.URL().spec(), "http://example.com/"); |
| + EXPECT_EQ(local_entry.Title(), "title2"); |
| + EXPECT_TRUE(local_entry.HasBeenSeen()); |
| + EXPECT_EQ(local_entry.UpdateTime(), sync_update_time_us); |
| + EXPECT_EQ(local_entry.FailedDownloadCounter(), 0); |
| + EXPECT_EQ(local_entry.DistilledState(), ReadingListEntry::PROCESSED); |
| + EXPECT_EQ(local_entry.DistilledPath().value(), "distilled/page.html"); |
| +} |