#include <stddef.h>
#include <map>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/permissions/active_tab_permission_granter.h"
#include "chrome/browser/extensions/permissions/permissions_updater.h"
#include "chrome/browser/extensions/permissions/scripting_permissions_modifier.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/navigation_simulator.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest.h"
#include "extensions/common/mojom/injection_type.mojom-shared.h"
#include "extensions/common/mojom/run_location.mojom-shared.h"
#include "extensions/common/user_script.h"
namespace extensions {
namespace {
const char kAllHostsPermission[] = …;
}
class ExtensionActionRunnerUnitTest : public ChromeRenderViewHostTestHarness { … };
ExtensionActionRunnerUnitTest::ExtensionActionRunnerUnitTest() = default;
ExtensionActionRunnerUnitTest::~ExtensionActionRunnerUnitTest() = default;
const Extension* ExtensionActionRunnerUnitTest::AddExtension() { … }
const Extension* ExtensionActionRunnerUnitTest::ReloadExtension() { … }
bool ExtensionActionRunnerUnitTest::RequiresUserConsent(
const Extension* extension) const { … }
void ExtensionActionRunnerUnitTest::RequestInjection(
const Extension* extension) { … }
void ExtensionActionRunnerUnitTest::RequestInjection(
const Extension* extension,
mojom::RunLocation run_location) { … }
size_t ExtensionActionRunnerUnitTest::GetExecutionCountForExtension(
const ExtensionId& extension_id) const { … }
ExtensionActionRunner::ScriptInjectionCallback
ExtensionActionRunnerUnitTest::GetExecutionCallbackForExtension(
const ExtensionId& extension_id) { … }
void ExtensionActionRunnerUnitTest::IncrementExecutionCount(
const ExtensionId& extension_id,
bool granted) { … }
void ExtensionActionRunnerUnitTest::SetUp() { … }
TEST_F(ExtensionActionRunnerUnitTest, GrantTabPermissions) { … }
TEST_F(ExtensionActionRunnerUnitTest, RequestPermissionAndExecute) { … }
TEST_F(ExtensionActionRunnerUnitTest, PendingInjectionsRemovedAtNavigation) { … }
TEST_F(ExtensionActionRunnerUnitTest, MultiplePendingInjection) { … }
TEST_F(ExtensionActionRunnerUnitTest, ActiveScriptsUseActiveTabPermissions) { … }
TEST_F(ExtensionActionRunnerUnitTest, ActiveScriptsCanHaveAllUrlsPref) { … }
TEST_F(ExtensionActionRunnerUnitTest, TestAlwaysRun) { … }
TEST_F(ExtensionActionRunnerUnitTest, TestDifferentScriptRunLocations) { … }
TEST_F(ExtensionActionRunnerUnitTest, TestWebRequestBlocked) { … }
}