chromium/components/sync/model/syncable_service_based_bridge_unittest.cc

// Copyright 2018 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/model/syncable_service_based_bridge.h"

#include <string_view>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/model/client_tag_based_data_type_processor.h"
#include "components/sync/model/conflict_resolution.h"
#include "components/sync/model/model_error.h"
#include "components/sync/model/sync_change.h"
#include "components/sync/model/syncable_service.h"
#include "components/sync/protocol/persisted_entity_data.pb.h"
#include "components/sync/test/data_type_store_test_util.h"
#include "components/sync/test/mock_data_type_local_change_processor.h"
#include "components/sync/test/mock_data_type_worker.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace syncer {
namespace {

_;
ElementsAre;
Eq;
Invoke;
IsEmpty;
NotNull;
Pair;
Return;

const DataType kDataType =;
const std::string_view kSyncableServiceStartTimeHistogramName =;

sync_pb::EntitySpecifics GetTestSpecifics(const std::string& name = "name") {}

MATCHER_P(SyncDataMatches, name, "") {}

MATCHER_P2(SyncChangeMatches, change_type, name, "") {}

MATCHER_P(HasName, name, "") {}

class MockSyncableService : public SyncableService {};

class SyncableServiceBasedBridgeTest : public ::testing::Test {};

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldStartSyncingWithEmptyInitialRemoteData) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldStartSyncingWithNonEmptyInitialRemoteData) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldWaitUntilModelReadyToSync) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldStopSyncableServiceIfPreviouslyStarted) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldStopSyncableServiceDuringShutdownIfPreviouslyStarted) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldNotStopSyncableServiceIfNotPreviouslyStarted) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldNotStopSyncableServiceDuringShutdownIfNotPreviouslyStarted) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateErrorDuringStart) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldKeepSyncingWhenSyncStoppedTemporarily) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldStartSyncingWithPreviousDirectoryDataAfterRestart) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldSupportDisableReenableSequence) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldPropagateLocalEntitiesDuringMerge) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateLocalCreation) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateLocalUpdate) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateLocalDeletion) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldIgnoreLocalCreationIfPreviousError) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateRemoteCreation) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateRemoteUpdates) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldPropagateRemoteDeletion) {}

TEST(SyncableServiceBasedBridgeLocalChangeProcessorTest,
     ShouldDropIfCommitted) {}

TEST(SyncableServiceBasedBridgeLocalChangeProcessorTest,
     ShouldNotDropIfUnsynced) {}

TEST_F(SyncableServiceBasedBridgeTest, ConflictShouldUseRemote) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ConflictWithRemoteDeletionShouldUseLocal) {}

// This ensures that for extensions, the conflict is resolved in favor of the
// server, to prevent extensions from being reinstalled after uninstall.
TEST_F(SyncableServiceBasedBridgeTest,
       ConflictWithRemoteExtensionUninstallShouldUseRemote) {}

// Same as above but for APPS.
TEST_F(SyncableServiceBasedBridgeTest,
       ConflictWithRemoteAppUninstallShouldUseRemote) {}

TEST_F(SyncableServiceBasedBridgeTest, ShouldMeasureSyncableServiceStartTime) {}

// This also covers the case where the user opts in for sync later.
TEST_F(SyncableServiceBasedBridgeTest,
       ShouldNotMeasureSyncableServiceStartTimeIfNoInitialData) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldNotMeasureSyncableServiceStartTimeOnSyncRestart) {}

TEST_F(SyncableServiceBasedBridgeTest,
       ShouldNotMeasureSyncableServiceStartTimeOnError) {}

}  // namespace
}  // namespace syncer