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

// Copyright 2019 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/delete_directive_handler.h"

#include <string>
#include <utility>

#include "base/files/scoped_temp_dir.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/history/core/browser/history_backend.h"
#include "components/history/core/browser/history_backend_client.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_db_task.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/in_memory_history_backend.h"
#include "components/history/core/test/test_history_database.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/history_delete_directive_specifics.pb.h"
#include "components/sync/test/fake_sync_change_processor.h"
#include "components/sync/test/sync_change_processor_wrapper_for_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace history {

const std::string kTestAppId1 =;
const std::string kTestAppId2 =;

namespace {

base::Time UnixUsecToTime(int64_t usec) {}

class TestHistoryBackendDelegate : public HistoryBackend::Delegate {};

void ScheduleDBTask(scoped_refptr<HistoryBackend> history_backend,
                    const base::Location& location,
                    std::unique_ptr<HistoryDBTask> task,
                    base::CancelableTaskTracker* tracker) {}

// Closure function that runs periodically to check result of delete directive
// processing. Stop when timeout or processing ends indicated by the creation
// of sync changes.
void CheckDirectiveProcessingResult(
    base::Time timeout,
    const syncer::FakeSyncChangeProcessor* change_processor,
    uint32_t num_changes) {}

class HistoryDeleteDirectiveHandlerTest : public testing::Test {};

// Tests calling WaitUntilReadyToSync() after the backend has already been
// loaded, which should report completion immediately.
TEST_F(HistoryDeleteDirectiveHandlerTest, SyncAlreadyReadyToSync) {}

// Tests calling WaitUntilReadyToSync() befire the backend has been loaded,
// which should only report completion after the backend loading is completed.
TEST_F(HistoryDeleteDirectiveHandlerTest, WaitUntilReadyToSync) {}

// Create a local delete directive and process it while sync is
// online, and then when offline. The delete directive should be sent to sync,
// no error should be returned for the first time, and an error should be
// returned for the second time.
TEST_F(HistoryDeleteDirectiveHandlerTest,
       ProcessLocalDeleteDirectiveSyncOnline) {}

// Create a delete directive for a few specific history entries,
// including ones that don't exist. The expected entries should be
// deleted.
TEST_F(HistoryDeleteDirectiveHandlerTest, ProcessGlobalIdDeleteDirective) {}

// Create delete directives for time ranges.  The expected entries should be
// deleted.
TEST_F(HistoryDeleteDirectiveHandlerTest, ProcessTimeRangeDeleteDirective) {}

// Create delete directives for time ranges with or without app ID.  Only the
// entries with the matching app ID (or all if not specified) should be deleted.
TEST_F(HistoryDeleteDirectiveHandlerTest,
       ProcessTimeRangeDeleteDirectiveByApp) {}

// Create a delete directive for urls.  The expected entries should be
// deleted.
TEST_F(HistoryDeleteDirectiveHandlerTest, ProcessUrlDeleteDirective) {}

}  // namespace

}  // namespace history