chromium/services/network/web_bundle/web_bundle_url_loader_factory_unittest.cc

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

#include "services/network/web_bundle/web_bundle_url_loader_factory.h"

#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/web_package/web_bundle_builder.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "mojo/public/cpp/system/functions.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/test/mock_devtools_observer.h"
#include "services/network/test/test_url_loader_client.h"
#include "services/network/web_bundle/web_bundle_memory_quota_consumer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace network {

namespace {

const char kInitiatorUrl[] =;
const char kBundleUrl[] =;
const char kBundleRequestId[] =;
const char kResourceUrl[] =;
const char kResourceUrl2[] =;
const char kResourceUrl3[] =;
const char kInvalidResourceUrl[] =;
const char kResourceRequestId[] =;
const char kResourceRequestId2[] =;
const char kResourceRequestId3[] =;

// Cross origin resources
const char kCrossOriginJsonUrl[] =;
const char kCrossOriginJsUrl[] =;

_;
ElementsAre;
Eq;
Optional;
Pointee;

std::vector<uint8_t> CreateSmallBundle() {}

std::vector<uint8_t> CreateLargeBundle() {}

std::vector<uint8_t> CreateCrossOriginBundle() {}

class TestWebBundleHandle : public mojom::WebBundleHandle {};

class MockMemoryQuotaConsumer : public WebBundleMemoryQuotaConsumer {};

class BadMessageTestHelper {};

}  // namespace

class WebBundleURLLoaderFactoryTest : public ::testing::Test {};

TEST_F(WebBundleURLLoaderFactoryTest, Basic) {}

TEST_F(WebBundleURLLoaderFactoryTest, MetadataParseError) {}

TEST_F(WebBundleURLLoaderFactoryTest, MetadataWithInvalidExchangeUrl) {}

TEST_F(WebBundleURLLoaderFactoryTest, ResponseParseError) {}

TEST_F(WebBundleURLLoaderFactoryTest, ResourceNotFoundInBundle) {}

TEST_F(WebBundleURLLoaderFactoryTest, RedirectResponseIsNotAllowed) {}

TEST_F(WebBundleURLLoaderFactoryTest, StartRequestBeforeReadingBundle) {}

TEST_F(WebBundleURLLoaderFactoryTest, MultipleRequests) {}

TEST_F(WebBundleURLLoaderFactoryTest, CancelRequest) {}

TEST_F(WebBundleURLLoaderFactoryTest,
       FactoryDestructionCancelsInflightRequests) {}

TEST_F(WebBundleURLLoaderFactoryTest, TruncatedBundle) {}

TEST_F(WebBundleURLLoaderFactoryTest, CrossOriginJson) {}

TEST_F(WebBundleURLLoaderFactoryTest, CrossOriginJs) {}

TEST_F(WebBundleURLLoaderFactoryTest, WrongBundleURL) {}

}  // namespace network