#include "content/browser/worker_host/shared_worker_service_impl.h"
#include <memory>
#include <set>
#include <string>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/containers/queue.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/worker_host/mock_shared_worker.h"
#include "content/browser/worker_host/shared_worker_connector_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_utils.h"
#include "content/test/fake_network_url_loader_factory.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/messaging/message_port_channel.h"
#include "third_party/blink/public/mojom/worker/shared_worker_info.mojom.h"
#include "url/origin.h"
MessagePortChannel;
namespace content {
namespace {
ElementsAre;
const ukm::SourceId kClientUkmSourceId = …;
void ConnectToSharedWorker(
mojo::Remote<blink::mojom::SharedWorkerConnector> connector,
const GURL& url,
const std::string& name,
MockSharedWorkerClient* client,
MessagePortChannel* local_port) { … }
}
class SharedWorkerServiceImplTest : public RenderViewHostImplTestHarness { … };
TEST_F(SharedWorkerServiceImplTest, BasicTest) { … }
TEST_F(SharedWorkerServiceImplTest, WebContentsDestroyed) { … }
TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_NormalCase) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_NormalCase_URLMismatch) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_NormalCase_NameMismatch) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_PendingCase) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_PendingCase_URLMismatch) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerTest_PendingCase_NameMismatch) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerRaceTest) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerRaceTest2) { … }
TEST_F(SharedWorkerServiceImplTest, CreateWorkerRaceTest3) { … }
class TestSharedWorkerServiceObserver : public SharedWorkerService::Observer { … };
TEST_F(SharedWorkerServiceImplTest, Observer) { … }
TEST_F(SharedWorkerServiceImplTest, EnumerateSharedWorkers) { … }
TEST_F(SharedWorkerServiceImplTest, CollapseDuplicateNotifications) { … }
TEST_F(SharedWorkerServiceImplTest, Observer_OnClientConnectionLost) { … }
}