#ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_
#define EXTENSIONS_BROWSER_API_TEST_UTILS_H_
#include <memory>
#include <optional>
#include <string>
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "extensions/browser/extension_function.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace content {
class BrowserContext;
}
namespace extensions {
class ExtensionFunctionDispatcher;
namespace api_test_utils {
class SendResponseHelper { … };
enum class FunctionMode { … };
bool GetBoolean(const base::Value::Dict& val, const std::string& key);
int GetInteger(const base::Value::Dict& val, const std::string& key);
std::string GetString(const base::Value::Dict& val, const std::string& key);
base::Value::List GetList(const base::Value::Dict& val, const std::string& key);
base::Value::Dict GetDict(const base::Value::Dict& val, const std::string& key);
base::Value::Dict ToDict(std::optional<base::ValueView> val);
base::Value::List ToList(std::optional<base::ValueView> val);
ArgsType;
std::optional<base::Value> RunFunctionWithDelegateAndReturnSingleResult(
scoped_refptr<ExtensionFunction> function,
ArgsType args,
std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
FunctionMode mode);
std::optional<base::Value> RunFunctionAndReturnSingleResult(
scoped_refptr<ExtensionFunction> function,
ArgsType args,
content::BrowserContext* context,
FunctionMode mode = FunctionMode::kNone);
std::string RunFunctionAndReturnError(scoped_refptr<ExtensionFunction> function,
ArgsType args,
content::BrowserContext* context,
FunctionMode mode = FunctionMode::kNone);
bool RunFunction(scoped_refptr<ExtensionFunction> function,
ArgsType args,
content::BrowserContext* context,
FunctionMode mode = FunctionMode::kNone);
bool RunFunction(scoped_refptr<ExtensionFunction> function,
ArgsType args,
std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
FunctionMode mode);
}
}
#endif