Merge "Fail Test if LoadOfflineLicense() Helper Fails" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b0cfa834f1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user