chromium/third_party/ipcz/src/test/mock_driver.h

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

#ifndef IPCZ_SRC_TEST_MOCK_DRIVER_H_
#define IPCZ_SRC_TEST_MOCK_DRIVER_H_

#include "ipcz/ipcz.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace ipcz::test {

// A mock implementation of the IpczDriver API which tests can use to precisely
// introspect driver API invocations made by ipcz. At most one instance of this
// class may exist at a time, and the kMockDriver driver declared below can only
// be used while such an instance exists.
class MockDriver {};

// An ipcz driver which forwards its API invocations to the only currently
// existing instance of the MockDriver class above. It is an error to elicit
// driver calls from ipcz while no MockDriver instance exists.
extern const IpczDriver kMockDriver;

}  // namespace ipcz::test

#endif  // IPCZ_SRC_TEST_MOCK_DRIVER_H_