Check smack leftovers after uninstallation
[platform/core/test/security-tests.git] / src / common / scoped_installer.h
index 82175ce..2eafe25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
 
 class ScopedInstaller {
 public:
-    ScopedInstaller(const AppInstallHelper &app, bool requestUid = true)
+    ScopedInstaller(const AppInstallHelper &app,
+                    bool requestUid = true,
+                    lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS)
         : m_appIds({app.getAppId()}),
           m_uid(app.getUID()),
           m_installType(app.getInstallType()),
-          m_shouldUninstall(true),
+          m_shouldUninstall(expectedResult == SECURITY_MANAGER_SUCCESS),
           m_requestUid(requestUid),
           m_creatorPid(getpid())
     {
@@ -67,7 +69,7 @@ public:
         for (const auto &priv : app.getAppDefinedPrivileges())
             instReq.addAppDefinedPrivilege(priv);
 
-        SecurityManagerTest::Api::install(instReq);
+        SecurityManagerTest::Api::install(instReq, expectedResult);
     }
 
     ScopedInstaller(const std::vector<std::string> &appIds, const std::string &pkgId)