ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
}
+TEST_F(SmokeTest, InstallAndROUpdate) {
+ bf::path path1_old =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk.tpk";
+ bf::path path1_new =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Tpk_2.tpk";
+ std::string pkgid1 = "smokeuni25";
+ std::string appid1 = "smokeuni25.InstallAndROUpdateModeTpk";
+ std::string exec1 = "smokeunified";
+ bf::path path2 =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_Wgt.wgt";
+ std::string pkgid2 = "smokeuni26";
+ std::string appid2 = "smokeuni26.InstallAndROUpdateWgt";
+ std::string exec2 = "smokeuni26.InstallAndROUpdateWgt";
+
+ // install tpk version 1
+ ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
+ // update tpk version 2, install wgt version 1
+ std::vector<bf::path> paths = { path1_new, path2 };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+ params.pkg_type = PackageType::WGT;
+ ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+ ASSERT_TRUE(
+ ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+}
+
+TEST_F(SmokeTest, Uninstall_Single) {
+ bf::path path =
+ kUnifiedSmokePackagesDirectory / "Uninstall_SingleTpk.tpk";
+ std::string pkgid = "smokeuni29";
+ std::string appid = "smokeuni29.UninstallSingleTpk";
+ std::string exec = "smokeunified";
+
+ std::vector<bf::path> paths = { path };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(ValidatePackage(pkgid, {appid, exec}, params));
+ std::vector<std::string> pkgids = { pkgid };
+ ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
+}
+
+TEST_F(SmokeTest, Uninstall_Double) {
+ bf::path path1 =
+ kUnifiedSmokePackagesDirectory / "Uninstall_DoubleTpk.tpk";
+ std::string pkgid1 = "smokeuni30";
+ std::string appid1 = "smokeuni30.UninstallDoubleTpk";
+ std::string exec1 = "smokeunified";
+ bf::path path2 =
+ kUnifiedSmokePackagesDirectory / "Uninstall_DoubleWgt.wgt";
+ std::string pkgid2 = "smokeuni31";
+ std::string appid2 = "smokeuni31.UninstallDoubleWgt";
+ std::string exec2 = "smokeuni31.UninstallDoubleWgt";
+
+ std::vector<bf::path> paths = { path1, path2 };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+ params.pkg_type = PackageType::WGT;
+ ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+ std::vector<std::string> pkgids = { pkgid1, pkgid2 };
+ ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+}
+
+TEST_F(SmokeTest, Uninstall_Triple) {
+ bf::path path1 =
+ kUnifiedSmokePackagesDirectory / "Uninstall_TripleTpk.tpk";
+ std::string pkgid1 = "smokeuni32";
+ std::string appid1 = "smokeuni32.UninstallTripleTpk";
+ std::string exec1 = "smokeunified";
+ bf::path path2 =
+ kUnifiedSmokePackagesDirectory / "Uninstall_TripleWgt.wgt";
+ std::string pkgid2 = "smokeuni33";
+ std::string appid2 = "smokeuni33.UninstallTripleWgt";
+ std::string exec2 = "smokeuni33.UninstallTripleWgt";
+ bf::path path3 =
+ kUnifiedSmokePackagesDirectory / "Uninstall_TripleHybrid.wgt";
+ std::string pkgid3 = "smokeuni34";
+ std::string appid3 = "smokeuni34.UninstallTripleHybrid";
+ std::string exec3 = "smokeuni34.UninstallTripleHybrid";
+
+ std::vector<bf::path> paths = { path1, path2, path3 };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+ params.pkg_type = PackageType::WGT;
+ ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+ params.pkg_type = PackageType::HYBRID;
+ ASSERT_TRUE(ValidatePackage(pkgid3, {appid3, exec3}, params));
+ std::vector<std::string> pkgids = { pkgid1, pkgid2, pkgid3 };
+ ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid3, params));
+}
+
+TEST_F(SmokeTest, UninstallAndROUpdateUninstall) {
+ bf::path path1_old =
+ kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Tpk.tpk";
+ bf::path path1_new =
+ kUnifiedSmokePackagesDirectory /
+ "UninstallAndROUpdateUninstall_Tpk_2.tpk";
+ std::string pkgid1 = "smokeuni35";
+ std::string appid1 = "smokeuni35.UninstallAndROUpdateUninstallTpk";
+ std::string exec1 = "smokeunified";
+ bf::path path2 =
+ kUnifiedSmokePackagesDirectory / "UninstallAndROUpdateUninstall_Wgt.wgt";
+ std::string pkgid2 = "smokeuni36";
+ std::string appid2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
+ std::string exec2 = "smokeuni36.UninstallAndROUpdateUninstallWgt";
+
+ // install tpk version 1
+ ASSERT_EQ(backend.InstallPreload(path1_old), ci::AppInstaller::Result::OK);
+ ci::PkgQueryInterface pkg_query1(pkgid1, params.test_user.uid);
+ PackageAttributes original(pkg_query1);
+ // update tpk version 2, install wgt version 1
+ std::vector<bf::path> paths = { path1_new, path2 };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::OK);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+ params.pkg_type = PackageType::WGT;
+ ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+ ASSERT_TRUE(
+ ValidateFileContentInPackage(pkgid1, "res/VERSION", "2", params));
+ // uninstall
+ std::vector<std::string> pkgids = { pkgid1, pkgid2 };
+ ASSERT_EQ(backend.Uninstall(pkgids), ci::AppInstaller::Result::OK);
+ ci::PkgQueryInterface pkg_query2(pkgid1, params.test_user.uid, true);
+ PackageAttributes restored(pkg_query2);
+ ASSERT_EQ(original, restored);
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid2, params));
+ params.pkg_type = PackageType::TPK;
+ params.is_readonly = true;
+ ASSERT_TRUE(ValidatePackage(pkgid1, {appid1, exec1}, params));
+ ASSERT_TRUE(
+ ValidateFileContentInPackage(pkgid1, "res/VERSION", "1", params));
+}
+
class RollbackSmokeTest : public testing::Test {
public:
RollbackSmokeTest()
ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
}
+TEST_F(RollbackSmokeTest, InstallAndROUpdate_Rollback) {
+ bf::path path1 =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackTpk.tpk";
+ std::string pkgid1 = "smokeuni27";
+ std::string appid1 = "smokeuni27.InstallAndROUpdateRollbackTpk";
+ std::string exec1 = "smokeunified";
+ bf::path path2_old =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt.wgt";
+ bf::path path2_new =
+ kUnifiedSmokePackagesDirectory / "InstallAndROUpdate_RollbackWgt_2.wgt";
+ std::string pkgid2 = "smokeuni28";
+ std::string appid2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
+ std::string exec2 = "smokeuni28.InstallAndROUpdateRollbackWgt";
+
+ ASSERT_EQ(backend.InstallPreloadSuccess(path2_old),
+ ci::AppInstaller::Result::OK);
+ // pkgid1: install, pkgid2: update
+ std::vector<bf::path> paths = { path1, path2_new };
+ ASSERT_EQ(backend.Install(paths), ci::AppInstaller::Result::ERROR);
+ params.pkg_type = PackageType::TPK;
+ ASSERT_TRUE(CheckPackageNonExistance(pkgid1, params));
+ params.pkg_type = PackageType::WGT;
+ params.is_readonly = true;
+ ASSERT_TRUE(ValidatePackage(pkgid2, {appid2, exec2}, params));
+ ASSERT_TRUE(
+ ValidateFileContentInPackage(pkgid2, "res/wgt/VERSION", "1", params));
+}
+
TEST_F(SmokeTest, Recovery_Install) {
bf::path path1 =
kUnifiedSmokePackagesDirectory / "Recovery_InstallTpk.tpk";