#include "extensions/browser/service_worker/service_worker_test_utils.h"
#include <utility>
#include "base/containers/map_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_database.mojom-forward.h"
namespace extensions {
namespace service_worker_test_utils {
content::ServiceWorkerContext* GetServiceWorkerContext(
content::BrowserContext* browser_context) { … }
namespace {
std::optional<GURL> GetScopeForExtensionID(
std::optional<ExtensionId> extension_id) { … }
}
TestServiceWorkerContextObserver::TestServiceWorkerContextObserver(
content::ServiceWorkerContext* context,
std::optional<ExtensionId> extension_id)
: … { … }
TestServiceWorkerContextObserver::TestServiceWorkerContextObserver(
content::BrowserContext* browser_context,
std::optional<ExtensionId> extension_id)
: … { … }
TestServiceWorkerContextObserver::~TestServiceWorkerContextObserver() = default;
void TestServiceWorkerContextObserver::WaitForRegistrationStored() { … }
int64_t TestServiceWorkerContextObserver::WaitForWorkerStarted() { … }
int64_t TestServiceWorkerContextObserver::WaitForWorkerStopped() { … }
int64_t TestServiceWorkerContextObserver::WaitForWorkerActivated() { … }
int TestServiceWorkerContextObserver::GetCompletedCount(
const GURL& scope) const { … }
void TestServiceWorkerContextObserver::OnRegistrationCompleted(
const GURL& scope) { … }
void TestServiceWorkerContextObserver::OnRegistrationStored(
int64_t registration_id,
const GURL& scope) { … }
void TestServiceWorkerContextObserver::OnVersionStartedRunning(
int64_t version_id,
const content::ServiceWorkerRunningInfo& running_info) { … }
void TestServiceWorkerContextObserver::OnVersionStoppedRunning(
int64_t version_id) { … }
void TestServiceWorkerContextObserver::OnVersionActivated(int64_t version_id,
const GURL& scope) { … }
void TestServiceWorkerContextObserver::OnDestruct(
content::ServiceWorkerContext* context) { … }
UnregisterWorkerObserver::UnregisterWorkerObserver(
ProcessManager* process_manager,
const ExtensionId& extension_id)
: … { … }
UnregisterWorkerObserver::~UnregisterWorkerObserver() = default;
void UnregisterWorkerObserver::OnStoppedTrackingServiceWorkerInstance(
const WorkerId& worker_id) { … }
void UnregisterWorkerObserver::WaitForUnregister() { … }
TestServiceWorkerTaskQueueObserver::TestServiceWorkerTaskQueueObserver() { … }
TestServiceWorkerTaskQueueObserver::~TestServiceWorkerTaskQueueObserver() { … }
void TestServiceWorkerTaskQueueObserver::WaitForWorkerStarted(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::WaitForWorkerStopped(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::WaitForWorkerContextInitialized(
const ExtensionId& extension_id) { … }
TestServiceWorkerTaskQueueObserver::WorkerStartFailedData
TestServiceWorkerTaskQueueObserver::WaitForDidStartWorkerFail(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::WaitForOnActivateExtension(
const ExtensionId& extension_id) { … }
bool TestServiceWorkerTaskQueueObserver::WaitForRegistrationMismatchMitigation(
const ExtensionId& extension_id) { … }
std::optional<bool>
TestServiceWorkerTaskQueueObserver::WillRegisterServiceWorker(
const ExtensionId& extension_id) const { … }
int TestServiceWorkerTaskQueueObserver::GetRequestedWorkerStartedCount(
const ExtensionId& extension_id) const { … }
void TestServiceWorkerTaskQueueObserver::DidStartWorker(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::DidStartWorkerFail(
const ExtensionId& extension_id,
size_t num_pending_tasks,
blink::ServiceWorkerStatusCode status_code) { … }
void TestServiceWorkerTaskQueueObserver::DidInitializeServiceWorkerContext(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::OnActivateExtension(
const ExtensionId& extension_id,
bool will_register_service_worker) { … }
void TestServiceWorkerTaskQueueObserver::RegistrationMismatchMitigated(
const ExtensionId& extension_id,
bool success) { … }
void TestServiceWorkerTaskQueueObserver::RequestedWorkerStart(
const ExtensionId& extension_id) { … }
void TestServiceWorkerTaskQueueObserver::DidStopServiceWorkerContext(
const ExtensionId& extension_id) { … }
}
}