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 bbdb4c91deed32143e2873dc42307cb21292b3b2..4d3ad7dc0eeacb7f7898c2fe44a97fdd21720d68 100644 |
--- a/components/reading_list/ios/reading_list_model_unittest.mm |
+++ b/components/reading_list/ios/reading_list_model_unittest.mm |
@@ -19,6 +19,11 @@ namespace { |
const GURL callback_url("http://example.com"); |
const std::string callback_title("test title"); |
+// Returns the number of microseconds since Jan 1st 1970. |
+int64_t Now() { |
+ return (base::Time::Now() - base::Time::UnixEpoch()).InMicroseconds(); |
+} |
+ |
class TestReadingListStorageObserver { |
public: |
virtual void ReadingListDidSaveEntry() = 0; |
@@ -383,8 +388,11 @@ TEST_F(ReadingListModelTest, SyncMergeEntry) { |
reading_list::ADDED_VIA_CURRENT_APP); |
const base::FilePath distilled_path("distilled/page.html"); |
const GURL distilled_url("http://example.com/distilled"); |
+ int64_t size = 50; |
+ int64_t before = Now(); |
model_->SetEntryDistilledInfo(GURL("http://example.com"), distilled_path, |
- distilled_url); |
+ distilled_url, size); |
+ int64_t after = Now(); |
const ReadingListEntry* local_entry = |
model_->GetEntryByURL(GURL("http://example.com")); |
int64_t local_update_time = local_entry->UpdateTime(); |
@@ -408,6 +416,9 @@ TEST_F(ReadingListModelTest, SyncMergeEntry) { |
EXPECT_EQ(merged_entry->DistilledPath(), |
base::FilePath("distilled/page.html")); |
EXPECT_EQ(merged_entry->UpdateTime(), sync_update_time); |
+ EXPECT_EQ(size, merged_entry->DistillationSize()); |
+ EXPECT_GE(merged_entry->DistillationTime(), before); |
+ EXPECT_GE(after, merged_entry->DistillationTime()); |
} |
// Tests deleting entry. |
@@ -624,12 +635,18 @@ TEST_F(ReadingListModelTest, UpdateDistilledInfo) { |
const base::FilePath distilled_path("distilled/page.html"); |
const GURL distilled_url("http://example.com/distilled"); |
+ int64_t size = 50; |
+ int64_t before = Now(); |
model_->SetEntryDistilledInfo(GURL("http://example.com"), distilled_path, |
- distilled_url); |
+ distilled_url, size); |
+ int64_t after = Now(); |
AssertObserverCount(0, 0, 0, 0, 0, 0, 0, 1, 1); |
EXPECT_EQ(ReadingListEntry::PROCESSED, entry.DistilledState()); |
EXPECT_EQ(distilled_path, entry.DistilledPath()); |
EXPECT_EQ(distilled_url, entry.DistilledURL()); |
+ EXPECT_EQ(size, entry.DistillationSize()); |
+ EXPECT_GE(entry.DistillationTime(), before); |
+ EXPECT_GE(after, entry.DistillationTime()); |
} |
// Tests setting title on read entry. |
@@ -668,12 +685,18 @@ TEST_F(ReadingListModelTest, UpdateReadDistilledInfo) { |
const base::FilePath distilled_path("distilled/page.html"); |
const GURL distilled_url("http://example.com/distilled"); |
+ int64_t size = 50; |
+ int64_t before = Now(); |
model_->SetEntryDistilledInfo(GURL("http://example.com"), distilled_path, |
- distilled_url); |
+ distilled_url, size); |
+ int64_t after = Now(); |
AssertObserverCount(0, 0, 0, 0, 0, 0, 0, 1, 1); |
EXPECT_EQ(ReadingListEntry::PROCESSED, entry->DistilledState()); |
EXPECT_EQ(distilled_path, entry->DistilledPath()); |
EXPECT_EQ(distilled_url, entry->DistilledURL()); |
+ EXPECT_EQ(size, entry->DistillationSize()); |
+ EXPECT_GE(entry->DistillationTime(), before); |
+ EXPECT_GE(after, entry->DistillationTime()); |
} |
// Tests that ReadingListModel calls CallbackModelBeingDeleted when destroyed. |