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

Unified Diff: components/reading_list/core/reading_list_entry_unittest.cc

Issue 2806213004: Track if a ReadingListEntry has been dismissed (Closed)
Patch Set: Address comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/reading_list/core/reading_list_entry_unittest.cc
diff --git a/components/reading_list/core/reading_list_entry_unittest.cc b/components/reading_list/core/reading_list_entry_unittest.cc
index 23bc82f42f8234ab7860961c04505c9423e1133e..6a0e8c805c01c0999c44d8ceee7c0e469ce721e1 100644
--- a/components/reading_list/core/reading_list_entry_unittest.cc
+++ b/components/reading_list/core/reading_list_entry_unittest.cc
@@ -318,6 +318,7 @@ TEST(ReadingListEntry, AsReadingListLocal) {
EXPECT_EQ(pb_entry->distilled_path(), "");
EXPECT_EQ(pb_entry->failed_download_counter(), 0);
EXPECT_NE(pb_entry->backoff(), "");
+ EXPECT_FALSE(pb_entry->content_suggestions_extra().dismissed());
entry.SetDistilledState(ReadingListEntry::WILL_RETRY);
std::unique_ptr<reading_list::ReadingListLocal> will_retry_pb_entry(
@@ -334,6 +335,11 @@ TEST(ReadingListEntry, AsReadingListLocal) {
entry.SetRead(true, base::Time::FromTimeT(20));
entry.MarkEntryUpdated(base::Time::FromTimeT(30));
+
+ reading_list::ContentSuggestionsExtra extra;
+ extra.dismissed = true;
+ entry.SetContentSuggestionsExtra(extra);
+
EXPECT_NE(entry.UpdateTime(), creation_time_us);
std::unique_ptr<reading_list::ReadingListLocal> distilled_pb_entry(
entry.AsReadingListLocal(base::Time::FromTimeT(40)));
@@ -348,6 +354,7 @@ TEST(ReadingListEntry, AsReadingListLocal) {
EXPECT_EQ(distilled_pb_entry->distillation_time_us(),
entry.DistillationTime());
EXPECT_EQ(distilled_pb_entry->distillation_size(), entry.DistillationSize());
+ EXPECT_TRUE(distilled_pb_entry->content_suggestions_extra().dismissed());
}
// Tests that the reading list entry is correctly parsed from
@@ -373,6 +380,10 @@ TEST(ReadingListEntry, FromReadingListLocal) {
pb_entry->set_distillation_time_us(now);
pb_entry->set_distillation_size(50);
+ reading_list::ReadingListContentSuggestionsExtra* pb_extra =
+ pb_entry->mutable_content_suggestions_extra();
+ pb_extra->set_dismissed(true);
+
std::unique_ptr<ReadingListEntry> waiting_entry(
ReadingListEntry::FromReadingListLocal(*pb_entry,
base::Time::FromTimeT(20)));
@@ -385,6 +396,7 @@ TEST(ReadingListEntry, FromReadingListLocal) {
EXPECT_EQ(waiting_entry->DistilledPath(), base::FilePath());
EXPECT_EQ(waiting_entry->DistillationSize(), 50);
EXPECT_EQ(waiting_entry->DistillationTime(), now);
+ EXPECT_TRUE(waiting_entry->ContentSuggestionsExtra()->dismissed);
// Allow twice the jitter as test is not instantaneous.
double fuzzing = 2 * ReadingListEntry::kBackoffPolicy.jitter_factor;
int nextTry = waiting_entry->TimeUntilNextTry().InMinutes();

Powered by Google App Engine
This is Rietveld 408576698