chromium/components/sync_sessions/session_store_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_sessions/session_store.h"

#include <map>
#include <utility>
#include <vector>

#include "base/cancelable_callback.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync/base/hash_util.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "components/sync/protocol/session_specifics.pb.h"
#include "components/sync/test/data_type_store_test_util.h"
#include "components/sync/test/test_matchers.h"
#include "components/sync_device_info/local_device_info_util.h"
#include "components/sync_sessions/mock_sync_sessions_client.h"
#include "components/sync_sessions/session_sync_prefs.h"
#include "components/sync_sessions/test_matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace sync_sessions {
namespace {

SessionSpecifics;
DataBatch;
DataTypeStore;
EntityData;
EntityMetadataMap;
HasEncryptionKeyName;
IsEmptyMetadataBatch;
MetadataBatch;
MetadataBatchContains;
NoModelError;
_;
ElementsAre;
Eq;
IsEmpty;
Matcher;
NiceMock;
NotNull;
Pair;
Return;
UnorderedElementsAre;

const char kLocalCacheGuid[] =;

// A mock callback that a) can be used as mock to verify call expectations and
// b) conveniently exposes the last instantiated session store.
class MockOpenCallback {};

MATCHER_P(EntityDataHasSpecifics, session_specifics_matcher, "") {}

std::map<std::string, EntityData> BatchToEntityDataMap(
    std::unique_ptr<DataBatch> batch) {}

std::unique_ptr<MetadataBatch> ReadAllPersistedMetadataFrom(
    DataTypeStore* store) {}

std::map<std::string, SessionSpecifics> ReadAllPersistedDataFrom(
    DataTypeStore* store) {}

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

TEST_F(SessionStoreOpenTest, ShouldCreateStore) {}

TEST_F(SessionStoreOpenTest, ShouldReadLegacySessionsGuidFromPrefs) {}

TEST_F(SessionStoreOpenTest, ShouldNotUseClientIfCancelled) {}

// Test fixture that creates an initial session store.
class SessionStoreTest : public SessionStoreOpenTest {};

TEST_F(SessionStoreTest, ShouldClearLegacySessionsGuidFromPrefs) {}

TEST_F(SessionStoreTest, ShouldCreateLocalSession) {}

TEST_F(SessionStoreTest, ShouldWriteAndRestoreMetadata) {}

TEST_F(SessionStoreTest, ShouldUpdateTrackerWithForeignData) {}

TEST_F(SessionStoreTest, ShouldWriteAndRestoreForeignData) {}

TEST_F(SessionStoreTest, ShouldDeleteForeignData) {}

TEST_F(SessionStoreTest, ShouldReturnForeignUnmappedTabs) {}

TEST_F(SessionStoreTest, ShouldIgnoreForeignOrphanTabs) {}

}  // namespace
}  // namespace sync_sessions