#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/path_service.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "base/system/sys_info.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_timeouts.h"
#include "base/thread_annotations.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/process_lock.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/worker_host/shared_worker_service_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_content_browser_client.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/base/features.h"
#include "net/base/filename_util.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_access_result.h"
#include "net/dns/mock_host_resolver.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/ssl_server_config.h"
#include "net/test/embedded_test_server/connection_tracker.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/spawned_test_server/spawned_test_server.h"
#include "net/test/test_data_directory.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
namespace content {
namespace {
const char kSameSiteCookie[] = …;
const char kNoCookie[] = …;
bool SupportsSharedWorker() { … }
}
class WorkerTest : public ContentBrowserTest,
public testing::WithParamInterface<int> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(WorkerTest, SingleWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SingleWorkerFromFile) { … }
class WorkerTestWithAllowFileAccessFromFiles : public WorkerTest { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(WorkerTestWithAllowFileAccessFromFiles,
SingleWorkerFromFile) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, HttpPageCantCreateFileWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, MultipleWorkers) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SingleSharedWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SharedWorkerInCOEPRequireCorpDocument) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SharedWorkerInCOEPCredentiallessDocument) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, MultipleSharedWorkers) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, IncognitoSharedWorkers) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WorkerHttpAuth) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WorkerTlsClientAuthImportScripts) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WorkerTlsClientAuthFetch) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SharedWorkerTlsClientAuthImportScripts) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WebSocketSharedWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, PassMessagePortToSharedWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest,
PassMessagePortToSharedWorkerDontWaitForConnect) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest,
VerifyInitiatorAndSameSiteCookiesSharedWorker) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WorkerSameSiteCookies1) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, WorkerSameSiteCookies2) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, NestedWorkerSameSiteCookies) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest,
CrossOriginIframeWorkerDoesNotSendSameSiteCookies1) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest,
CrossOriginIframeWorkerDoesNotSendSameSiteCookies2) { … }
class WorkerFromCredentiallessIframeNikBrowserTest : public WorkerTest { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(WorkerFromCredentiallessIframeNikBrowserTest,
SharedWorkerRequestIsDoneWithPartitionedNetworkState) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerSameDefault) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerSameNone) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerSameAll) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerCrossDefault) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerCrossNone) { … }
IN_PROC_BROWSER_TEST_P(WorkerTest, SameSiteCookiesSharedWorkerCrossAll) { … }
}