chromium/third_party/blink/renderer/core/html/lazy_load_image_observer_test.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/html/lazy_load_image_observer.h"

#include <optional>
#include <tuple>

#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/style_image.h"
#include "third_party/blink/renderer/core/testing/sim/sim_compositor.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_request.h"
#include "third_party/blink/renderer/platform/network/network_state_notifier.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"

namespace blink {

namespace {

const Vector<char>& TestImage() {}

class LazyLoadImagesSimTest : public SimTest {};

TEST_F(LazyLoadImagesSimTest, ImgSrcset) {}

class LazyLoadImagesParamsTest
    : public SimTest,
      public ::testing::WithParamInterface<WebEffectiveConnectionType> {};

TEST_P(LazyLoadImagesParamsTest, NearViewport) {}

TEST_P(LazyLoadImagesParamsTest, FarFromViewport) {}

INSTANTIATE_TEST_SUITE_P();

class LazyLoadImagesTest : public SimTest {};

TEST_F(LazyLoadImagesTest, LoadAllImagesIfPrinting) {}

TEST_F(LazyLoadImagesTest, LoadAllImagesIfPrintingIFrame) {}

TEST_F(LazyLoadImagesTest, AttributeChangedFromLazyToEager) {}

TEST_F(LazyLoadImagesTest, AttributeChangedFromAutoToEager) {}

TEST_F(LazyLoadImagesTest, AttributeChangedFromUnsetToEager) {}

TEST_F(LazyLoadImagesTest, ImageInsideLazyLoadedFrame) {}

// Allow lazy loading of file:/// urls.
TEST_F(LazyLoadImagesTest, LazyLoadFileUrls) {}

// This is a regression test added for https://crbug.com/1213045, which was
// filed for a memory leak whereby lazy loaded images currently being deferred
// but that were removed from the DOM were never actually garbage collected.
TEST_F(LazyLoadImagesTest, GarbageCollectDeferredLazyLoadImages) {}

// This is a regression test added for https://crbug.com/40071424, which was
// filed as a result of outstanding decode promises *not* keeping an underlying
// lazyload-deferred image alive, even after removal from the DOM. Images of
// this sort must kept alive for the underlying decode request promise's sake.
TEST_F(LazyLoadImagesTest, DeferredLazyLoadImagesKeptAliveForDecodeRequest) {}

}  // namespace

}  // namespace blink