#include "components/services/storage/service_worker/service_worker_storage.h"
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace storage {
namespace service_worker_storage_unittest {
struct ReadResponseHeadResult { … };
ResourceRecord;
ResourceList;
ResourceRecord CreateResourceRecord(int64_t resource_id,
const GURL& url,
int64_t size_bytes) { … }
mojom::ServiceWorkerRegistrationDataPtr CreateRegistrationData(
int64_t registration_id,
int64_t version_id,
const GURL& scope,
const blink::StorageKey& key,
const GURL& script_url,
const std::vector<ResourceRecord>& resources) { … }
void DatabaseStatusCallback(
base::OnceClosure quit_closure,
std::optional<ServiceWorkerDatabase::Status>* result,
ServiceWorkerDatabase::Status status) { … }
class ServiceWorkerStorageTest : public testing::Test { … };
TEST_F(ServiceWorkerStorageTest, DisabledStorage) { … }
TEST_F(ServiceWorkerStorageTest, StoreUserData) { … }
TEST_F(ServiceWorkerStorageTest, StoreUserData_BeforeInitialize) { … }
TEST_F(ServiceWorkerStorageTest, GetUserData_BeforeInitialize) { … }
TEST_F(ServiceWorkerStorageTest, ClearUserData_BeforeInitialize) { … }
TEST_F(ServiceWorkerStorageTest,
GetUserDataForAllRegistrations_BeforeInitialize) { … }
class ServiceWorkerStorageDiskTest : public ServiceWorkerStorageTest { … };
TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver) { … }
TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver_UnrelatedFileExists) { … }
TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver_OpenedFileExists) { … }
TEST_F(ServiceWorkerStorageTest, GetStorageUsageForOrigin) { … }
}
}