#ifndef COMPONENTS_SYSTEM_CPU_PRESSURE_TEST_SUPPORT_H_
#define COMPONENTS_SYSTEM_CPU_PRESSURE_TEST_SUPPORT_H_
#include <stdint.h>
#include <optional>
#include <type_traits>
#include <utility>
#include <vector>
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "base/test/test_future.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "components/system_cpu/cpu_probe.h"
#include "components/system_cpu/cpu_sample.h"
namespace system_cpu {
template <typename T,
typename = std::enable_if_t<std::is_base_of_v<CpuProbe, T>>>
class FakePlatformCpuProbe : public T {
public:
template <typename... Args>
explicit FakePlatformCpuProbe(Args&&... args)
: T(std::forward<Args>(args)...) { … }
~FakePlatformCpuProbe() override = default;
std::optional<CpuSample> UpdateAndWaitForSample() { … }
private:
base::test::TestFuture<std::optional<CpuSample>> sample_;
};
class FakeCpuProbe final : public CpuProbe { … };
class StreamingCpuProbe final : public CpuProbe { … };
}
#endif