am 66603102: Make MaxSessionsOpenCloseAPI10 More Lenient
* commit '666031026ca8e85a87b90922e4af1b8b633b3aac': Make MaxSessionsOpenCloseAPI10 More Lenient
This commit is contained in:
@@ -1661,7 +1661,10 @@ TEST_F(OEMCryptoClientTest, MaxSessionsOpenCloseAPI10) {
|
|||||||
// We expect OEMCrypto implementations support at least 8 sessions.
|
// We expect OEMCrypto implementations support at least 8 sessions.
|
||||||
const size_t kMinimumSupportedMaxNumberOfSessions = 8u;
|
const size_t kMinimumSupportedMaxNumberOfSessions = 8u;
|
||||||
ASSERT_GE(max_sessions, kMinimumSupportedMaxNumberOfSessions);
|
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;
|
vector<OEMCrypto_SESSION> sessions;
|
||||||
// Limit the number of sessions for testing.
|
// Limit the number of sessions for testing.
|
||||||
const size_t kMaxNumberOfSessionsForTesting = 0x100u;
|
const size_t kMaxNumberOfSessionsForTesting = 0x100u;
|
||||||
@@ -1675,7 +1678,7 @@ TEST_F(OEMCryptoClientTest, MaxSessionsOpenCloseAPI10) {
|
|||||||
// OEMCrypto_ERROR_TOO_MANY_SESSIONS if too many sessions are open.
|
// OEMCrypto_ERROR_TOO_MANY_SESSIONS if too many sessions are open.
|
||||||
if (sts != OEMCrypto_SUCCESS) {
|
if (sts != OEMCrypto_SUCCESS) {
|
||||||
ASSERT_EQ(OEMCrypto_ERROR_TOO_MANY_SESSIONS, sts);
|
ASSERT_EQ(OEMCrypto_ERROR_TOO_MANY_SESSIONS, sts);
|
||||||
ASSERT_GE(i, max_sessions);
|
ASSERT_GE(i, max_sessions_with_pad);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ASSERT_EQ(OEMCrypto_SUCCESS,
|
ASSERT_EQ(OEMCrypto_SUCCESS,
|
||||||
|
|||||||
Reference in New Issue
Block a user