#include "third_party/blink/renderer/core/loader/resource/font_resource.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/core/css/css_font_face_src_value.h"
#include "third_party/blink/renderer/core/css/css_uri_value.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/loader/resource/mock_font_resource_client.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_response.h"
#include "third_party/blink/renderer/platform/loader/fetch/background_code_cache_host.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.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_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader.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/loader/fetch/resource_status.h"
#include "third_party/blink/renderer/platform/loader/fetch/url_loader/background_url_loader.h"
#include "third_party/blink/renderer/platform/loader/testing/fake_background_resource_fetch_assets.h"
#include "third_party/blink/renderer/platform/loader/testing/fake_resource_load_info_notifier.h"
#include "third_party/blink/renderer/platform/loader/testing/fake_url_loader_factory_for_background_thread.h"
#include "third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h"
#include "third_party/blink/renderer/platform/loader/testing/mock_resource_client.h"
#include "third_party/blink/renderer/platform/loader/testing/test_loader_factory.h"
#include "third_party/blink/renderer/platform/loader/testing/test_resource_fetcher_properties.h"
#include "third_party/blink/renderer/platform/testing/mock_context_lifecycle_notifier.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.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"
namespace blink {
class FontResourceTest : public testing::Test { … };
class CacheAwareFontResourceTest : public FontResourceTest { … };
class FontResourceStrongReferenceTest : public FontResourceTest { … };
TEST_F(FontResourceTest,
ResourceFetcherRevalidateDeferedResourceFromTwoInitiators) { … }
TEST_F(FontResourceTest, RevalidationPolicyMetrics) { … }
TEST_F(CacheAwareFontResourceTest, CacheAwareFontLoading) { … }
TEST_F(FontResourceStrongReferenceTest, FontResourceStrongReference) { … }
TEST_F(FontResourceStrongReferenceTest, FollowCacheControl) { … }
namespace {
LoadStartCallback;
class FakeLoaderFactory final : public ResourceFetcher::LoaderFactory { … };
class TestFontResourceClient final
: public GarbageCollected<TestFontResourceClient>,
public FontResourceClient { … };
network::mojom::URLResponseHeadPtr CreateTestResponse() { … }
mojo::ScopedDataPipeConsumerHandle CreateDataPipeConsumerHandleFilledWithString(
const std::string& string) { … }
mojo::ScopedDataPipeConsumerHandle CreateTestFontDataPipe() { … }
mojo::ScopedDataPipeConsumerHandle CreateTestTooSmallFontDataPipe() { … }
}
class FontResourceBackgroundProcessorTest : public testing::Test { … };
int FontResourceBackgroundProcessorTest::url_counter_ = …;
TEST_F(FontResourceBackgroundProcessorTest, Basic) { … }
TEST_F(FontResourceBackgroundProcessorTest, InvalidFontData) { … }
}