chromium/components/services/storage/service_worker/service_worker_storage_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

// The *_BeforeInitialize tests exercise the API before LazyInitialize() is
// called.
TEST_F(ServiceWorkerStorageTest, StoreUserData_BeforeInitialize) {}

TEST_F(ServiceWorkerStorageTest, GetUserData_BeforeInitialize) {}

TEST_F(ServiceWorkerStorageTest, ClearUserData_BeforeInitialize) {}

TEST_F(ServiceWorkerStorageTest,
       GetUserDataForAllRegistrations_BeforeInitialize) {}

// Test fixture that uses disk storage, rather than memory. Useful for tests
// that test persistence by simulating browser shutdown and restart.
class ServiceWorkerStorageDiskTest : public ServiceWorkerStorageTest {};

TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver) {}

TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver_UnrelatedFileExists) {}

TEST_F(ServiceWorkerStorageDiskTest, DeleteAndStartOver_OpenedFileExists) {}

// Tests reading storage usage from database.
TEST_F(ServiceWorkerStorageTest, GetStorageUsageForOrigin) {}

}  // namespace service_worker_storage_unittest
}  // namespace storage