#include "components/services/storage/service_worker/service_worker_storage_control_impl.h"
#include <cstdint>
#include <string>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/containers/span.h"
#include "base/files/scoped_temp_dir.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/services/storage/service_worker/service_worker_storage_test_utils.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_util.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
#include "services/network/public/mojom/url_response_head.mojom.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/navigation_preload_state.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace storage {
DatabaseStatus;
RegistrationData;
ResourceRecord;
namespace {
struct FindRegistrationResult { … };
struct ReadResponseHeadResult { … };
struct ReadDataResult { … };
struct GetRegistrationsForOriginResult { … };
struct DeleteRegistrationResult { … };
struct GetNewVersionIdResult { … };
struct GetUserDataResult { … };
struct GetUserDataByKeyPrefixResult { … };
struct GetUserKeysAndDataByKeyPrefixResult { … };
struct GetUserDataForAllRegistrationsResult { … };
struct GetUsageForStorageKeyResult { … };
ReadResponseHeadResult ReadResponseHead(
mojom::ServiceWorkerResourceReader* reader) { … }
ReadDataResult ReadResponseData(mojom::ServiceWorkerResourceReader* reader,
int data_size) { … }
int WriteResponseHead(mojom::ServiceWorkerResourceWriter* writer,
network::mojom::URLResponseHeadPtr response_head) { … }
int WriteResponseData(mojom::ServiceWorkerResourceWriter* writer,
mojo_base::BigBuffer data) { … }
int WriteResponseMetadata(mojom::ServiceWorkerResourceMetadataWriter* writer,
mojo_base::BigBuffer metadata) { … }
}
class ServiceWorkerStorageControlImplTest : public testing::Test { … };
TEST_F(ServiceWorkerStorageControlImplTest, FindRegistration_NoRegistration) { … }
TEST_F(ServiceWorkerStorageControlImplTest, StoreAndDeleteRegistration) { … }
TEST_F(ServiceWorkerStorageControlImplTest, UpdateToActiveState) { … }
TEST_F(ServiceWorkerStorageControlImplTest, UpdateLastUpdateCheckTime) { … }
TEST_F(ServiceWorkerStorageControlImplTest, UpdateFetchHandlerType) { … }
TEST_F(ServiceWorkerStorageControlImplTest, UpdateResourceSha256Checksums) { … }
TEST_F(ServiceWorkerStorageControlImplTest, Update) { … }
TEST_F(ServiceWorkerStorageControlImplTest, GetRegistrationsForStorageKey) { … }
TEST_F(ServiceWorkerStorageControlImplTest, WriteAndReadResource) { … }
TEST_F(ServiceWorkerStorageControlImplTest, UncommittedResources) { … }
TEST_F(ServiceWorkerStorageControlImplTest, DoomUncommittedResources) { … }
TEST_F(ServiceWorkerStorageControlImplTest, StoreAndGetUserData) { … }
TEST_F(ServiceWorkerStorageControlImplTest, StoreAndGetUserDataByKeyPrefix) { … }
TEST_F(ServiceWorkerStorageControlImplTest,
StoreAndGetUserDataForAllRegistrations) { … }
TEST_F(ServiceWorkerStorageControlImplTest, GetUsageForStorageKey) { … }
TEST_F(ServiceWorkerStorageControlImplTest, ApplyPolicyUpdates) { … }
TEST_F(ServiceWorkerStorageControlImplTest, TrackRunningVersion) { … }
}