chromium/third_party/blink/renderer/core/html/parser/html_preload_scanner_test.cc

// Copyright 2015 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/html/parser/html_preload_scanner.h"

#include <memory>

#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "services/network/public/mojom/attribution.mojom-blink.h"
#include "services/network/public/mojom/web_client_hints_types.mojom-blink.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/renderer/core/css/media_values_cached.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/cross_origin_attribute.h"
#include "third_party/blink/renderer/core/html/parser/background_html_scanner.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_options.h"
#include "third_party/blink/renderer/core/html/parser/html_resource_preloader.h"
#include "third_party/blink/renderer/core/html/parser/html_tokenizer.h"
#include "third_party/blink/renderer/core/html/parser/preload_request.h"
#include "third_party/blink/renderer/core/lcp_critical_path_predictor/element_locator.h"
#include "third_party/blink/renderer/core/media_type_names.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/exported/wrapped_resource_response.h"
#include "third_party/blink/renderer/platform/loader/fetch/client_hints_preferences.h"
#include "third_party/blink/renderer/platform/network/http_names.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/security_origin.h"

namespace blink {

struct PreloadScannerTestCase {};

struct RenderBlockingTestCase {};

struct HTMLPreconnectTestCase {};

struct ReferrerPolicyTestCase {};

struct CorsTestCase {};

struct CSPTestCase {};

struct NonceTestCase {};

struct ContextTestCase {};

struct IntegrityTestCase {};

struct LazyLoadImageTestCase {};

struct AttributionSrcTestCase {};

struct TokenStreamMatcherTestCase {};

struct SharedStorageWritableTestCase {};

class HTMLMockHTMLResourcePreloader : public ResourcePreloader {};

class HTMLPreloadScannerTest : public PageTestBase {};

TEST_F(HTMLPreloadScannerTest, testImages) {}

TEST_F(HTMLPreloadScannerTest, testImagesWithViewport) {}

TEST_F(HTMLPreloadScannerTest, testImagesWithViewportDeviceWidth) {}

TEST_F(HTMLPreloadScannerTest, testImagesWithViewportDisabled) {}

TEST_F(HTMLPreloadScannerTest, testViewportNoContent) {}

TEST_F(HTMLPreloadScannerTest, testMetaAcceptCH) {}

TEST_F(HTMLPreloadScannerTest, testMetaAcceptCHInsecureDocument) {}

TEST_F(HTMLPreloadScannerTest, testRenderBlocking) {}

TEST_F(HTMLPreloadScannerTest, testPreconnect) {}

TEST_F(HTMLPreloadScannerTest, testDisables) {}

TEST_F(HTMLPreloadScannerTest, testPicture) {}

TEST_F(HTMLPreloadScannerTest, testContext) {}

TEST_F(HTMLPreloadScannerTest, testReferrerPolicy) {}

TEST_F(HTMLPreloadScannerTest, testCors) {}

TEST_F(HTMLPreloadScannerTest, testCSP) {}

TEST_F(HTMLPreloadScannerTest, testNonce) {}

TEST_F(HTMLPreloadScannerTest, testAttributionSrc) {}

// Tests that a document-level referrer policy (e.g. one set by HTTP header) is
// applied for preload requests.
TEST_F(HTMLPreloadScannerTest, testReferrerPolicyOnDocument) {}

TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) {}

TEST_F(HTMLPreloadScannerTest, testNoDataUrls) {}

// The preload scanner should follow the same policy that the ScriptLoader does
// with regard to the type and language attribute.
TEST_F(HTMLPreloadScannerTest, testScriptTypeAndLanguage) {}

// Regression test for crbug.com/664744.
TEST_F(HTMLPreloadScannerTest, testUppercaseAsValues) {}

TEST_F(HTMLPreloadScannerTest, ReferrerHeader) {}

TEST_F(HTMLPreloadScannerTest, Integrity) {}

// Regression test for http://crbug.com/898795 where preloads after a
// dynamically inserted meta csp tag are dispatched on subsequent calls to the
// HTMLPreloadScanner, after they had been parsed.
TEST_F(HTMLPreloadScannerTest, MetaCsp_NoPreloadsAfter) {}

TEST_F(HTMLPreloadScannerTest, LazyLoadImage) {}

// https://crbug.com/1087854
TEST_F(HTMLPreloadScannerTest, CSSImportWithSemicolonInUrl) {}

// https://crbug.com/1181291
TEST_F(HTMLPreloadScannerTest, TemplateInteractions) {}

// Regression test for https://crbug.com/1181291
TEST_F(HTMLPreloadScannerTest, JavascriptBaseUrl) {}

TEST_F(HTMLPreloadScannerTest, OtherRulesBeforeImport) {}

TEST_F(HTMLPreloadScannerTest, PreloadLayeredImport) {}

TEST_F(HTMLPreloadScannerTest, TokenStreamMatcher) {}

TEST_F(HTMLPreloadScannerTest, testSharedStorageWritable) {}

enum class LcppPreloadLazyLoadImageType {};

class HTMLPreloadScannerLCPPLazyLoadImageTest
    : public HTMLPreloadScannerTest,
      public testing::WithParamInterface<LcppPreloadLazyLoadImageType> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(HTMLPreloadScannerLCPPLazyLoadImageTest,
       TokenStreamMatcherWithLoadingLazy) {}

TEST_P(HTMLPreloadScannerLCPPLazyLoadImageTest,
       TokenStreamMatcherWithLoadingLazyAutoSizes) {}

TEST_F(HTMLPreloadScannerTest, PreloadScanDisabled_NoPreloads) {}

}  // namespace blink