chromium/components/history/core/browser/sync/history_sync_bridge_unittest.cc

// Copyright 2022 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/history/core/browser/sync/history_sync_bridge.h"

#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/sync/history_sync_metadata_database.h"
#include "components/history/core/browser/sync/test_history_backend_for_sync.h"
#include "components/history/core/browser/url_row.h"
#include "components/sync/base/page_transition_conversion.h"
#include "components/sync/model/data_type_activation_request.h"
#include "components/sync/model/data_type_local_change_processor.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/metadata_change_list.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "components/sync/protocol/history_specifics.pb.h"
#include "components/sync/protocol/proto_value_conversions.h"
#include "components/sync/test/forwarding_data_type_local_change_processor.h"
#include "sql/database.h"
#include "sql/meta_table.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace history {

const std::string kTestAppId =;
const std::string kTestAppId2 =;

namespace {

_;
Return;

GURL GetURL(int i) {}

sync_pb::HistorySpecifics CreateSpecifics(
    base::Time visit_time,
    const std::string& originator_cache_guid,
    const std::vector<GURL>& urls,
    const std::vector<VisitID>& originator_visit_ids = {}

sync_pb::HistorySpecifics CreateSpecifics(
    base::Time visit_time,
    const std::string& originator_cache_guid,
    const GURL& url,
    VisitID originator_visit_id = 0,
    std::optional<std::string> app_id = std::nullopt,
    const bool has_url_keyed_image = false,
    const std::vector<VisitContentModelAnnotations::Category>& categories = {}

syncer::EntityData SpecificsToEntityData(
    const sync_pb::HistorySpecifics& specifics) {}

class FakeDataTypeLocalChangeProcessor
    : public syncer::DataTypeLocalChangeProcessor {};

class HistorySyncBridgeTest : public testing::Test {};

TEST_F(HistorySyncBridgeTest, AppliesRemoteChanges) {}

TEST_F(HistorySyncBridgeTest, MergesRemoteChanges) {}

TEST_F(HistorySyncBridgeTest, DoesNotApplyUnsyncableRemoteChanges) {}

TEST_F(HistorySyncBridgeTest, ClearsDataWhenSyncStopped) {}

TEST_F(HistorySyncBridgeTest, DeletesForeignVisitsWhenTypeStoppedPermanently) {}

TEST_F(HistorySyncBridgeTest, DeletesForeignVisitsWhenSyncStoppedPermanently) {}

TEST_F(HistorySyncBridgeTest, IgnoresInvalidVisits) {}

TEST_F(HistorySyncBridgeTest, UploadsNewLocalVisit) {}

TEST_F(HistorySyncBridgeTest, DoesNotUploadPreexistingData) {}

TEST_F(HistorySyncBridgeTest, DoesNotUploadUnsyncableURLs) {}

TEST_F(HistorySyncBridgeTest, DoesNotUploadWhileSyncIsPaused) {}

TEST_F(HistorySyncBridgeTest, DoesNotUploadIfSyncIsPausedAtStartup) {}

TEST_F(HistorySyncBridgeTest, UploadsChangeFromBeforeSyncWasStarted) {}

TEST_F(HistorySyncBridgeTest, UploadsReferrerURL) {}

TEST_F(HistorySyncBridgeTest, UploadsUpdatedLocalVisit) {}

TEST_F(HistorySyncBridgeTest, IgnoresUninterestingVisitUpdate) {}

TEST_F(HistorySyncBridgeTest, DoesNotUploadUpdatedForeignVisit) {}

TEST_F(HistorySyncBridgeTest, UploadsUpdatedUrlTitle) {}

TEST_F(HistorySyncBridgeTest, UploadsLocalVisitWithRedirects) {}

TEST_F(HistorySyncBridgeTest, SplitsRedirectChainWithDifferentTimestamps) {}

TEST_F(HistorySyncBridgeTest, DoesNotRepeatedlyUploadClientRedirects) {}

TEST_F(HistorySyncBridgeTest, TrimsExcessivelyLongRedirectChain) {}

TEST_F(HistorySyncBridgeTest, DownloadsUpdatedEntity) {}

TEST_F(HistorySyncBridgeTest, UntracksEntitiesAfterCommit) {}

TEST_F(HistorySyncBridgeTest, UntracksRemoteEntities) {}

TEST_F(HistorySyncBridgeTest, DoesNotUntrackEntityPendingCommit) {}

TEST_F(HistorySyncBridgeTest, UntracksEntityOnIndividualDeletion) {}

TEST_F(HistorySyncBridgeTest,
       UntracksEntityOnIndividualDeletionWhileSyncPaused) {}

TEST_F(HistorySyncBridgeTest, UntracksAllEntitiesOnAllHistoryDeletion) {}

TEST_F(HistorySyncBridgeTest,
       UntracksAllEntitiesOnAllHistoryDeletionWhileSyncPaused) {}

// Note: The remapping logic is covered in the separate test suite
// VisitIDRemapperTest. This test serves as an "integration test" for the
// plumbing from HistorySyncBridge to VisitIDRemapper.
TEST_F(HistorySyncBridgeTest, RemapsOriginatorVisitIDs) {}

TEST_F(HistorySyncBridgeTest, RemapsLegacyRedirectChain) {}

TEST_F(HistorySyncBridgeTest, AddsCluster) {}

}  // namespace

}  // namespace history