From 3817ec4a140855dae4933c19db606b9babd5b3a5 Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Tue, 18 Jul 2017 13:36:30 +0200 Subject: [PATCH] Adapter interface for external PkgMgr module Submit together: - https://review.tizen.org/gerrit/#/c/138998/ - https://review.tizen.org/gerrit/#/c/139347/ Change-Id: Ib692ed8c6306c67ed70594637c27067944154699 Signed-off-by: Damian Pietruchowski --- src/tpk/external_dirs.cc | 3 ++- src/unit_tests/smoke_test.cc | 9 ++++----- src/unit_tests/smoke_utils.cc | 13 ++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/tpk/external_dirs.cc b/src/tpk/external_dirs.cc index 6491473..158145f 100644 --- a/src/tpk/external_dirs.cc +++ b/src/tpk/external_dirs.cc @@ -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; diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 51de2e1..2de3b37 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -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}); } diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 82e7ab6..6decfdd 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -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); -- 2.7.4