chromium/net/reporting/mock_persistent_reporting_store.h

// 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.

#ifndef NET_REPORTING_MOCK_PERSISTENT_REPORTING_STORE_H_
#define NET_REPORTING_MOCK_PERSISTENT_REPORTING_STORE_H_

#include <vector>

#include "base/functional/callback.h"
#include "net/base/network_anonymization_key.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_endpoint.h"
#include "url/origin.h"

namespace net {

// A ReportingCache::PersistentReportingStore implementation that stashes the
// received commands in order in a vector, to be checked by tests. Simulates
// loading pre-existing stored endpoints and endpoint groups, which can be
// provided using SetPrestoredClients().
//
// TODO(sburnett): Replace this with a fake store to reduce awkwardness.
class MockPersistentReportingStore
    : public ReportingCache::PersistentReportingStore {};

bool operator==(const MockPersistentReportingStore::Command& lhs,
                const MockPersistentReportingStore::Command& rhs);
bool operator!=(const MockPersistentReportingStore::Command& lhs,
                const MockPersistentReportingStore::Command& rhs);
std::ostream& operator<<(std::ostream& out,
                         const MockPersistentReportingStore::Command& cmd);

}  // namespace net

#endif  // NET_REPORTING_MOCK_PERSISTENT_REPORTING_STORE_H_