@@ -57,7 +57,9 @@ struct KmdNotifyTests : public ::testing::Test {
5757 class MockKmdNotifyHelper : public KmdNotifyHelper {
5858 public:
5959 using KmdNotifyHelper::acLineConnected;
60- using KmdNotifyHelper::lastWaitForCompletionTimestamp;
60+ using KmdNotifyHelper::getMicrosecondsSinceEpoch;
61+ using KmdNotifyHelper::lastWaitForCompletionTimestampUs;
62+ using KmdNotifyHelper::properties;
6163
6264 MockKmdNotifyHelper () = delete ;
6365 MockKmdNotifyHelper (const KmdNotifyProperties *newProperties) : KmdNotifyHelper(newProperties){};
@@ -190,14 +192,15 @@ HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout)
190192}
191193
192194HWTEST_F (KmdNotifyTests, givenNonQuickSleepRequestWhenItsSporadicWaitThenOverrideQuickSleepRequest) {
193- overrideKmdNotifyParams (true , 3 , true , 2 , true , 0 );
195+ overrideKmdNotifyParams (true , 3 , true , 2 , true , 1 );
194196 auto csr = createMockCsr<FamilyType>();
195197
196198 auto expectedDelay = device->getHardwareInfo ().capabilityTable .kmdNotifyProperties .delayQuickKmdSleepMicroseconds ;
197199 EXPECT_CALL (*csr, waitForCompletionWithTimeout (::testing::_, expectedDelay, ::testing::_)).Times (1 ).WillOnce (::testing::Return (true ));
198200
199- auto now = std::chrono::high_resolution_clock::now ();
200- mockKmdNotifyHelper->lastWaitForCompletionTimestamp = now - std::chrono::hours (24 );
201+ int64_t timeSinceLastWait = mockKmdNotifyHelper->properties ->delayQuickKmdSleepForSporadicWaitsMicroseconds + 1 ;
202+
203+ mockKmdNotifyHelper->lastWaitForCompletionTimestampUs = mockKmdNotifyHelper->getMicrosecondsSinceEpoch () - timeSinceLastWait;
201204 csr->waitForTaskCountWithKmdNotifyFallback (taskCountToWait, 1 , false );
202205}
203206
@@ -247,7 +250,7 @@ HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpda
247250 overrideKmdNotifyParams (true , 3 , true , 2 , true , 1 );
248251
249252 auto csr = createMockCsr<FamilyType>();
250- EXPECT_NE (0 , mockKmdNotifyHelper->lastWaitForCompletionTimestamp . time_since_epoch (). count ());
253+ EXPECT_NE (0 , mockKmdNotifyHelper->lastWaitForCompletionTimestampUs . load ());
251254
252255 EXPECT_EQ (1u , mockKmdNotifyHelper->updateLastWaitForCompletionTimestampCalled );
253256 csr->waitForTaskCountWithKmdNotifyFallback (0 , 0 , false );
@@ -258,7 +261,7 @@ HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWithDisabledSporadicWa
258261 overrideKmdNotifyParams (true , 3 , true , 2 , false , 0 );
259262
260263 auto csr = createMockCsr<FamilyType>();
261- EXPECT_EQ (0 , mockKmdNotifyHelper->lastWaitForCompletionTimestamp . time_since_epoch (). count ());
264+ EXPECT_EQ (0 , mockKmdNotifyHelper->lastWaitForCompletionTimestampUs . load ());
262265
263266 csr->waitForTaskCountWithKmdNotifyFallback (0 , 0 , false );
264267 EXPECT_EQ (0u , mockKmdNotifyHelper->updateLastWaitForCompletionTimestampCalled );
0 commit comments