chromium/pdf/loader/url_loader_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 "pdf/loader/url_loader.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/mock_callback.h"
#include "net/base/net_errors.h"
#include "net/cookies/site_for_cookies.h"
#include "pdf/loader/result_codes.h"
#include "pdf/test/mock_web_associated_url_loader.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_http_body.h"
#include "third_party/blink/public/platform/web_http_header_visitor.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/platform/web_url_response.h"
#include "third_party/blink/public/web/web_associated_url_loader.h"
#include "third_party/blink/public/web/web_associated_url_loader_client.h"
#include "third_party/blink/public/web/web_associated_url_loader_options.h"
#include "url/gurl.h"

namespace chrome_pdf {
namespace {

Each;
ElementsAreArray;
InSequence;
Invoke;
NiceMock;
Return;
ReturnNull;
SaveArg;
UnorderedElementsAreArray;

constexpr char kOriginUrl[] =;
constexpr char kDocumentUrl[] =;
constexpr base::span<const char> kFakeData =;

size_t GetRequestHeaderCount(const blink::WebURLRequest& request) {}

blink::WebURLError MakeWebURLError(int reason) {}

class FakeUrlLoaderClient : public UrlLoader::Client {};

class UrlLoaderTest : public testing::Test {};

TEST_F(UrlLoaderTest, Open) {}

TEST_F(UrlLoaderTest, OpenWithInvalidatedClientWeakPtr) {}

TEST_F(UrlLoaderTest, OpenWithInvalidatedClient) {}

TEST_F(UrlLoaderTest, OpenWithRelativeUrl) {}

TEST_F(UrlLoaderTest, OpenWithHeaders) {}

TEST_F(UrlLoaderTest, OpenWithBody) {}

TEST_F(UrlLoaderTest, OpenWithCustomReferrerUrl) {}

TEST_F(UrlLoaderTest, WillFollowRedirect) {}

TEST_F(UrlLoaderTest, WillFollowRedirectWhileIgnoringRedirects) {}

TEST_F(UrlLoaderTest, DidReceiveResponse) {}

TEST_F(UrlLoaderTest, DidReceiveResponseWithHeaders) {}

TEST_F(UrlLoaderTest, DidReceiveData) {}

TEST_F(UrlLoaderTest, DidReceiveDataWithZeroLength) {}

TEST_F(UrlLoaderTest, DidReceiveDataBelowUpperThreshold) {}

TEST_F(UrlLoaderTest, DidReceiveDataCrossUpperThreshold) {}

TEST_F(UrlLoaderTest, DidReceiveDataAboveUpperThreshold) {}

TEST_F(UrlLoaderTest, ReadResponseBody) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWithoutData) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWithEmptyBuffer) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWithSmallerBuffer) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWithBiggerBuffer) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWhileLoadComplete) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWhileLoadCompleteWithoutData) {}

TEST_F(UrlLoaderTest, ReadResponseBodyWhileLoadCompleteWithError) {}

TEST_F(UrlLoaderTest, ReadResponseBodyAboveLowerThreshold) {}

TEST_F(UrlLoaderTest, ReadResponseBodyCrossLowerThreshold) {}

TEST_F(UrlLoaderTest, ReadResponseBodyBelowLowerThreshold) {}

TEST_F(UrlLoaderTest, DidFinishLoading) {}

TEST_F(UrlLoaderTest, DidFinishLoadingWithPendingCallback) {}

TEST_F(UrlLoaderTest, DidFailWhileOpening) {}

TEST_F(UrlLoaderTest, DidFailWhileStreamingData) {}

TEST_F(UrlLoaderTest, DidFailWithErrorAccessDenied) {}

TEST_F(UrlLoaderTest, DidFailWithErrorNetworkAccessDenied) {}

TEST_F(UrlLoaderTest, DidFailWithWebSecurityViolationError) {}

TEST_F(UrlLoaderTest, CloseWhileWaitingToOpen) {}

TEST_F(UrlLoaderTest, CloseWhileOpening) {}

TEST_F(UrlLoaderTest, CloseWhileStreamingData) {}

TEST_F(UrlLoaderTest, CloseWhileStreamingDataWithPendingCallback) {}

TEST_F(UrlLoaderTest, CloseWhileLoadComplete) {}

TEST_F(UrlLoaderTest, CloseAgain) {}

}  // namespace
}  // namespace chrome_pdf