#include <optional>
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/scripting/scripting_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/https_upgrades_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/version_info/channel.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/background_script_executor.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/script_executor.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/utils/content_script_utils.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/controllable_http_response.h"
#include "pdf/buildflags.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
#if BUILDFLAG(ENABLE_PDF)
#include "base/test/scoped_feature_list.h"
#include "pdf/pdf_features.h"
#endif
namespace extensions {
namespace {
constexpr const char kSimulatedResourcePath[] = …;
constexpr char kGetDivIds[] = …;
}
class ScriptingAPITest : public ExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, MainFrameTests) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, SubFramesTests) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, NestedWebContents) { … }
#if BUILDFLAG(ENABLE_PDF)
class ScriptingAPIOopifPdfTest : public ScriptingAPITest { … };
IN_PROC_BROWSER_TEST_F(ScriptingAPIOopifPdfTest, PdfFrames) { … }
#endif
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, CSSInjection) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, CSSRemoval) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, RegisterContentScripts) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, GetContentScripts) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, UnregisterContentScripts) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, UpdateContentScripts) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, DynamicContentScriptParameters) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, DynamicContentScriptsMainWorld) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest,
RapidDynamicContentScriptRegistrationAndUnregistration) { … }
#if defined(ADDRESS_SANITIZER)
#define MAYBE_RapidLoadUnload …
#else
#define MAYBE_RapidLoadUnload …
#endif
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, MAYBE_RapidLoadUnload) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, DynamicContentScriptsSizeLimits) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, ExecuteScriptSizeLimit) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, ExecuteScriptBeforeInitialCommit) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest, InjectImmediately) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest,
PRE_DynamicContentScriptsInjectInIncognito) { … }
IN_PROC_BROWSER_TEST_F(ScriptingAPITest,
DynamicContentScriptsInjectInIncognito) { … }
class PersistentScriptingAPITest : public ScriptingAPITest { … };
IN_PROC_BROWSER_TEST_F(PersistentScriptingAPITest,
PRE_PRE_PersistentDynamicContentScripts) { … }
IN_PROC_BROWSER_TEST_F(PersistentScriptingAPITest,
PRE_PersistentDynamicContentScripts) { … }
IN_PROC_BROWSER_TEST_F(PersistentScriptingAPITest,
PersistentDynamicContentScripts) { … }
class ScriptingAPIPrerenderingTest : public ScriptingAPITest { … };
IN_PROC_BROWSER_TEST_F(ScriptingAPIPrerenderingTest, DISABLED_Basic) { … }
class ScriptingAndUserScriptsAPITest : public ScriptingAPITest { … };
IN_PROC_BROWSER_TEST_F(ScriptingAndUserScriptsAPITest,
ScriptingAPIDoesNotAffectUserScripts) { … }
}