#include "content/browser/service_worker/service_worker_single_script_update_checker.h"
#include <vector>
#include "base/containers/queue.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_test_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/base/load_flags.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/parsed_headers.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
constexpr char kScriptURL[] = …;
constexpr char kImportedScriptURL[] = …;
constexpr char kScope[] = …;
constexpr char kSuccessHeader[] = …;
class ServiceWorkerSingleScriptUpdateCheckerTest : public testing::Test { … };
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, Identical_SingleRead) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, Identical_MultipleRead) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, Identical_Empty) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_SingleRead_NetworkIsLonger) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_SingleRead_StorageIsLonger) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_SingleRead_EndOfTheBodyFirst) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_SingleRead_DifferentBody) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_MultipleRead_NetworkIsLonger) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_MultipleRead_StorageIsLonger) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
Different_MultipleRead_DifferentBody) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
PendingReadWithErrorStatusShouldNotLeak) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, UpdateViaCache_All) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, UpdateViaCache_None) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, UpdateViaCache_Imports) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, ScriptType_Classic_Main) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
ScriptType_Classic_StaticImport) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, ScriptType_Module_Main) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest,
ScriptType_Module_StaticImport) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, ForceBypassCache) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, MoreThan24Hours) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, MimeTypeError) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, PathRestrictionError) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, PathRestrictionPass) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, NetworkError) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, RequestSSLInfo_Classic) { … }
TEST_F(ServiceWorkerSingleScriptUpdateCheckerTest, RequestSSLInfo_Module) { … }
class ServiceWorkerSingleScriptUpdateCheckerSha256ChecksumTest
: public ServiceWorkerSingleScriptUpdateCheckerTest,
public testing::WithParamInterface<
ServiceWorkerSingleScriptUpdateChecker::ScriptChecksumUpdateOption> { … };
TEST_P(ServiceWorkerSingleScriptUpdateCheckerSha256ChecksumTest, Identical) { … }
TEST_P(ServiceWorkerSingleScriptUpdateCheckerSha256ChecksumTest, Different) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}