#include "components/reading_list/core/dual_reading_list_model.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "components/reading_list/core/fake_reading_list_model_storage.h"
#include "components/reading_list/core/mock_reading_list_model_observer.h"
#include "components/reading_list/core/reading_list_entry.h"
#include "components/reading_list/core/reading_list_model_impl.h"
#include "components/sync/base/storage_type.h"
#include "components/sync/model/client_tag_based_data_type_processor.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace reading_list {
namespace {
_;
IsNull;
NotNull;
StorageStateForTesting;
MATCHER_P2(MatchesEntry, url_matcher, title_matcher, "") { … }
MATCHER_P(HasUrl, expected_url, "") { … }
MATCHER_P3(HasCountersEqual, size, unseen_size, unread_size, "") { … }
class TestEntryBuilder { … };
class DualReadingListModelTest : public testing::Test { … };
TEST_F(DualReadingListModelTest, EmptyLoaded) { … }
TEST_F(DualReadingListModelTest, ModelLoadFailure) { … }
TEST_F(DualReadingListModelTest, MetaDataClearedBeforeModelLoaded) { … }
TEST_F(DualReadingListModelTest, UpdatesFromSyncBeforeTheLocalModelIsLoaded) { … }
TEST_F(DualReadingListModelTest, ReturnAccountModelSize) { … }
TEST_F(DualReadingListModelTest, ReturnLocalModelSize) { … }
TEST_F(DualReadingListModelTest, ReturnKeysSize) { … }
TEST_F(DualReadingListModelTest, MarkAllSeen) { … }
TEST_F(DualReadingListModelTest, MarkAllSeenWhenAllEntriesHasBeenSeen) { … }
TEST_F(DualReadingListModelTest,
NoInfiniteLoopIfMarkallSeenCalledFromBatchUpdatesObserver) { … }
TEST_F(DualReadingListModelTest, BatchUpdates) { … }
TEST_F(DualReadingListModelTest, BatchUpdatesReentrant) { … }
TEST_F(DualReadingListModelTest, GetEntryByURL) { … }
TEST_F(DualReadingListModelTest, DeleteAllEntries) { … }
TEST_F(DualReadingListModelTest, GetAccountWhereEntryIsSavedToWhenSignedOut) { … }
TEST_F(DualReadingListModelTest,
GetAccountWhereEntryIsSavedToWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest, GetAccountWhereEntryIsSavedToWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest, NeedsExplicitUploadToSyncServerWhenSignedOut) { … }
TEST_F(DualReadingListModelTest,
NeedsExplicitUploadToSyncServerWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
NeedsExplicitUploadToSyncServerWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest, MarkAllForUploadToSyncServerIfNeeded) { … }
TEST_F(DualReadingListModelTest, RemoveNonExistingEntryByUrl) { … }
TEST_F(DualReadingListModelTest, RemoveLocalEntryByUrl) { … }
TEST_F(DualReadingListModelTest, RemoveAccountEntryByUrl) { … }
TEST_F(DualReadingListModelTest, RemoveCommonEntryByUrl) { … }
TEST_F(DualReadingListModelTest, RemoveLocalEntryByUrlFromSync) { … }
TEST_F(DualReadingListModelTest, RemoveAccountEntryByUrlFromSync) { … }
TEST_F(DualReadingListModelTest, RemoveCommonEntryByUrlFromSync) { … }
TEST_F(DualReadingListModelTest, RemoveLocalEntryByUrlFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest, RemoveCommonEntryByUrlFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest, AddEntryWhenSignedOut) { … }
TEST_F(DualReadingListModelTest, AddEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest, AddEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest, AddExistingEntryWhenSignedOut) { … }
TEST_F(DualReadingListModelTest,
AddLocalExistingEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
AddAccountExistingEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
AddCommonExistingEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest, AddExistingEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest, AddLocalEntryFromSync) { … }
TEST_F(DualReadingListModelTest, AddAccountEntryFromSync) { … }
TEST_F(DualReadingListModelTest, AddLocalExistingEntryFromSync) { … }
TEST_F(DualReadingListModelTest, AddEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest, AddExistingEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest, SyncMergeEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest, SyncMergeEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest, SetReadStatusIfExistsForNonExistingEntry) { … }
TEST_F(DualReadingListModelTest, SetReadStatusIfExistsForLocalEntry) { … }
TEST_F(DualReadingListModelTest, SetReadStatusIfExistsForAccountEntry) { … }
TEST_F(DualReadingListModelTest, SetReadStatusIfExistsForLocalCommonEntry) { … }
TEST_F(DualReadingListModelTest, SetReadStatusIfExistsForAccountCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetReadStatusIfExistsForMergedEntryHasSameStatus) { … }
TEST_F(DualReadingListModelTest, SetEntryTitleIfExistsForNonExistingEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryTitleIfExistsForLocalEntry) { … }
TEST_F(DualReadingListModelTest,
SetEntryTitleIfExistsForLocalEntryFromLocalModel) { … }
TEST_F(DualReadingListModelTest, SetEntryTitleIfExistsForAccountEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryTitleIfExistsForLocalCommonEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryTitleIfExistsForAccountCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetEntryTitleIfExistsForMergedEntryHasSameTitle) { … }
TEST_F(DualReadingListModelTest,
SetEstimatedReadTimeIfExistsForNonExistingEntry) { … }
TEST_F(DualReadingListModelTest, SetEstimatedReadTimeIfExistsForLocalEntry) { … }
TEST_F(DualReadingListModelTest, SetEstimatedReadTimeIfExistsForAccountEntry) { … }
TEST_F(DualReadingListModelTest,
SetEstimatedReadTimeIfExistsForLocalCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetEstimatedReadTimeIfExistsForAccountCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetEstimatedReadTimeIfExistsForMergedEntryHasSameEstimatedTime) { … }
TEST_F(DualReadingListModelTest,
SetEntryDistilledStateIfExistsForNonExistingEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryDistilledStateIfExistsForLocalEntry) { … }
TEST_F(DualReadingListModelTest,
SetEntryDistilledStateIfExistsForAccountEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryDistilledStateIfExistsForCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetEntryDistilledStateIfExistsForMergedEntryHasSameDistilledState) { … }
TEST_F(DualReadingListModelTest,
SetEntryDistilledInfoIfExistsForNonExistingEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryDistilledInfoIfExistsForLocalEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryDistilledInfoIfExistsForAccountEntry) { … }
TEST_F(DualReadingListModelTest, SetEntryDistilledInfoIfExistsForCommonEntry) { … }
TEST_F(DualReadingListModelTest,
SetEntryDistilledInfoIfExistsForMergedEntryHasSameDistilledPath) { … }
TEST_F(DualReadingListModelTest, TestTrimmingTitle) { … }
TEST_F(DualReadingListModelTest, ShouldMaintainCountsWhenModelLoaded) { … }
TEST_F(DualReadingListModelTest, ShouldMaintainCountsWhenMarkAllSeen) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveLocalUnreadEntry) { … }
TEST_F(DualReadingListModelTest, ShouldMaintainCountsWhenRemoveLocalReadEntry) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveAccountUnreadEntry) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveAccountReadEntry) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonUnreadEntry) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonReadEntry) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveLocalUnreadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveLocalReadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveAccountUnreadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveAccountReadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonUnreadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonReadEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveLocalUnreadEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveLocalReadEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonUnreadEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenRemoveCommonReadEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddEntryWhenSignedOut) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddExistingUnreadEntryWhenSignedOut) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddExistingReadEntryWhenSignedOut) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalExistingUnreadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalExistingReadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddAccountExistingUnreadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddAccountExistingReadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddCommonExistingUnreadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenAddCommonExistingReadEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddExistingUnreadEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddExistingReadEntryWhenSyncEnabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddAccountEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalExistingEntryFromSync) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddLocalExistingEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenAddAccountExistingEntryFromTheLocalModel) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetLocalUnreadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetLocalUnreadEntryRead) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetLocalReadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetLocalReadEntryRead) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetAccountUnreadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetAccountUnreadEntryRead) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetAccountReadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetAccountReadEntryRead) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetCommonUnreadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetCommonUnreadEntryRead) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetCommonReadEntryUnread) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenSetCommonReadEntryRead) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenSyncMergeReadEntryWithUnreadEntryWhenSyncEnabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenSyncMergeUnreadEntryWithReadEntryWhenSyncEnabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenSyncMergeReadEntryWithUnreadEntryWhenSignedInSyncDisabled) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainCountsWhenSyncMergeUnreadEntryWithReadEntryWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
ShouldMaintainCountsWhenMarkAllForUploadToSyncServerIfNeeded) { … }
TEST_F(
DualReadingListModelTest,
ShouldMaintainSeenAndReadStatusWhenMarkAllForUploadToSyncServerIfNeeded) { … }
TEST_F(DualReadingListModelTest,
ShouldClearLocalModelUponMarkAllForUploadToSyncServerIfNeeded) { … }
TEST_F(DualReadingListModelTest,
ShouldReturnAllLocalKeysUponGetKeysThatNeedUploadToSyncServer) { … }
TEST_F(
DualReadingListModelTest,
ShouldReturnNullIfLocalOrSyncableModelIsSyncingUponGetKeysThatNeedUploadToSyncServer) { … }
TEST_F(DualReadingListModelTest,
GetAccountModelIfSyncingShouldNotReturnNullWhenSignedInSyncDisabled) { … }
TEST_F(DualReadingListModelTest,
GetAccountModelIfSyncingShouldReturnNullWhenSignedOut) { … }
}
}