Make MaxSessionsOpenCloseAPI10 More Lenient
Merge from widevine repo of http://go/wvgerrit/14870 OEMCrypto_GetMaxNumberOfSessions is not required to return a hard limit for the number of sessions. This CL adjusts the test to verify we can open within 5% of the maximum number of sessions. bug: 22029687 Change-Id: I6e72e39338cead8d547cdb194a32fb7e7dc53037
This commit is contained in:
@@ -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<OEMCrypto_SESSION> 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,
|
||||
|
||||
Reference in New Issue
Block a user