#ifndef HEADLESS_TEST_HEADLESS_BROWSER_TEST_UTILS_H_
#define HEADLESS_TEST_HEADLESS_BROWSER_TEST_UTILS_H_
#include <string>
#include <string_view>
#include "base/values.h"
#include "net/base/net_errors.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
namespace simple_devtools_protocol_client {
class SimpleDevToolsProtocolClient;
}
namespace headless {
class HeadlessWebContents;
base::Value::Dict SendCommandSync(
simple_devtools_protocol_client::SimpleDevToolsProtocolClient&
devtools_client,
const std::string& command);
base::Value::Dict SendCommandSync(
simple_devtools_protocol_client::SimpleDevToolsProtocolClient&
devtools_client,
const std::string& command,
base::Value::Dict params);
base::Value::Dict EvaluateScript(HeadlessWebContents* web_contents,
const std::string& script);
bool WaitForLoad(HeadlessWebContents* web_contents,
net::Error* error = nullptr);
void WaitForLoadAndGainFocus(HeadlessWebContents* web_contents);
template <typename T>
base::Value::Dict Param(std::string_view key, T&& value) { … }
std::string DictString(const base::Value::Dict& dict, std::string_view path);
int DictInt(const base::Value::Dict& dict, std::string_view path);
bool DictBool(const base::Value::Dict& dict, std::string_view path);
bool DictHas(const base::Value::Dict& dict, std::string_view path);
testing::Matcher<const base::Value::Dict&> DictHasPathValue(
const std::string& path,
base::Value expected_value);
template <typename T>
testing::Matcher<const base::Value::Dict&> DictHasValue(const std::string& path,
T expected_value) { … }
testing::Matcher<const base::Value::Dict&> DictHasKey(const std::string& key);
}
#endif