#include "extensions/browser/extension_protocols.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/power_monitor_test.h"
#include "base/test/test_file_util.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "base/version_info/channel.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_content_verifier_delegate.h"
#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/content_verifier/content_verifier.h"
#include "extensions/browser/content_verifier/test_utils.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/unloaded_extension_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_paths.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/file_util.h"
#include "extensions/test/test_extension_dir.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "services/network/test/test_url_loader_client.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/referrer_utils.h"
ExtensionRegistry;
URLLoader;
_;
StrictMock;
namespace extensions {
namespace {
constexpr char kValidTrialToken1[] = …;
constexpr char kValidTrialToken2[] = …;
constexpr char kTrialTokensHeaderValue[] = …;
base::FilePath GetTestPath(const std::string& name) { … }
base::FilePath GetContentVerifierTestPath() { … }
scoped_refptr<const Extension> CreateTestExtension(const std::string& name,
bool incognito_split_mode,
int manifest_version) { … }
scoped_refptr<const Extension> CreateWebStoreExtension(int manifest_version) { … }
scoped_refptr<const Extension> CreateTestResponseHeaderExtension(
int manifest_version) { … }
scoped_refptr<const Extension> CreateTestModuleResponseHeaderExtension(
int manifest_version) { … }
scoped_refptr<const Extension> CreateTestModuleImporterResponseHeaderExtension(
int manifest_version,
const std::string& module_extension_id) { … }
network::ResourceRequest CreateResourceRequest(
const std::string& method,
network::mojom::RequestDestination destination,
const GURL& url) { … }
class GetResult { … };
}
class ExtensionProtocolsTestBase : public testing::Test,
public testing::WithParamInterface<int> { … };
class ExtensionProtocolsTest : public ExtensionProtocolsTestBase { … };
class ExtensionProtocolsIncognitoTest : public ExtensionProtocolsTestBase { … };
class ExtensionProtocolsOriginTrial : public ExtensionProtocolsTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ExtensionProtocolsIncognitoTest, IncognitoRequest) { … }
TEST_P(ExtensionProtocolsTest, ComponentResourceRequest) { … }
TEST_P(ExtensionProtocolsTest, ResourceRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsTest, BackgroundScriptRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsOriginTrial, BackgroundScriptRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsTest, BackgroundPageRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsTest, ModuleRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsOriginTrial, ModuleRequestResponseHeaders) { … }
TEST_P(ExtensionProtocolsTest, InvalidBackgroundScriptRequest) { … }
TEST_P(ExtensionProtocolsTest, AllowFrameRequests) { … }
TEST_P(ExtensionProtocolsTest, PathsWithTrailingSeparatorsAreNotAllowed) { … }
TEST_P(ExtensionProtocolsTest, DirectoryWithIndexHtml) { … }
TEST_P(ExtensionProtocolsTest, MetadataFolder) { … }
TEST_P(ExtensionProtocolsTest, VerificationSeenForFileAccessErrors) { … }
TEST_P(ExtensionProtocolsTest, VerificationSeenForZeroByteFile) { … }
TEST_P(ExtensionProtocolsTest, VerifyScriptListedAsIcon) { … }
TEST_P(ExtensionProtocolsTest, MimeTypesForKnownFiles) { … }
TEST_P(ExtensionProtocolsTest, ExtensionRequestsNotAborted) { … }
}