chromium/components/sync/service/glue/sync_engine_impl_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/sync/service/glue/sync_engine_impl.h"

#include <memory>
#include <string>
#include <utility>

#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
#include "components/sync/engine/net/http_bridge.h"
#include "components/sync/engine/sync_engine_host.h"
#include "components/sync/engine/sync_manager_factory.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync/protocol/sync_invalidations_payload.pb.h"
#include "components/sync/service/active_devices_provider.h"
#include "components/sync/service/glue/sync_transport_data_prefs.h"
#include "components/sync/test/fake_sync_manager.h"
#include "components/sync/test/mock_sync_invalidations_service.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
ByMove;
NiceMock;
Return;
Sequence;

namespace syncer {

namespace {

static const base::FilePath::CharType kTestSyncDir[] =);
constexpr char kTestGaiaId[] =;
constexpr char kTestCacheGuid[] =;
constexpr char kTestBirthday[] =;

class MockSyncEngineHost : public SyncEngineHost {};

class FakeSyncManagerFactory : public SyncManagerFactory {};

class MockActiveDevicesProvider : public ActiveDevicesProvider {};

std::unique_ptr<HttpPostProviderFactory> CreateHttpBridgeFactory() {}

class SyncEngineImplTest : public testing::Test {};

// Test basic initialization with no initial types (first time initialization).
// Only the nigori should be configured.
TEST_F(SyncEngineImplTest, InitShutdownWithStopSync) {}

TEST_F(SyncEngineImplTest, InitShutdownWithDisableSync) {}

// Test first time sync scenario. All types should be properly configured.

TEST_F(SyncEngineImplTest, FirstTimeSync) {}

// Test the restart after setting up sync scenario. No enabled types should be
// downloaded.
TEST_F(SyncEngineImplTest, Restart) {}

TEST_F(SyncEngineImplTest, DisableTypes) {}

TEST_F(SyncEngineImplTest, AddTypes) {}

// And and disable in the same configuration.
TEST_F(SyncEngineImplTest, AddDisableTypes) {}

// Test restarting the browser to newly supported datatypes. The new datatypes
// should be downloaded on the configuration after backend initialization.
TEST_F(SyncEngineImplTest, NewlySupportedTypes) {}

// Verify that downloading control types only downloads those types that do
// not have initial sync ended set.
TEST_F(SyncEngineImplTest, DownloadControlTypes) {}

// Fail to download control types.  It's believed that there is a server bug
// which can allow this to happen (crbug.com/164288).  The sync engine should
// detect this condition and fail to initialize the backend.
//
// The failure is "silent" in the sense that the GetUpdates request appears to
// be successful, but it returned no results.  This means that the usual
// download retry logic will not be invoked.
TEST_F(SyncEngineImplTest, SilentlyFailToDownloadControlTypes) {}

// Test that local refresh requests are delivered to sync.
TEST_F(SyncEngineImplTest, ForwardLocalRefreshRequest) {}

// Test that configuration on signin sends the proper GU source.
TEST_F(SyncEngineImplTest, DownloadControlTypesNewClient) {}

// Test that configuration on restart sends the proper GU source.
TEST_F(SyncEngineImplTest, DownloadControlTypesRestart) {}

// If bookmarks encounter an error that results in disabling without purging
// (such as when the type is unready), and then is explicitly disabled, the
// SyncEngine needs to tell the manager to purge the type, even though
// it's already disabled (crbug.com/386778).
TEST_F(SyncEngineImplTest, DisableThenPurgeType) {}

// Tests that SyncEngineImpl retains DataTypeConnector after call to
// StopSyncingForShutdown. This is needed for datatype deactivation during
// DataTypeManager shutdown.
TEST_F(SyncEngineImplTest, DataTypeConnectorValidDuringShutdown) {}

TEST_F(SyncEngineImplTest, ShouldInvalidateDataTypesOnIncomingInvalidation) {}

TEST_F(SyncEngineImplTest, ShouldInvalidateOnlyEnabledDataTypes) {}

TEST_F(SyncEngineImplTest, ShouldStartHandlingInvalidations) {}

TEST_F(SyncEngineImplTest, DoNotUseOldInvalidationsAtAll) {}

TEST_F(SyncEngineImplTest, ShouldEnableInvalidationsWhenStartedHandling) {}

TEST_F(SyncEngineImplTest, ShouldEnableInvalidationsOnTokenUpdate) {}

TEST_F(SyncEngineImplTest, GenerateCacheGUID) {}

TEST_F(SyncEngineImplTest, ShouldLoadSyncDataUponInitialization) {}

TEST_F(SyncEngineImplTest, ShouldNotifyOnNewInvalidatedDataTypes) {}

TEST_F(SyncEngineImplTest, ShouldReturnWhetherNextPollTimePassed) {}

}  // namespace

}  // namespace syncer