#include <common/step/filesystem/step_acquire_external_storage.h>
#include <common/step/filesystem/step_optional_acquire_external_storage.h>
#include <common/step/filesystem/step_change_ownership_and_permission.h>
-#include <common/step/filesystem/step_clear_data.h>
#include <common/step/filesystem/step_copy.h>
#include <common/step/filesystem/step_copy_storage_directories.h>
#include <common/step/filesystem/step_copy_tep.h>
case ci::RequestType::ReadonlyUpdateUninstall:
ReadonlyUpdateUninstallSteps();
break;
- case ci::RequestType::Clear:
- ClearSteps();
- break;
case ci::RequestType::EnablePkg:
EnablePkgSteps();
break;
AddStep<ci::pkgmgr::StepRemoveManifest>();
}
-void TpkInstaller::ClearSteps() {
- AddStep<ci::configuration::StepConfigure>(pkgmgr_);
- AddStep<ci::configuration::StepParseManifest>(
- ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
- ci::configuration::StepParseManifest::StoreLocation::NORMAL);
- AddStep<ci::filesystem::StepClearData>();
-}
-
void TpkInstaller::DisablePkgSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::configuration::StepParseManifest>(
return CallBackend(SIZEOFARRAY(argv), argv, mode);
}
-ci::AppInstaller::Result Clear(const bf::path& path,
- RequestResult mode = RequestResult::NORMAL) {
- const char* argv[] = {"", "-c", path.c_str(), "-u", kTestUserIdStr.c_str()};
- return CallBackend(SIZEOFARRAY(argv), argv, mode);
-}
-
ci::AppInstaller::Result EnablePackage(const std::string& path,
RequestResult mode = RequestResult::NORMAL) {
const char* argv[] = {"", "-A", path.c_str(), "-u", kTestUserIdStr.c_str()};
ValidatePackageFS(pkgid, {appid});
}
-TEST_F(SmokeTest, ClearMode_Tpk) {
- bf::path path = kSmokePackagesDirectory / "ClearMode_Tpk.tpk";
- std::string pkgid = "smokeapp21";
- std::string appid = "smokeapp21.ClearModeTpk";
- ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
- bf::path root_path = ci::GetRootAppPath(false,
- kTestUserId);
- bs::error_code error;
- bf::create_directory(root_path / pkgid / "data" / "dir", error);
- ASSERT_FALSE(error);
- ASSERT_TRUE(TouchFile(root_path / pkgid / "data" / "dir" / "file"));
- ASSERT_TRUE(TouchFile(root_path / pkgid / "data" / "file"));
- ASSERT_EQ(Clear(pkgid), ci::AppInstaller::Result::OK);
- ValidatePackage(pkgid, {appid});
- ASSERT_FALSE(bf::exists(root_path / pkgid / "data" / "dir" / "file"));
- ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "file"));
-}
-
TEST_F(SmokeTest, RecoveryMode_Tpk_Installation) {
bf::path path = kSmokePackagesDirectory / "RecoveryMode_Tpk_Installation.tpk";
RemoveAllRecoveryFiles();