Flutter Engine
The Flutter Engine
variable_refresh_rate_display_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
7
8#include "gtest/gtest.h"
9
10namespace flutter {
11namespace testing {
12
13TEST(VariableRefreshRateDisplayTest, ReportCorrectInitialRefreshRate) {
14 auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
16 0, std::weak_ptr<TestRefreshRateReporter>(refresh_rate_reporter), 600,
17 800, 60);
18 ASSERT_EQ(display.GetRefreshRate(), 60);
19}
20
21TEST(VariableRefreshRateDisplayTest, ReportCorrectRefreshRateWhenUpdated) {
22 auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
24 0, std::weak_ptr<TestRefreshRateReporter>(refresh_rate_reporter), 600,
25 800, 60);
26 refresh_rate_reporter->UpdateRefreshRate(30);
27 ASSERT_EQ(display.GetRefreshRate(), 30);
28}
29
30TEST(VariableRefreshRateDisplayTest,
31 Report0IfReporterSharedPointerIsDestroyedAfterDisplayCreation) {
32 auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
34 0, std::weak_ptr<TestRefreshRateReporter>(refresh_rate_reporter), 600,
35 800, 60);
36 refresh_rate_reporter.reset();
37 ASSERT_EQ(display.GetRefreshRate(), 0);
38}
39
40TEST(VariableRefreshRateDisplayTest,
41 Report0IfReporterSharedPointerIsDestroyedBeforeDisplayCreation) {
42 auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
43 refresh_rate_reporter.reset();
45 0, std::weak_ptr<TestRefreshRateReporter>(refresh_rate_reporter), 600,
46 800, 60);
47 ASSERT_EQ(display.GetRefreshRate(), 0);
48}
49
50} // namespace testing
51} // namespace flutter
A Display where the refresh rate can change over time.
TEST(DisplayListComplexity, EmptyDisplayList)