blob: 31e7b6cf1e003a5a0f879ad764f2f8deba2cee45 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "components/sync/model/model_type_store.h"
namespace syncer {
// Util class with several static methods to facilitate writing unit tests for
// classes that use ModelTypeStore objects.
class ModelTypeStoreTestUtil {
// Creates an in memory store synchronously.
static std::unique_ptr<ModelTypeStore> CreateInMemoryStoreForTest(
ModelType type = UNSPECIFIED);
// Creates a factory callback to synchronously return in memory stores.
static RepeatingModelTypeStoreFactory FactoryForInMemoryStoreForTest();
// Returns a once-factory that returns an already created store to a service
// constructor in a unit test.
static OnceModelTypeStoreFactory MoveStoreToFactory(
std::unique_ptr<ModelTypeStore> store);
// Returns a callback that constructs a store that forwards all calls to
// |target|. |*target| must outlive the returned factory as well any store
// created by the factory.
static RepeatingModelTypeStoreFactory FactoryForForwardingStore(
ModelTypeStore* target);
} // namespace syncer