From 3ec02dc9a453f5b88254d41efd8f91056a73dcd5 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 27 Aug 2021 11:20:39 -0700 Subject: [PATCH] Vts: thermal: Test notification with an unregistered local callback Bug: 197935704 Test: /data/nativetest64/VtsHalThermalV2_0TargetTest/VtsHalThermalV2_0TargetTest Signed-off-by: Wei Wang Change-Id: Ida76565389d021b9433bfac8153408454f2bdee9 --- thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp index 2ee91f4848..c7bab5c514 100644 --- a/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp +++ b/thermal/2.0/vts/functional/VtsHalThermalV2_0TargetTest.cpp @@ -103,12 +103,11 @@ class ThermalHidlTest : public testing::TestWithParam { // Test ThermalChangedCallback::notifyThrottling(). // This just calls into and back from our local ThermalChangedCallback impl. -// Note: a real thermal throttling event from the Thermal HAL could be -// inadvertently received here. TEST_P(ThermalHidlTest, NotifyThrottlingTest) { - auto ret = mThermalCallback->notifyThrottling(kThrottleTemp); + sp thermalCallback = new (std::nothrow) ThermalCallback(); + auto ret = thermalCallback->notifyThrottling(kThrottleTemp); ASSERT_TRUE(ret.isOk()); - auto res = mThermalCallback->WaitForCallback(kCallbackNameNotifyThrottling); + auto res = thermalCallback->WaitForCallback(kCallbackNameNotifyThrottling); EXPECT_TRUE(res.no_timeout); ASSERT_TRUE(res.args); EXPECT_EQ(kThrottleTemp, res.args->temperature);