#include "services/network/web_bundle/web_bundle_manager.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/unguessable_token.h"
#include "components/web_package/web_bundle_builder.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/devtools_observer.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/web_bundle_handle.mojom.h"
#include "services/network/test/test_url_loader_client.h"
#include "services/network/web_bundle/web_bundle_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
const char kInitiatorUrl[] = …;
const char kBundleUrl[] = …;
const char kResourceUrl[] = …;
const char kQuotaExceededErrorMessage[] = …;
const int32_t process_id1 = …;
const int32_t process_id2 = …;
std::string CreateSmallBundleString() { … }
class TestWebBundleHandle : public mojom::WebBundleHandle { … };
std::tuple<base::WeakPtr<WebBundleURLLoaderFactory>,
std::unique_ptr<TestWebBundleHandle>>
CreateWebBundleLoaderFactory(WebBundleManager& manager, int32_t process_id) { … }
mojo::ScopedDataPipeProducerHandle SetBundleStream(
WebBundleURLLoaderFactory& factory) { … }
std::tuple<mojo::Remote<network::mojom::URLLoader>,
std::unique_ptr<network::TestURLLoaderClient>>
StartSubresourceLoad(WebBundleURLLoaderFactory& factory) { … }
}
class WebBundleManagerTest : public testing::Test { … };
TEST_F(WebBundleManagerTest, NoFactoryExistsForDifferentProcessId) { … }
TEST_F(WebBundleManagerTest, UseProcesIdInTokenParamsForRequestsFromBrowser) { … }
TEST_F(WebBundleManagerTest, RemoveFactoryWhenDisconnected) { … }
TEST_F(WebBundleManagerTest,
SubresourceRequestArrivesEarlierThanBundleRequest) { … }
TEST_F(WebBundleManagerTest, CleanUpPendingLoadersIfWebBundleRequestIsBlocked) { … }
TEST_F(WebBundleManagerTest, MemoryQuota_StartRequestAfterError) { … }
TEST_F(WebBundleManagerTest, MemoryQuota_StartRequestBeforeReceivingBundle) { … }
TEST_F(WebBundleManagerTest, MemoryQuota_QuotaErrorWhileReadingBody) { … }
TEST_F(WebBundleManagerTest, MemoryQuota_QuotaErrorWhileParsingManifest) { … }
TEST_F(WebBundleManagerTest, MemoryQuota_ProcessIsolation) { … }
TEST_F(WebBundleManagerTest, WebBundleURLRedirection) { … }
}