diff --git a/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp b/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
index df0c859..a1d5930 100644
--- a/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
+++ b/cas/1.0/vts/functional/VtsHalCasV1_0TargetTest.cpp
@@ -256,12 +256,19 @@
 
 ::testing::AssertionResult MediaCasHidlTest::createCasPlugin(int32_t caSystemId) {
     auto status = mService->isSystemIdSupported(caSystemId);
+    bool skipDescrambler = false;
     if (!status.isOk() || !status) {
         return ::testing::AssertionFailure();
     }
     status = mService->isDescramblerSupported(caSystemId);
     if (!status.isOk() || !status) {
-        return ::testing::AssertionFailure();
+        if (mIsTestDescrambler) {
+            return ::testing::AssertionFailure();
+        } else {
+            ALOGI("Skip Descrambler test since it's not required in cas@1.2.");
+            mDescramblerBase = nullptr;
+            skipDescrambler = true;
+        }
     }
 
     mCasListener = new MediaCasListener();
@@ -274,16 +281,15 @@
         return ::testing::AssertionFailure();
     }
 
+    if (skipDescrambler) {
+        return ::testing::AssertionSuccess();
+    }
+
     auto descramblerStatus = mService->createDescrambler(caSystemId);
     if (!descramblerStatus.isOk()) {
-        if (mIsTestDescrambler) {
-            return ::testing::AssertionFailure();
-        } else {
-            ALOGI("Skip Descrambler test since it's not required in cas@1.2.");
-            return ::testing::AssertionSuccess();
-        }
+        return ::testing::AssertionFailure();
     }
-    mIsTestDescrambler = true;
+
     mDescramblerBase = descramblerStatus;
     return ::testing::AssertionResult(mDescramblerBase != nullptr);
 }
@@ -506,7 +512,7 @@
     returnStatus = mMediaCas->setSessionPrivateData(streamSessionId, hidlPvtData);
     EXPECT_TRUE(returnStatus.isOk());
     EXPECT_EQ(Status::OK, returnStatus);
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
         EXPECT_TRUE(returnStatus.isOk());
         EXPECT_EQ(Status::OK, returnStatus);
@@ -556,7 +562,7 @@
     EXPECT_TRUE(returnStatus.isOk());
     EXPECT_EQ(Status::OK, returnStatus);
 
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         EXPECT_FALSE(mDescramblerBase->requiresSecureDecoderComponent("video/avc"));
 
         sp<IDescrambler> descrambler;
@@ -606,7 +612,7 @@
     EXPECT_TRUE(returnStatus.isOk());
     EXPECT_EQ(Status::OK, returnStatus);
 
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
         EXPECT_TRUE(returnStatus.isOk());
         EXPECT_EQ(Status::ERROR_CAS_SESSION_NOT_OPENED, returnStatus);
@@ -672,7 +678,7 @@
     EXPECT_TRUE(returnStatus.isOk());
     EXPECT_EQ(Status::ERROR_CAS_UNKNOWN, returnStatus);
 
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         /*
          * Test MediaDescrambler error codes
          */
@@ -720,7 +726,7 @@
     std::vector<uint8_t> sessionId;
     ASSERT_TRUE(openCasSession(&sessionId));
 
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         returnStatus = mDescramblerBase->setMediaCasSession(sessionId);
         EXPECT_TRUE(returnStatus.isOk());
         EXPECT_EQ(Status::OK, returnStatus);
@@ -732,7 +738,7 @@
     EXPECT_TRUE(returnStatus.isOk());
     EXPECT_EQ(Status::OK, returnStatus);
 
-    if (mIsTestDescrambler) {
+    if (mDescramblerBase != nullptr) {
         sp<IDescrambler> descrambler = IDescrambler::castFrom(mDescramblerBase);
         ASSERT_NE(nullptr, descrambler.get());
 
