diff --git a/rosen/test/render_frame_trace/unittest/frame_rate_report_test.cpp b/rosen/test/render_frame_trace/unittest/frame_rate_report_test.cpp index 3995a16e2e..23d5a971d4 100644 --- a/rosen/test/render_frame_trace/unittest/frame_rate_report_test.cpp +++ b/rosen/test/render_frame_trace/unittest/frame_rate_report_test.cpp @@ -48,7 +48,8 @@ HWTEST_F(FrameRateReportTest, SendFrameRates001, TestSize.Level1) FrameRateReport::GetInstance().SendFrameRates(rates); rates[1008] = 60; rates[-1] = 120; - FrameRateReport::GetInstance().SendFrameRates(rates); + bool ret = FrameRateReport::GetInstance().SendFrameRates(rates); + EXPECT_EQ(ret, false); } /** diff --git a/rosen/test/render_frame_trace/unittest/render_frame_trace_impl_test.cpp b/rosen/test/render_frame_trace/unittest/render_frame_trace_impl_test.cpp index ff3c5bab0e..99b7445310 100644 --- a/rosen/test/render_frame_trace/unittest/render_frame_trace_impl_test.cpp +++ b/rosen/test/render_frame_trace/unittest/render_frame_trace_impl_test.cpp @@ -101,6 +101,8 @@ HWTEST_F(RenderFrameTraceImplTest, RenderFrameTraceClose, TestSize.Level1) HWTEST_F(RenderFrameTraceImplTest, ui, TestSize.Level1) { const std::string traceTag = "ui"; + bool ret = RenderFrameTraceImpl::instance_->AccessFrameTrace(); + EXPECT_EQ(ret, true); RenderFrameTraceImpl::instance_->RenderStartFrameTrace(traceTag); RenderFrameTraceImpl::instance_->RenderEndFrameTrace(traceTag); } @@ -114,6 +116,8 @@ HWTEST_F(RenderFrameTraceImplTest, ui, TestSize.Level1) HWTEST_F(RenderFrameTraceImplTest, renderthread, TestSize.Level1) { const std::string traceTag = "renderthread"; + bool ret = RenderFrameTraceImpl::instance_->AccessFrameTrace(); + EXPECT_EQ(ret, true); RenderFrameTraceImpl::instance_->RenderStartFrameTrace(traceTag); RenderFrameTraceImpl::instance_->RenderEndFrameTrace(traceTag); } @@ -127,6 +131,8 @@ HWTEST_F(RenderFrameTraceImplTest, renderthread, TestSize.Level1) HWTEST_F(RenderFrameTraceImplTest, renderservice, TestSize.Level1) { const std::string traceTag = "renderservice"; + bool ret = RenderFrameTraceImpl::instance_->AccessFrameTrace(); + EXPECT_EQ(ret, true); RenderFrameTraceImpl::instance_->RenderStartFrameTrace(traceTag); RenderFrameTraceImpl::instance_->RenderEndFrameTrace(traceTag); } @@ -140,6 +146,8 @@ HWTEST_F(RenderFrameTraceImplTest, renderservice, TestSize.Level1) HWTEST_F(RenderFrameTraceImplTest, test, TestSize.Level1) { const std::string traceTag = "test"; + bool ret = RenderFrameTraceImpl::instance_->AccessFrameTrace(); + EXPECT_EQ(ret, true); RenderFrameTraceImpl::instance_->RenderStartFrameTrace(traceTag); RenderFrameTraceImpl::instance_->RenderEndFrameTrace(traceTag); } diff --git a/rosen/test/render_frame_trace/unittest/render_frame_trace_test.cpp b/rosen/test/render_frame_trace/unittest/render_frame_trace_test.cpp index 4d9deb0d2d..89981a21e5 100644 --- a/rosen/test/render_frame_trace/unittest/render_frame_trace_test.cpp +++ b/rosen/test/render_frame_trace/unittest/render_frame_trace_test.cpp @@ -93,6 +93,7 @@ HWTEST_F(RenderFrameTraceTest, ui, TestSize.Level1) { const std::string traceTag = "ui"; RenderFrameTrace::implInstance_ = &RenderFrameTrace::GetInstance(); + EXPECT_NE(RenderFrameTrace::implInstance_, nullptr); RenderFrameTrace::implInstance_->RenderStartFrameTrace(traceTag); RenderFrameTrace::implInstance_->RenderEndFrameTrace(traceTag); } @@ -107,6 +108,7 @@ HWTEST_F(RenderFrameTraceTest, renderthread, TestSize.Level1) { const std::string traceTag = "renderthread"; RenderFrameTrace::implInstance_ = &RenderFrameTrace::GetInstance(); + EXPECT_NE(RenderFrameTrace::implInstance_, nullptr); RenderFrameTrace::implInstance_->RenderStartFrameTrace(traceTag); RenderFrameTrace::implInstance_->RenderEndFrameTrace(traceTag); } @@ -121,6 +123,7 @@ HWTEST_F(RenderFrameTraceTest, renderservice, TestSize.Level1) { const std::string traceTag = "renderservice"; RenderFrameTrace::implInstance_ = &RenderFrameTrace::GetInstance(); + EXPECT_NE(RenderFrameTrace::implInstance_, nullptr); RenderFrameTrace::implInstance_->RenderStartFrameTrace(traceTag); RenderFrameTrace::implInstance_->RenderEndFrameTrace(traceTag); } diff --git a/utils/rs_frame_report_ext/test/unittest/rs_frame_report_ext_test.cpp b/utils/rs_frame_report_ext/test/unittest/rs_frame_report_ext_test.cpp index 70fa03d3d4..c623d9c596 100644 --- a/utils/rs_frame_report_ext/test/unittest/rs_frame_report_ext_test.cpp +++ b/utils/rs_frame_report_ext/test/unittest/rs_frame_report_ext_test.cpp @@ -35,18 +35,6 @@ void RsFrameReportExtTest::TearDownTestCase() {} void RsFrameReportExtTest::SetUp() {} void RsFrameReportExtTest::TearDown() {} -/** - * @tc.name: Init - * @tc.desc: test - * @tc.type:FUNC - * @tc.require: - */ -HWTEST_F(RsFrameReportExtTest, Init001, Function | MediumTest | Level2) -{ - OHOS::Rosen::RsFrameReportExt rsFrameReportExt_; - rsFrameReportExt_.Init(); -} - /** * @tc.name: GetEnable * @tc.desc: test @@ -55,8 +43,8 @@ HWTEST_F(RsFrameReportExtTest, Init001, Function | MediumTest | Level2) */ HWTEST_F(RsFrameReportExtTest, GetEnable001, Function | MediumTest | Level2) { - OHOS::Rosen::RsFrameReportExt rsFrameReportExt_; - rsFrameReportExt_.GetEnable(); + int ret = OHOS::Rosen::RsFrameReportExt::GetInstance().GetEnable(); + EXPECT_NE(ret, 0); } /** @@ -67,8 +55,8 @@ HWTEST_F(RsFrameReportExtTest, GetEnable001, Function | MediumTest | Level2) */ HWTEST_F(RsFrameReportExtTest, HandleSwapBuffer001, Function | MediumTest | Level2) { - OHOS::Rosen::RsFrameReportExt rsFrameReportExt_; - rsFrameReportExt_.HandleSwapBuffer(); + OHOS::Rosen::RsFrameReportExt::GetInstance().HandleSwapBuffer(); + EXPECT_NE(OHOS::Rosen::RsFrameReportExt::GetInstance().handleSwapBufferFunc_, nullptr); } /** @@ -79,8 +67,8 @@ HWTEST_F(RsFrameReportExtTest, HandleSwapBuffer001, Function | MediumTest | Leve */ HWTEST_F(RsFrameReportExtTest, RequestNextVSync001, Function | MediumTest | Level2) { - OHOS::Rosen::RsFrameReportExt rsFrameReportExt_; - rsFrameReportExt_.RequestNextVSync(); + OHOS::Rosen::RsFrameReportExt::GetInstance().RequestNextVSync(); + EXPECT_NE(OHOS::Rosen::RsFrameReportExt::GetInstance().requestNextVSyncFunc_, nullptr); } /** @@ -91,8 +79,8 @@ HWTEST_F(RsFrameReportExtTest, RequestNextVSync001, Function | MediumTest | Leve */ HWTEST_F(RsFrameReportExtTest, ReceiveVSync001, Function | MediumTest | Level2) { - OHOS::Rosen::RsFrameReportExt rsFrameReportExt_; - rsFrameReportExt_.ReceiveVSync(); + OHOS::Rosen::RsFrameReportExt::GetInstance().ReceiveVSync(); + EXPECT_NE(OHOS::Rosen::RsFrameReportExt::GetInstance().receiveVSyncFunc_, nullptr); } } // namespace Rosen } // namespace OHOS