chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_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 "base/functional/callback.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "cc/base/features.h"
#include "cc/layers/picture_layer.h"
#include "cc/paint/paint_record.h"
#include "cc/paint/paint_recorder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/test/test_web_frame_content_dumper.h"
#include "third_party/blink/public/web/web_hit_test_result.h"
#include "third_party/blink/public/web/web_print_params.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_init.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_impl.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/intersection_observer/intersection_observer.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/resize_observer/resize_observer.h"
#include "third_party/blink/renderer/core/resize_observer/resize_observer_entry.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/intersection_observer_test_helper.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/graphics/compositing/paint_artifact_compositor.h"
#include "third_party/blink/renderer/platform/graphics/logging_canvas.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
#include "third_party/blink/renderer/platform/graphics/paint/transform_paint_property_node.h"
#include "third_party/blink/renderer/platform/testing/find_cc_layer.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"

_;

namespace blink {

kStyleAttr;

// NOTE: This test uses <iframe sandbox> to create cross origin iframes.

// This should not conflict with the existing PaintTestConfiguration bits.
enum {};

class FrameThrottlingTest : public PaintTestConfigurations,
                            public SimTest,
                            private ScopedIntersectionOptimizationForTest {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(FrameThrottlingTest, ThrottleInvisibleFrames) {}

TEST_P(FrameThrottlingTest, HiddenSameOriginFramesAreNotThrottled) {}

TEST_P(FrameThrottlingTest, HiddenCrossOriginFramesAreThrottled) {}

TEST_P(FrameThrottlingTest, IntersectionObservationOverridesThrottling) {}

TEST_P(FrameThrottlingTest, NestedIntersectionObservationStateUpdated) {}

// This test creates a throttled local root (simulating a throttled OOPIF) and
// ensures the intersection observation state of descendants can still be
// updated.
TEST_P(FrameThrottlingTest,
       IntersectionObservationStateUpdatedWithThrottledLocalRoot) {}

TEST_P(FrameThrottlingTest,
       ThrottlingOverrideOnlyAppliesDuringLifecycleUpdate) {}

TEST_P(FrameThrottlingTest, ForAllThrottledLocalFrameViews) {}

TEST_P(FrameThrottlingTest, HiddenCrossOriginDisplayNoneFramesAreThrottled) {}

TEST_P(FrameThrottlingTest, ThrottledLifecycleUpdate) {}

TEST_P(FrameThrottlingTest, UnthrottlingFrameSchedulesAnimation) {}

TEST_P(FrameThrottlingTest, ThrottledFrameCompositing) {}

TEST_P(FrameThrottlingTest, MutatingThrottledFrameDoesNotCauseAnimation) {}

TEST_P(FrameThrottlingTest, SynchronousLayoutInThrottledFrame) {}

TEST_P(FrameThrottlingTest, UnthrottlingTriggersRepaint) {}

TEST_P(FrameThrottlingTest, UnthrottlingTriggersRepaintInCompositedChild) {}

TEST_P(FrameThrottlingTest, ChangeStyleInThrottledFrame) {}

TEST_P(FrameThrottlingTest, ChangeOriginInThrottledFrame) {}

TEST_P(FrameThrottlingTest, MainFrameOriginChangeInvalidatesDescendants) {}

TEST_P(FrameThrottlingTest, ThrottledFrameWithFocus) {}

TEST_P(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledFrame) {}

TEST_P(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledLayer) {}

TEST_P(FrameThrottlingTest,
       ScrollingCoordinatorShouldSkipCompositedThrottledFrame) {}

TEST_P(FrameThrottlingTest, UnthrottleByTransformingWithoutLayout) {}

TEST_P(FrameThrottlingTest, DumpThrottledFrame) {}

TEST_P(FrameThrottlingTest, ThrottleInnerCompositedLayer) {}

TEST_P(FrameThrottlingTest, ThrottleSubtreeAtomically) {}

TEST_P(FrameThrottlingTest, SkipPaintingLayersInThrottledFrames) {}

TEST_P(FrameThrottlingTest, SynchronousLayoutInAnimationFrameCallback) {}

TEST_P(FrameThrottlingTest, AllowOneAnimationFrame) {}

TEST_P(FrameThrottlingTest, UpdatePaintPropertiesOnUnthrottling) {}

TEST_P(FrameThrottlingTest, DisplayNoneNotThrottled) {}

TEST_P(FrameThrottlingTest, DisplayNoneChildrenRemainThrottled) {}

TEST_P(FrameThrottlingTest, LifecycleUpdateAfterUnthrottledCompositingUpdate) {}

TEST_P(FrameThrottlingTest, NestedFramesInRemoteFrameHiddenAndShown) {}

TEST_P(FrameThrottlingTest, LifecycleThrottledFrameNeedsRepaint) {}

namespace {

class TestEventListener : public NativeEventListener {};

}  // namespace

TEST_P(FrameThrottlingTest, ThrottledIframeGetsResizeEvents) {}

TEST_P(FrameThrottlingTest, AncestorTouchActionAndWheelEventHandlers) {}

TEST_P(FrameThrottlingTest, DescendantTouchActionAndWheelEventHandlers) {}

namespace {

class TestResizeObserverDelegate : public ResizeObserver::Delegate {};

}  // namespace

TEST_P(FrameThrottlingTest, ForceUnthrottled) {}

TEST_P(FrameThrottlingTest, CullRectUpdate) {}

TEST_P(FrameThrottlingTest, ClearPaintArtifactOnThrottlingLocalRoot) {}

TEST_P(FrameThrottlingTest, PrintThrottledFrame) {}

}  // namespace blink