ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/VERSION", "1"));
}
+TEST_F(PreloadSmokeTest, ManifestDirectInstallMode) {
+ ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
+ bf::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode";
+ std::string pkgid = "smoketpk41";
+ std::string appid = "smoketpk41.ManifestDirectInstallMode";
+ bf::path pkg_path = ci::GetRootAppPath(false, kTestUserId);
+
+ CopyDir(src_path / pkgid, pkg_path / pkgid);
+ ASSERT_FALSE(QueryIsPackageInstalled(pkgid, ci::GetRequestMode(kTestUserId),
+ kTestUserId));
+ ASSERT_EQ(ManifestDirectInstall(pkgid), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, {appid});
+}
+
+TEST_F(SmokeTest, ManifestDirectUpdateMode) {
+ bf::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode.tpk";
+ std::string pkgid = "smoketpk42";
+ std::string appid = "smoketpk42.ManifestDirectUpdateMode";
+
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ int install_time = GetAppInstalledTime(appid.c_str(), kTestUserId);
+ ASSERT_EQ(ManifestDirectInstall(pkgid), ci::AppInstaller::Result::OK);
+ ASSERT_TRUE(GetAppInstalledTime(appid.c_str(), kTestUserId) > install_time)
+ << "Package is not updated (app installed time didn't change).";
+ ValidatePackage(pkgid, {appid});
+}
+
+TEST_F(PreloadSmokeTest, ReadonlyUpdateInstallMode) {
+ ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
+ bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateInstallMode.tpk";
+ std::string pkgid = "smoketpk43";
+ std::string appid = "smoketpk43.ReadonlyUpdateInstallMode";
+
+ ASSERT_EQ(InstallPreload(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, {appid});
+ ValidatePackage(pkgid, {appid}, true);
+}
+
+TEST_F(PreloadSmokeTest, ReadonlyUpdateUninstallMode) {
+ ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
+ bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateUninstallMode.tpk";
+ std::string pkgid = "smoketpk44";
+ std::string appid = "smoketpk44.ReadonlyUpdateUninstallMode";
+
+ ASSERT_EQ(InstallPreload(path), ci::AppInstaller::Result::OK);
+ ASSERT_EQ(Install(path), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, {appid});
+ ValidatePackage(pkgid, {appid}, true);
+ ASSERT_EQ(Uninstall(pkgid, false), ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, {appid}, true);
+}
+
} // namespace common_installer
int main(int argc, char** argv) {
return CallBackend(SIZEOFARRAY(argv), argv, mode);
}
+ci::AppInstaller::Result ManifestDirectInstall(const std::string& pkgid,
+ RequestResult mode) {
+ const char* argv[] = {"", "-y", pkgid.c_str(), "-u", kTestUserIdStr.c_str()};
+ return CallBackend(SIZEOFARRAY(argv), argv, mode);
+}
+
void BackupPath(const bf::path& path) {
bf::path backup_path = path.string() + ".bck";
std::cout << "Backup path: " << path << " to " << backup_path << std::endl;
UninstallAllAppsInDirectory(apps_rw, false);
}
+int GetAppInstalledTime(const char *appid, uid_t uid)
+{
+ int ret = 0;
+ int installed_time = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return installed_time;
+}
+
ci::AppInstaller::Result Recover(const bf::path& recovery_file,
RequestResult mode = RequestResult::NORMAL);
+ci::AppInstaller::Result ManifestDirectInstall(const std::string& pkgid,
+ RequestResult mode = RequestResult::NORMAL);
+
void BackupPath(const bf::path& path);
void RestorePath(const bf::path& path);
void UninstallAllSmokeApps(ci::RequestMode request_mode);
+int GetAppInstalledTime(const char *appid, uid_t uid);
+
#endif // UNIT_TESTS_SMOKE_UTILS_H_
--- /dev/null
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AuthorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="bin%2Fbasicui">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Yrs3GkHAMzZGL7qmFGAF7sdXg6shvOtthBSb/Hjzfjw=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Fbasicui.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>vQ+rOr8hWb4TVBijWblCSAB+8eePv+QyN6wNXzvJgSE=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>lpo8tUDs054eLlBQXiDPVDVKfw30ZZdtkRs1jd7H5K8=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+ATfZj/k87yYSeapRBX0sMZ5tO6jMQDj4EWCCTLtj5cf+N1s8WCbl4sST53hWdTf+JgvAzTpF6x+t
+LcwC9zQZxfYTzHu0KqyKJy6uXj6tiB85SSlYhejOtDogxvGFCnRo6RZioYzF4SDtxha9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VI8Ygz7gj8TMlClg==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#AuthorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#AuthorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-author"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#AuthorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
--- /dev/null
+Needed, because empty directories are skipped when copying, and directory structure will be invalid.
--- /dev/null
+Needed, because empty directories are skipped when copying, and directory structure will be invalid.
--- /dev/null
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="author-signature.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>anhYz6XCClJebTJ+qamYS8R0Rk4xDr7LKqaWzyxvj0I=</DigestValue>
+</Reference>
+<Reference URI="bin%2Fbasicui">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>Yrs3GkHAMzZGL7qmFGAF7sdXg6shvOtthBSb/Hjzfjw=</DigestValue>
+</Reference>
+<Reference URI="shared%2Fres%2Fbasicui.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="tizen-manifest.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>vQ+rOr8hWb4TVBijWblCSAB+8eePv+QyN6wNXzvJgSE=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+NTEUK1tZpBTxjgfGxbwc1bZr8kAG8dc2+hx2xzUFxZUgIWwIIy/SdKy7VGUCAH3y/HApfaNBL1SL
+RnGoQ/R3L/eQvQnzq/iTpZcCSpYnnvH9fJHAmgSod5XgH9IS+QKU/fzJ1rhlMBMD8oGxrDa4JrQJ
+65+mUCgDS7LZUp6olx8=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICnTCCAgYCCQDE9MbMmJ/yCzANBgkqhkiG9w0BAQUFADCBkDELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTElMCMGA1UEAwwcVGl6ZW4gUGFydG5lciBEaXN0
+cmlidXRvciBDQTAeFw0xMjEwMjcwNzQ4MzNaFw0yMjEwMjUwNzQ4MzNaMIGUMQswCQYDVQQGEwJL
+UjEOMAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENB
+MSIwIAYDVQQLDBlUaXplbiBEaXN0cmlidXRvciBUZXN0IENBMSkwJwYDVQQDDCBUaXplbiBQYXJ0
+bmVyIERpc3RyaWJ1dG9yIFNpZ25lcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYE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ZvCTDlw1nIEjvZa6P+uWOOi05xPPAE0feKPkO1POnOjnapfkkEVNU
+8TXsLbLYBylWT8rxZC8CAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBJ
+yJ7p6qs0JI+1iKOk/sYWVP6dMueY72qOc/wVj5c3ejOlgJNNXDMAQ14QcRRexffc68ipTwybU/3m
+tcNwydzKJe+GFa4b2zyKOvOgrfs4MKSR0T9XEPmTKeR+NDT2CbA6/kQoRYm0fSORzD2UXJzNZWe/
+WjwSA66hv4q+0QZQFQ==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="smoketpk41" version="1.0.0">
+ <profile name="mobile" />
+ <ui-application appid="smoketpk41.ManifestDirectInstallMode" exec="basicui" type="capp" multiple="false" taskmanage="true" nodisplay="false" launch_mode="single">
+ <icon>basicui.png</icon>
+ <label>basicui</label>
+ </ui-application>
+</manifest>