diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 5b0086f2..a5d2fbae 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -765,7 +765,7 @@ class Session { } void open() { - EXPECT_TRUE(!open_); + EXPECT_FALSE(open_); session_status_ = OEMCrypto_OpenSession(&session_id_); if (OEMCrypto_SUCCESS == session_status_) { open_ = true; @@ -5532,6 +5532,11 @@ TEST_P(UsageTableTestWithMAC, ReloadOfflineLicense) { Session s; LoadOfflineLicense(s, pst); + // If there are errors in LoadOfflineLicense, that function will exit but this + // test will continue. The session will be left open and in an unknown state. + // Best just to abort in that case. + ASSERT_FALSE(s.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + s.open(); // Offline license can be reused. s.GenerateTestSessionKeys(); // We will reuse the encrypted and signed message, so we don't call @@ -5560,6 +5565,11 @@ TEST_P(UsageTableTestWithMAC, BadReloadOfflineLicense) { Session s; LoadOfflineLicense(s, pst); + // If there are errors in LoadOfflineLicense, that function will exit but this + // test will continue. The session will be left open and in an unknown state. + // Best just to abort in that case. + ASSERT_FALSE(s.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + // Offline license with new mac keys should fail. Session s2; s2.open(); @@ -5631,6 +5641,11 @@ TEST_P(UsageTableTestWithMAC, DeactivateOfflineLicense) { Session s; LoadOfflineLicense(s, pst); + // If there are errors in LoadOfflineLicense, that function will exit but this + // test will continue. The session will be left open and in an unknown state. + // Best just to abort in that case. + ASSERT_FALSE(s.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + s.open(); s.GenerateTestSessionKeys(); s.LoadTestKeys(pst, new_mac_keys_); // Reload the license @@ -5697,6 +5712,13 @@ TEST_F(UsageTableTest, TimingTest) { LoadOfflineLicense(s3, pst3); time_t loaded3 = time(NULL); + // If there are errors in LoadOfflineLicense, that function will exit but this + // test will continue. The sessions will be left open and in an unknown state. + // Best just to abort in that case. + ASSERT_FALSE(s1.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + ASSERT_FALSE(s2.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + ASSERT_FALSE(s3.isOpen()) << "LoadOfflineLicense() failed. Aborting."; + sleep(kLongSleep); s1.open(); s1.GenerateTestSessionKeys();