#include "base/cfi_buildflags.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "extensions/common/utils/content_script_utils.h"
#include "net/base/filename_util.h"
#include "net/dns/mock_host_resolver.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/common/features.h"
namespace extensions {
namespace {
struct BackForwardCacheDisabledDestructiveScriptTestPassToString { … };
}
ContextType;
class ExecuteScriptApiTestBase : public ExtensionApiTest { … };
class ExecuteScriptApiTest : public ExecuteScriptApiTestBase,
public testing::WithParamInterface<ContextType> { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptBasic) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptBadEncoding) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptInFrame) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptByFrameId) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptPermissions) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptFileAfterClose) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptFragmentNavigation) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, NavigationRaceExecuteScript) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptFrameAfterLoad) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, FrameWithHttp204) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptRunAt) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptCSSOrigin) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptCallback) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptRemoveCSS) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, UserGesture) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, InjectIntoSubframesOnLoad) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, RemovedFrames) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, ExecuteScriptSizeLimit) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, InjectScriptInFileFrameAllowed) { … }
IN_PROC_BROWSER_TEST_P(ExecuteScriptApiTest, InjectScriptInFileFrameDenied) { … }
const int kDestructiveScriptTestBucketCount = …;
class DestructiveScriptTest : public ExecuteScriptApiTestBase { … };
class DestructiveScriptTestWithoutOopifOverride
: public DestructiveScriptTest,
public testing::WithParamInterface<int> { … };
class BackForwardCacheDisabledDestructiveScriptTest
: public DestructiveScriptTest,
public testing::WithParamInterface<std::tuple<int, bool>> { … };
#if defined(ADDRESS_SANITIZER) || !defined(NDEBUG) || \
(BUILDFLAG(CFI_ICALL_CHECK) && BUILDFLAG(IS_LINUX))
#define MAYBE_SynchronousRemoval …
#else
#define MAYBE_SynchronousRemoval …
#endif
IN_PROC_BROWSER_TEST_P(BackForwardCacheDisabledDestructiveScriptTest,
MAYBE_SynchronousRemoval) { … }
#if defined(ADDRESS_SANITIZER) || !defined(NDEBUG) || \
(BUILDFLAG(CFI_ICALL_CHECK) && BUILDFLAG(IS_LINUX))
#define MAYBE_MicrotaskRemoval …
#else
#define MAYBE_MicrotaskRemoval …
#endif
IN_PROC_BROWSER_TEST_P(BackForwardCacheDisabledDestructiveScriptTest,
MAYBE_MicrotaskRemoval) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DISABLED_MacrotaskRemoval) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMNodeInserted1) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMNodeInserted2) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMNodeInserted3) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMSubtreeModified1) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMSubtreeModified2) { … }
IN_PROC_BROWSER_TEST_P(DestructiveScriptTestWithoutOopifOverride,
DOMSubtreeModified3) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
class ExecuteScriptApiFencedFrameTest : public ExecuteScriptApiTestBase { … };
IN_PROC_BROWSER_TEST_F(ExecuteScriptApiFencedFrameTest, Load) { … }
}