SF: Add test for FrameStats refresh rate
Adds a Transaction_test to ensure that the refresh rate field of
FrameStats is properly initialized. This is also caught by CTS, but
adding the test here should avoid a long round-trip time.
Bug: 111854867
Test: Manual, test catches regression fixed by ag/4663082
Change-Id: I4db5fba6a05dbcd5d8566dd215756e0c49bd1053
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index bde6614..4ab4fec 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -1422,6 +1422,19 @@
}
}
+TEST_P(LayerTypeTransactionTest, RefreshRateIsInitialized) {
+ sp<SurfaceControl> layer;
+ ASSERT_NO_FATAL_FAILURE(layer = createLayer("test", 32, 32));
+
+ sp<IBinder> handle = layer->getHandle();
+ ASSERT_TRUE(handle != nullptr);
+
+ FrameStats frameStats;
+ mClient->getLayerFrameStats(handle, &frameStats);
+
+ ASSERT_GT(frameStats.refreshPeriodNano, static_cast<nsecs_t>(0));
+}
+
TEST_F(LayerTransactionTest, SetCropBasic_BufferQueue) {
sp<SurfaceControl> layer;
ASSERT_NO_FATAL_FAILURE(layer = createLayer("test", 32, 32));