#include <stddef.h>
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/containers/to_vector.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/debugger/debugger_api.h"
#include "chrome/browser/extensions/api/debugger/extension_dev_tools_infobar_delegate.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_management_test_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_destroyer.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_delegate.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/prefs/pref_service.h"
#include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/content/security_interstitial_page.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "components/security_interstitials/content/settings_page_helper.h"
#include "components/security_interstitials/core/metrics_helper.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/no_renderer_crashes_assertion.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "pdf/buildflags.h"
#if BUILDFLAG(ENABLE_PDF)
#include "base/test/scoped_feature_list.h"
#include "base/test/with_feature_override.h"
#include "chrome/browser/pdf/pdf_extension_test_util.h"
#include "chrome/browser/pdf/test_pdf_viewer_stream_manager.h"
#include "pdf/pdf_features.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/profiles/profile_helper.h"
#endif
namespace extensions {
namespace {
std::vector<std::string> GetTargetUrlsWithoutPorts(
const base::Value::List& targets) { … }
}
Eq;
class DebuggerApiTest : public ExtensionApiTest { … };
void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) { … }
void DebuggerApiTest::SetUpOnMainThread() { … }
testing::AssertionResult DebuggerApiTest::RunAttachFunction(
const GURL& url, const std::string& expected_error) { … }
testing::AssertionResult DebuggerApiTest::RunAttachFunction(
const content::WebContents* web_contents,
const std::string& expected_error) { … }
testing::AssertionResult DebuggerApiTest::RunAttachFunctionOnTarget(
const std::string& debuggee_target, const std::string& expected_error) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerNotAllowedOnOtherExtensionPages) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerAllowedOnFileUrlsWithFileAccess) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerNotAllowedOnFileUrlsWithoutAccess) { … }
class TestInterstitialPage
: public security_interstitials::SecurityInterstitialPage { … };
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerNotAllowedOnRestrictedBlobUrls) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerNotAllowedOnPolicyRestrictedBlobUrls) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
DebuggerNotAllowedOnSecirutyInterstitials) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest, InfoBar) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest, InfoBarIsRemovedAfterFiveSeconds) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
InfoBarIsNotRemovedWhenAnotherDebuggerAttached) { … }
class CrossProfileDebuggerApiTest : public DebuggerApiTest { … };
IN_PROC_BROWSER_TEST_F(CrossProfileDebuggerApiTest, GetTargets) { … }
IN_PROC_BROWSER_TEST_F(CrossProfileDebuggerApiTest, Attach) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
InfoBarIsNotRemovedIfAttachAgainBeforeFiveSeconds) { … }
IN_PROC_BROWSER_TEST_F(DebuggerApiTest, TestDefaultPolicyBlockedHosts) { … }
class DebuggerExtensionApiTest : public ExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, Debugger) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, ParentTargetPermissions) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, ReloadAndResetHistory) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest,
DebuggerNotAllowedToInvokeInspectWorker) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, AttachToEmptyUrls) { … }
#if BUILDFLAG(ENABLE_PDF)
class DebuggerExtensionApiPdfTest : public base::test::WithFeatureOverride,
public DebuggerExtensionApiTest { … };
IN_PROC_BROWSER_TEST_P(DebuggerExtensionApiPdfTest, AttachToPdf) { … }
INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(…);
class DebuggerExtensionApiOopifPdfTest : public DebuggerExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiOopifPdfTest, GetTargets) { … }
#endif
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, AttachToBlob) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_NavigateToForbiddenUrl …
#else
#define MAYBE_NavigateToForbiddenUrl …
#endif
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, MAYBE_NavigateToForbiddenUrl) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, NavigateToUntrustedWebUIUrl) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, CreateTargetToUntrustedWebUI) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest, IsDeveloperModeTrueHistogram) { … }
IN_PROC_BROWSER_TEST_F(DebuggerExtensionApiTest,
IsDeveloperModeFalseHistogram) { … }
class SitePerProcessDebuggerExtensionApiTest : public DebuggerExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(SitePerProcessDebuggerExtensionApiTest, Debugger) { … }
IN_PROC_BROWSER_TEST_F(SitePerProcessDebuggerExtensionApiTest,
NavigateSubframe) { … }
IN_PROC_BROWSER_TEST_F(SitePerProcessDebuggerExtensionApiTest,
AutoAttachPermissions) { … }
IN_PROC_BROWSER_TEST_F(SitePerProcessDebuggerExtensionApiTest,
AutoAttachFlatModePermissions) { … }
IN_PROC_BROWSER_TEST_F(SitePerProcessDebuggerExtensionApiTest,
DebuggerCheckInnerUrl) { … }
}