chromium/third_party/blink/renderer/core/loader/threadable_loader_test.cc

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

#include "third_party/blink/renderer/core/loader/threadable_loader.h"

#include <memory>

#include "base/containers/span.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "services/network/public/mojom/load_timing_info.mojom.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-blink.h"
#include "third_party/blink/public/mojom/timing/resource_timing.mojom-blink-forward.h"
#include "third_party/blink/public/platform/task_type.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/platform/web_worker_fetch_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/loader/threadable_loader.h"
#include "third_party/blink/renderer/core/loader/threadable_loader_client.h"
#include "third_party/blink/renderer/core/loader/worker_fetch_context.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h"
#include "third_party/blink/renderer/core/workers/worker_thread_test_helper.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_loader_mock_factory.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "ui/gfx/geometry/size.h"

namespace blink {

namespace {

_;
ElementsAre;
InSequence;
InvokeWithoutArgs;
Truly;
Checkpoint;

constexpr char kFileName[] =;

class MockThreadableLoaderClient final
    : public GarbageCollected<MockThreadableLoaderClient>,
      public ThreadableLoaderClient {};

bool IsCancellation(const ResourceError& error) {}

bool IsNotCancellation(const ResourceError& error) {}

KURL SuccessURL() {}
KURL ErrorURL() {}
KURL RedirectURL() {}

void SetUpSuccessURL() {}

void SetUpErrorURL() {}

void SetUpRedirectURL() {}

void SetUpMockURLs() {}

enum ThreadableLoaderToTest {};

class ThreadableLoaderTestHelper final {};

class ThreadableLoaderTest : public testing::Test {};

TEST_F(ThreadableLoaderTest, StartAndStop) {}

TEST_F(ThreadableLoaderTest, CancelAfterStart) {}

TEST_F(ThreadableLoaderTest, CancelAndClearAfterStart) {}

TEST_F(ThreadableLoaderTest, CancelInDidReceiveResponse) {}

TEST_F(ThreadableLoaderTest, CancelAndClearInDidReceiveResponse) {}

TEST_F(ThreadableLoaderTest, CancelInDidReceiveData) {}

TEST_F(ThreadableLoaderTest, CancelAndClearInDidReceiveData) {}

TEST_F(ThreadableLoaderTest, DidFinishLoading) {}

TEST_F(ThreadableLoaderTest, CancelInDidFinishLoading) {}

TEST_F(ThreadableLoaderTest, ClearInDidFinishLoading) {}

TEST_F(ThreadableLoaderTest, DidFail) {}

TEST_F(ThreadableLoaderTest, CancelInDidFail) {}

TEST_F(ThreadableLoaderTest, ClearInDidFail) {}

TEST_F(ThreadableLoaderTest, RedirectDidFinishLoading) {}

TEST_F(ThreadableLoaderTest, CancelInRedirectDidFinishLoading) {}

TEST_F(ThreadableLoaderTest, ClearInRedirectDidFinishLoading) {}

// TODO(crbug.com/1356128): Add unit tests to cover histogram logging.

}  // namespace

}  // namespace blink