diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 08864ef1..6049fdd8 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -1661,7 +1661,10 @@ TEST_F(OEMCryptoClientTest, MaxSessionsOpenCloseAPI10) { // We expect OEMCrypto implementations support at least 8 sessions. const size_t kMinimumSupportedMaxNumberOfSessions = 8u; ASSERT_GE(max_sessions, kMinimumSupportedMaxNumberOfSessions); - + // We allow GetMaxNumberOfSessions to return an estimate. This tests with a + // pad of 5%. Even if it's just an estimate, we still require 8 sessions. + size_t max_sessions_with_pad = max(max_sessions * 19/20, + kMinimumSupportedMaxNumberOfSessions); vector sessions; // Limit the number of sessions for testing. const size_t kMaxNumberOfSessionsForTesting = 0x100u; @@ -1675,7 +1678,7 @@ TEST_F(OEMCryptoClientTest, MaxSessionsOpenCloseAPI10) { // OEMCrypto_ERROR_TOO_MANY_SESSIONS if too many sessions are open. if (sts != OEMCrypto_SUCCESS) { ASSERT_EQ(OEMCrypto_ERROR_TOO_MANY_SESSIONS, sts); - ASSERT_GE(i, max_sessions); + ASSERT_GE(i, max_sessions_with_pad); break; } ASSERT_EQ(OEMCrypto_SUCCESS,