#include "components/sync/service/data_type_manager_impl.h"
#include <memory>
#include <utility>
#include "base/functional/callback.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/base/sync_mode.h"
#include "components/sync/engine/configure_reason.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/service/configure_context.h"
#include "components/sync/service/data_type_encryption_handler.h"
#include "components/sync/service/data_type_manager_observer.h"
#include "components/sync/service/data_type_status_table.h"
#include "components/sync/test/fake_data_type_controller.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
_;
ElementsAre;
Pair;
UnorderedElementsAre;
DataTypeSet AddControlTypesTo(DataTypeSet types) { … }
ConfigureContext BuildConfigureContext(ConfigureReason reason,
SyncMode sync_mode = SyncMode::kFull) { … }
class MockDataTypeManagerObserver : public DataTypeManagerObserver { … };
MATCHER_P(ConfigureSucceededWithFailedTypes, error_map, "") { … }
MATCHER(ConfigureSucceeded, "") { … }
MATCHER(ConfigureAborted, "") { … }
MATCHER(IsCryptoError, "") { … }
MATCHER(IsDataTypeError, "") { … }
MATCHER(IsPolicyError, "") { … }
MATCHER(IsUnreadyError, "") { … }
class FakeDataTypeConfigurer : public DataTypeConfigurer { … };
class FakeDataTypeEncryptionHandler : public DataTypeEncryptionHandler { … };
bool FakeDataTypeEncryptionHandler::HasCryptoError() const { … }
DataTypeSet FakeDataTypeEncryptionHandler::GetAllEncryptedDataTypes() const { … }
class DataTypeManagerImplTest : public testing::Test { … };
TEST_F(DataTypeManagerImplTest, NoControllers) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOne) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOneThatSkipsEngineConnection) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOneStopWhileDownloadPending) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOneStopWhileStartingModel) { … }
TEST_F(DataTypeManagerImplTest, OneWaitingForCrypto) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOneThenBoth) { … }
TEST_F(DataTypeManagerImplTest, ConfigureOneThenSwitch) { … }
TEST_F(DataTypeManagerImplTest, ConfigureModelLoading) { … }
TEST_F(DataTypeManagerImplTest, OneFailingController) { … }
TEST_F(DataTypeManagerImplTest, ConfigureWhileDownloadPending) { … }
TEST_F(DataTypeManagerImplTest, ConfigureWhileDownloadPendingWithFailure) { … }
TEST_F(DataTypeManagerImplTest, MigrateAll) { … }
TEST_F(DataTypeManagerImplTest, ConfigureDuringPurge) { … }
TEST_F(DataTypeManagerImplTest, PrioritizedConfiguration) { … }
TEST_F(DataTypeManagerImplTest, GetDataTypesForTransportOnlyMode) { … }
TEST_F(DataTypeManagerImplTest, ShouldPrioritizePasswordsOverInvitations) { … }
TEST_F(DataTypeManagerImplTest, PrioritizedConfigurationReconfigure) { … }
TEST_F(DataTypeManagerImplTest, PrioritizedConfigurationStop) { … }
TEST_F(DataTypeManagerImplTest, PrioritizedConfigurationDownloadError) { … }
TEST_F(DataTypeManagerImplTest, FilterDesiredTypes) { … }
TEST_F(DataTypeManagerImplTest, FailingPreconditionKeepData) { … }
TEST_F(DataTypeManagerImplTest, FailingPreconditionClearData) { … }
TEST_F(DataTypeManagerImplTest, UnreadyTypeResetReconfigure) { … }
TEST_F(DataTypeManagerImplTest, UnreadyTypeLaterReady) { … }
TEST_F(DataTypeManagerImplTest, MultipleUnreadyTypesLaterReadyAtTheSameTime) { … }
TEST_F(DataTypeManagerImplTest, MultipleUnreadyTypesLaterOneOfThemReady) { … }
TEST_F(DataTypeManagerImplTest,
NoOpDataTypePreconditionChangedWhileStillUnready) { … }
TEST_F(DataTypeManagerImplTest,
NoOpDataTypePreconditionChangedWhileStillReady) { … }
TEST_F(DataTypeManagerImplTest, ModelLoadError) { … }
TEST_F(DataTypeManagerImplTest, ErrorBeforeStartup) { … }
TEST_F(DataTypeManagerImplTest, AllTypesReady) { … }
TEST_F(DataTypeManagerImplTest, DelayConfigureForUSSTypes) { … }
TEST_F(DataTypeManagerImplTest, ConnectDataTypeOnEncryptionError) { … }
TEST_F(DataTypeManagerImplTest, ConnectDataTypeAfterLoadModelsError) { … }
TEST_F(DataTypeManagerImplTest, StopWithDisableSync) { … }
TEST_F(DataTypeManagerImplTest, PurgeDataOnStarting) { … }
TEST_F(DataTypeManagerImplTest, PurgeDataOnReconfiguring) { … }
TEST_F(DataTypeManagerImplTest, ShouldRecordInitialConfigureTimeHistogram) { … }
TEST_F(DataTypeManagerImplTest, ShouldRecordSubsequentConfigureTimeHistogram) { … }
TEST_F(DataTypeManagerImplTest, ReentrantConfigure) { … }
TEST_F(DataTypeManagerImplTest, ProvideDebugInfo) { … }
TEST_F(DataTypeManagerImplTest, ShouldDoNothingForAlreadyStoppedTypes) { … }
TEST_F(DataTypeManagerImplTest, ShouldDoNothingForAlreadyFailedTypes) { … }
TEST_F(DataTypeManagerImplTest, ShouldFinishConfigureIfSomeTypesTimeout) { … }
TEST_F(DataTypeManagerImplTest, TimeoutAfterStop) { … }
TEST_F(DataTypeManagerImplTest, ShouldUpdateDataTypeStatusWhileStopped) { … }
TEST_F(DataTypeManagerImplTest, ShouldReconfigureOnPreconditionChanged) { … }
TEST_F(DataTypeManagerImplTest, ShouldHandleStoppingTypesFailure) { … }
TEST_F(DataTypeManagerImplTest, ShouldHandleStoppedTypesFailure) { … }
TEST_F(DataTypeManagerImplTest, ClearMetadataWhileStoppedExceptFor) { … }
}
}