Adapter interface for external PkgMgr module 46/139346/6
authorDamian Pietruchowski <d.pietruchow@samsung.com>
Tue, 18 Jul 2017 11:36:30 +0000 (13:36 +0200)
committerDamian Pietruchowski <d.pietruchow@samsung.com>
Thu, 24 Aug 2017 08:35:41 +0000 (10:35 +0200)
Submit together:
- https://review.tizen.org/gerrit/#/c/138998/
- https://review.tizen.org/gerrit/#/c/139347/

Change-Id: Ib692ed8c6306c67ed70594637c27067944154699
Signed-off-by: Damian Pietruchowski <d.pietruchow@samsung.com>
src/tpk/external_dirs.cc
src/unit_tests/smoke_test.cc
src/unit_tests/smoke_utils.cc

index 6491473..158145f 100644 (file)
@@ -59,7 +59,8 @@ bool DeleteExternalAppdataDirectories(const std::string& pkgid,
     }
     case ci::RequestMode::USER: {
       // if package is globally installed, leave directories
-      if (ci::QueryIsPackageInstalled(pkgid, GLOBAL_USER))
+      ci::PkgQueryInterface pkg_query(pkgid, GLOBAL_USER);
+      if (pkg_query.IsPackageInstalled())
         return true;
 
       LOG(DEBUG) << "Removing external directories for user: " << uid;
index 51de2e1..2de3b37 100644 (file)
@@ -158,9 +158,8 @@ TEST_F(SmokeTest, EnablePkg) {
   ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
   ASSERT_EQ(DisablePackage(pkgid), ci::AppInstaller::Result::OK);
   ASSERT_EQ(EnablePackage(pkgid), ci::AppInstaller::Result::OK);
-  ASSERT_TRUE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode(
-      kTestUserId),
-      kTestUserId));
+  ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+  ASSERT_TRUE(pkg_query.IsPackageInstalled(ci::GetRequestMode(kTestUserId)));
 }
 
 TEST_F(SmokeTest, DisablePkg) {
@@ -550,8 +549,8 @@ TEST_F(PreloadSmokeTest, ManifestDirectInstallMode) {
   bf::path pkg_path = ci::GetRootAppPath(false, kTestUserId);
 
   CopyDir(src_path / pkgid, pkg_path / pkgid);
-  ASSERT_FALSE(QueryIsPackageInstalled(pkgid, ci::GetRequestMode(kTestUserId),
-                                       kTestUserId));
+  ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+  ASSERT_FALSE(pkg_query.IsPackageInstalled(ci::GetRequestMode(kTestUserId)));
   ASSERT_EQ(ManifestDirectInstall(pkgid), ci::AppInstaller::Result::OK);
   ValidatePackage(pkgid, {appid});
 }
index 82e7ab6..6decfdd 100644 (file)
@@ -341,8 +341,9 @@ bool PackageCheckCleanup(const std::string& pkgid, const std::string&,
 
 bool ValidatePackage(const std::string& pkgid, const std::string& appid,
     bool is_readonly) {
-  EXTENDED_ASSERT_TRUE(ci::QueryIsPackageInstalled(
-      pkgid, ci::GetRequestMode(kTestUserId), kTestUserId));
+  ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+  EXTENDED_ASSERT_TRUE(pkg_query.IsPackageInstalled(
+      ci::GetRequestMode(kTestUserId)));
   EXTENDED_ASSERT_TRUE(ValidatePackageFS(pkgid, appid, kTestUserId,
       kTestGroupId, is_readonly));
   if (kTestUserId == kGlobalUserUid) {
@@ -369,7 +370,8 @@ bool ValidateExternalPackage_FS(const std::string& pkgid,
 
 bool ValidateExternalPackage(const std::string& pkgid,
     const std::string& appid) {
-  std::string storage = ci::QueryStorageForPkgId(pkgid, kTestUserId);
+  ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+  std::string storage = pkg_query.StorageForPkgId();
   bf::path ext_mount_path = ci::GetExternalCardPath();
   if (bf::is_empty(ext_mount_path)) {
     LOG(INFO) << "Sdcard not exists!";
@@ -384,8 +386,9 @@ bool ValidateExternalPackage(const std::string& pkgid,
 bool CheckPackageNonExistance(const std::string& pkgid,
                               const std::string& appid,
                               bool is_readonly) {
-  EXTENDED_ASSERT_FALSE(ci::QueryIsPackageInstalled(
-      pkgid, ci::GetRequestMode(kTestUserId), kTestUserId));
+  ci::PkgQueryInterface pkg_query(pkgid, kTestUserId);
+  EXTENDED_ASSERT_FALSE(pkg_query.IsPackageInstalled(
+      ci::GetRequestMode(kTestUserId)));
   EXTENDED_ASSERT_TRUE(PackageCheckCleanup(pkgid, appid, is_readonly));
   if (kTestUserId == kGlobalUserUid) {
     bf::path skel_path(kSkelDir);