#include "extensions/browser/api_test_utils.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "testing/gtest/include/gtest/gtest.h"
ExtensionFunctionDispatcher;
namespace extensions {
namespace api_test_utils {
SendResponseHelper::SendResponseHelper(ExtensionFunction* function) { … }
SendResponseHelper::~SendResponseHelper() = default;
bool SendResponseHelper::GetResponse() { … }
void SendResponseHelper::OnResponse(ExtensionFunction::ResponseType response,
base::Value::List results,
const std::string& error,
mojom::ExtraResponseDataPtr) { … }
void SendResponseHelper::WaitForResponse() { … }
bool GetBoolean(const base::Value::Dict& dict, const std::string& key) { … }
int GetInteger(const base::Value::Dict& dict, const std::string& key) { … }
std::string GetString(const base::Value::Dict& dict, const std::string& key) { … }
base::Value::List GetList(const base::Value::Dict& dict,
const std::string& key) { … }
base::Value::Dict GetDict(const base::Value::Dict& dict,
const std::string& key) { … }
base::Value::Dict ToDict(std::optional<base::ValueView> val) { … }
base::Value::List ToList(std::optional<base::ValueView> val) { … }
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) { … }
std::string RunFunctionAndReturnError(scoped_refptr<ExtensionFunction> function,
ArgsType args,
content::BrowserContext* context,
FunctionMode mode) { … }
bool RunFunction(scoped_refptr<ExtensionFunction> function,
ArgsType args,
content::BrowserContext* context,
FunctionMode mode) { … }
bool RunFunction(scoped_refptr<ExtensionFunction> function,
ArgsType args,
std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
FunctionMode mode) { … }
}
}