#include "content/browser/devtools/devtools_background_services_context_impl.h"
#include <memory>
#include <string>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "content/browser/devtools/devtools_background_services.pb.h"
#include "content/browser/service_worker/embedded_worker_test_helper.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h"
#include "url/origin.h"
namespace content {
namespace {
_;
const std::string kEventName = …;
const std::string kInstanceId = …;
class TestBrowserClient : public ContentBrowserClient { … };
void DidRegisterServiceWorker(int64_t* out_service_worker_registration_id,
base::OnceClosure quit_closure,
blink::ServiceWorkerStatusCode status,
const std::string& status_message,
int64_t service_worker_registration_id) { … }
void DidFindServiceWorkerRegistration(
scoped_refptr<ServiceWorkerRegistration>* out_service_worker_registration,
base::OnceClosure quit_closure,
blink::ServiceWorkerStatusCode status,
scoped_refptr<ServiceWorkerRegistration> service_worker_registration) { … }
void DidGetLoggedBackgroundServiceEvents(
base::OnceClosure quit_closure,
std::vector<devtools::proto::BackgroundServiceEvent>* out_feature_states,
std::vector<devtools::proto::BackgroundServiceEvent> feature_states) { … }
}
class DevToolsBackgroundServicesContextTest
: public ::testing::Test,
DevToolsBackgroundServicesContextImpl::EventObserver { … };
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_NothingStoredWithRecordingModeOff …
#else
#define MAYBE_NothingStoredWithRecordingModeOff …
#endif
TEST_F(DevToolsBackgroundServicesContextTest,
MAYBE_NothingStoredWithRecordingModeOff) { … }
TEST_F(DevToolsBackgroundServicesContextTest, GetLoggedEvents) { … }
TEST_F(DevToolsBackgroundServicesContextTest, StopRecording) { … }
TEST_F(DevToolsBackgroundServicesContextTest, DelegateExpirationTimes) { … }
TEST_F(DevToolsBackgroundServicesContextTest, RecordingExpiration) { … }
TEST_F(DevToolsBackgroundServicesContextTest, ClearLoggedEvents) { … }
TEST_F(DevToolsBackgroundServicesContextTest, EventObserverCalled) { … }
}