chromium/cc/animation/scroll_timeline_unittest.cc

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

#include "cc/animation/scroll_timeline.h"

#include <limits>
#include <vector>

#include "cc/trees/property_tree.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/transform_node.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/point_f.h"

namespace cc {

namespace {

// Only expect precision up to 1 microsecond for double conversion error (mainly
// due to timeline time getting converted between double and TimeTick).
static constexpr double time_error_ms =;

#define EXPECT_SCROLL_TIMELINE_TIME_NEAR(expected, value)

#define EXPECT_SCROLL_TIMELINE_BEFORE_START(value)

#define EXPECT_SCROLL_TIMELINE_AFTER_END(value, duration)

void SetScrollOffset(PropertyTrees* property_trees,
                     ElementId scroller_id,
                     gfx::PointF offset) {}

void CreateScrollingElement(PropertyTrees* property_trees,
                            ElementId scroller_id,
                            gfx::Size content_size,
                            gfx::Size container_size) {}

// Helper method to calculate the current time, implementing only step 5 of
// https://wicg.github.io/scroll-animations/#current-time-algorithm
base::TimeTicks CalculateCurrentTime(double current_scroll_offset,
                                     double start_scroll_offset) {}

// Helper method to convert base::TimeTicks to double.
// Returns double milliseconds if the input value is resolved or
// std::numeric_limits<double>::quiet_NaN() otherwise.
double ToDouble(std::optional<base::TimeTicks> time_ticks) {}

}  // namespace

class ScrollTimelineTest : public ::testing::Test,
                           public ProtectedSequenceSynchronizer {};

TEST_F(ScrollTimelineTest, BasicCurrentTimeCalculations) {}

// This test ensures that the ScrollTimeline's active scroller id is correct. We
// had a few crashes caused by assuming that the id would be available in the
// active tree before the activation happened; see http://crbug.com/853231
TEST_F(ScrollTimelineTest, ActiveTimeIsSetOnlyAfterPromotion) {}

TEST_F(ScrollTimelineTest, CurrentTimeIsAdjustedForPixelSnapping) {}

TEST_F(ScrollTimelineTest, CurrentTimeHandlesStartScrollOffset) {}

TEST_F(ScrollTimelineTest, CurrentTimeHandlesEndScrollOffset) {}

TEST_F(ScrollTimelineTest, CurrentTimeHandlesCombinedStartAndEndScrollOffset) {}

// TODO(kevers): Zero duration animations are not composited. Disabled the test.
// Should this become important in the future, we can revisit.
TEST_F(ScrollTimelineTest,
       DISABLED_CurrentTimeHandlesEqualStartAndEndScrollOffset) {}

// TODO(kevers): Scroll offsets cannot be out of order with the current design.
// Disabled the test. Revisit if the ordering can be reversed in the future.
TEST_F(ScrollTimelineTest,
       DISABLED_CurrentTimeHandlesStartOffsetLargerThanEndScrollOffset) {}

TEST_F(ScrollTimelineTest, CurrentTimeHandlesScrollOffsets) {}

TEST_F(ScrollTimelineTest, Activeness) {}

}  // namespace cc