chromium/third_party/blink/renderer/core/view_transition/view_transition_test.cc

// Copyright 2020 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/view_transition/view_transition.h"

#include <memory>

#include "base/check_op.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "cc/view_transition/view_transition_request.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_view_transition_callback.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/html/html_head_element.h"
#include "third_party/blink/renderer/core/inspector/inspector_style_resolver.h"
#include "third_party/blink/renderer/core/layout/layout_shift_tracker.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_api.h"
#include "third_party/blink/renderer/core/navigation_api/navigation_history_entry.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/style/computed_style_constants.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/mock_function_scope.h"
#include "third_party/blink/renderer/core/timing/layout_shift.h"
#include "third_party/blink/renderer/core/view_transition/dom_view_transition.h"
#include "third_party/blink/renderer/core/view_transition/view_transition_supplement.h"
#include "third_party/blink/renderer/core/view_transition/view_transition_utils.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.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/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "v8/include/v8-external.h"
#include "v8/include/v8-function-callback.h"
#include "v8/include/v8-function.h"
#include "v8/include/v8-value.h"

namespace blink {

class ViewTransitionTest : public testing::Test,
                           public PaintTestConfigurations,
                           private ScopedViewTransitionOnNavigationForTest {};

INSTANTIATE_PAINT_TEST_SUITE_P();

TEST_P(ViewTransitionTest, LayoutShift) {}

TEST_P(ViewTransitionTest, TransitionCreatesNewObject) {}

TEST_P(ViewTransitionTest, TransitionReadyPromiseResolves) {}

TEST_P(ViewTransitionTest, PrepareTransitionElementsWantToBeComposited) {}

TEST_P(ViewTransitionTest, StartTransitionElementsWantToBeComposited) {}

TEST_P(ViewTransitionTest, TransitionCleanedUpBeforePromiseResolution) {}

TEST_P(ViewTransitionTest, RenderingPausedTest) {}

TEST_P(ViewTransitionTest, Abandon) {}

// Checks that the pseudo element tree is correctly build for ::transition*
// pseudo elements.
TEST_P(ViewTransitionTest, ViewTransitionPseudoTree) {}

TEST_P(ViewTransitionTest, ViewTransitionElementInvalidation) {}

TEST_P(ViewTransitionTest, InspectorStyleResolver) {}

TEST_P(ViewTransitionTest, VirtualKeyboardDoesntAffectSnapshotSize) {}

TEST_P(ViewTransitionTest, DocumentWithNoDocumentElementHasNullTransition) {}

TEST_P(ViewTransitionTest, RootEffectLifetime) {}

TEST_P(ViewTransitionTest, PseudoAwareChildTraversal) {}

TEST_P(ViewTransitionTest, PseudoAwareSiblingTraversal) {}

TEST_P(ViewTransitionTest, IncludingPseudoTraversal) {}

// This test was added because of a crash in getAnimations. The crash would
// occur because getAnimations attempts to sort the animations into compositing
// order. The comparator used uses tree order in some situations which requires
// pseudo elements to implement tree traversal methods. The crash occurred only
// on Android, probably due to differences in the std::sort implementation.
TEST_P(ViewTransitionTest, GetAnimationsCrashTest) {}

TEST_P(ViewTransitionTest, ScriptCallAfterNavigationTransition) {}

TEST_P(ViewTransitionTest, NoEffectOnIframe) {}

TEST_P(ViewTransitionTest, SubframeSnapshotLayer) {}

}  // namespace blink