chromium/chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/scoped_key_persistence_delegate_factory.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_KEY_MANAGEMENT_CORE_PERSISTENCE_SCOPED_KEY_PERSISTENCE_DELEGATE_FACTORY_H_
#define CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_KEY_MANAGEMENT_CORE_PERSISTENCE_SCOPED_KEY_PERSISTENCE_DELEGATE_FACTORY_H_

#include <stdint.h>

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

#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ref.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate.h"
#include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate_factory.h"
#include "crypto/scoped_mock_unexportable_key_provider.h"

namespace enterprise_connectors {
namespace test {
class MockKeyPersistenceDelegate;

// Class used in tests to mock retrieval of hardware signing key pairs. Creating
// an instance of this will prevent tests from having to actually store signing
// key pairs (which requires an elevated process).
class ScopedKeyPersistenceDelegateFactory
    : public KeyPersistenceDelegateFactory {};

// Class used in tests to mock storing and retrieval of hardware signing key
// pairs. Creating an instance of this will make tests use this class' own
// in-memory storage for signing keys instead of the actual storage (registry,
// file system etc.)
class ScopedInMemoryKeyPersistenceDelegateFactory
    : public KeyPersistenceDelegateFactory,
      public KeyPersistenceDelegate {};

// A KeyPersistenceDelegate that forwards all calls to another delegate.
class KeyPersistenceDelegateStub : public KeyPersistenceDelegate {};

}  // namespace test
}  // namespace enterprise_connectors

#endif  // CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_KEY_MANAGEMENT_CORE_PERSISTENCE_SCOPED_KEY_PERSISTENCE_DELEGATE_FACTORY_H_