// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_BACKGROUND_SCRIPT_EXECUTOR_H_ #define EXTENSIONS_BROWSER_BACKGROUND_SCRIPT_EXECUTOR_H_ #include <memory> #include <optional> #include <string> #include "base/memory/raw_ptr.h" #include "base/values.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/browsertest_util.h" #include "extensions/common/extension_id.h" namespace content { class BrowserContext; } // namespace content namespace extensions { class Extension; class ExtensionRegistry; class ProcessManager; class ScriptResultQueue; // A helper class to execute a script in an extension's background context, // either its service worker or its (possibly lazy) background page. // Returning results: // Return results with chrome.test.sendScriptResult(). This can be called // either synchronously or asynchronously from the injected script. // For compatibility with legacy scripts, background page contexts can choose // send results via window.domAutomationController.send(). New code should not // do this. // This class is designed for single-use executions and is only meant to be used // in tests. class BackgroundScriptExecutor { … }; } // namespace extensions #endif // EXTENSIONS_BROWSER_BACKGROUND_SCRIPT_EXECUTOR_H_