#include "extensions/browser/background_script_executor.h"
#include "base/functional/callback.h"
#include "base/json/json_reader.h"
#include "base/strings/stringprintf.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/service_worker_test_helpers.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/script_result_queue.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
namespace {
std::string GetScriptToLog(const std::string& script) { … }
}
BackgroundScriptExecutor::BackgroundScriptExecutor(
content::BrowserContext* browser_context)
: … { … }
BackgroundScriptExecutor::~BackgroundScriptExecutor() = default;
base::Value BackgroundScriptExecutor::ExecuteScript(
const ExtensionId& extension_id,
const std::string& script,
ResultCapture result_capture,
browsertest_util::ScriptUserActivation script_user_activation) { … }
base::Value BackgroundScriptExecutor::ExecuteScript(
content::BrowserContext* browser_context,
const ExtensionId& extension_id,
const std::string& script,
ResultCapture result_capture,
browsertest_util::ScriptUserActivation script_user_activation) { … }
bool BackgroundScriptExecutor::ExecuteScriptAsync(
const ExtensionId& extension_id,
const std::string& script,
ResultCapture result_capture,
browsertest_util::ScriptUserActivation script_user_activation) { … }
bool BackgroundScriptExecutor::ExecuteScriptAsync(
content::BrowserContext* browser_context,
const ExtensionId& extension_id,
const std::string& script,
browsertest_util::ScriptUserActivation script_user_activation) { … }
base::Value BackgroundScriptExecutor::WaitForResult() { … }
bool BackgroundScriptExecutor::ExecuteScriptInServiceWorker() { … }
bool BackgroundScriptExecutor::ExecuteScriptInBackgroundPage(
browsertest_util::ScriptUserActivation script_user_activation) { … }
void BackgroundScriptExecutor::AddTestFailure(const std::string& message) { … }
}