bf::path path = kSmokePackagesDirectory / "InstallExternalMode.wgt";
std::string pkgid = "smokewgt35";
std::string appid = "smokewgt35.web";
- ASSERT_EQ(InstallExternal(path, PackageType::WGT),
+ ASSERT_EQ(InstallWithStorage(path, PackageType::WGT, StorageType::EXTERNAL),
ci::AppInstaller::Result::OK);
ValidateExternalPackage(pkgid, {appid});
}
ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
}
+TEST_F(SmokeTest, InstallExtendedMode) {
+ ASSERT_TRUE(CheckAvailableExtendedStorage());
+ bf::path path = kSmokePackagesDirectory / "InstallExtendedMode.wgt";
+ std::string pkgid = "smokewgt44";
+ std::string appid = "smokewgt44.web";
+ ASSERT_EQ(InstallWithStorage(path, PackageType::WGT, StorageType::EXTENDED),
+ ci::AppInstaller::Result::OK);
+ ValidatePackage(pkgid, {appid});
+}
+
} // namespace common_installer
int main(int argc, char** argv) {
return true;
}
-ci::AppInstaller::Result InstallExternal(const bf::path& path,
+bool CheckAvailableExtendedStorage() {
+ bf::path extended_path = bf::path(tzplatform_getenv(TZ_SYS_EXTENDEDSD));
+ LOG(DEBUG) << "extended_path :" << extended_path;
+ // TODO(jeremy.jang): It should be checked by libstorage API.
+ if (!bf::exists(extended_path)) {
+ LOG(ERROR) << "Extended storage not exists!";
+ return false;
+ }
+ return true;
+}
+
+ci::AppInstaller::Result InstallWithStorage(const bf::path& path,
PackageType type,
+ StorageType storage_type,
RequestResult mode) {
int default_storage = 0;
+ int storage = 0;
+ switch (storage_type) {
+ case StorageType::EXTERNAL:
+ storage = 1;
+ break;
+ case StorageType::EXTENDED:
+ storage = 2;
+ break;
+ default:
+ LOG(ERROR) << "Unknown storage type";
+ break;
+ }
vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT,
&default_storage);
- vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT, 1);
+ vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_INSTALL_APPLICATIONS_INT, storage);
const char* argv[] = {"", "-i", path.c_str(), "-u", kTestUserIdStr.c_str()};
ci::AppInstaller::Result result =
const bf::path& legacy_path,
PackageType type,
RequestResult mode) {
- if (InstallExternal(path, type) != ci::AppInstaller::Result::OK) {
+ if (InstallWithStorage(path, type, StorageType::EXTERNAL) !=
+ ci::AppInstaller::Result::OK) {
LOG(ERROR) << "Failed to install application. Cannot perform Migrate";
return ci::AppInstaller::Result::ERROR;
}
HYBRID
};
+enum class StorageType {
+ INTERNAL,
+ EXTERNAL,
+ EXTENDED
+};
+
ci::RequestMode ParseRequestMode(int argc, char** argv);
bool TouchFile(const bf::path& path);
bool CheckAvailableExternalPath();
-ci::AppInstaller::Result InstallExternal(const bf::path& path,
+bool CheckAvailableExtendedStorage();
+
+ci::AppInstaller::Result InstallWithStorage(const bf::path& path,
PackageType type,
+ StorageType storage = StorageType::INTERNAL,
RequestResult mode = RequestResult::NORMAL);
ci::AppInstaller::Result MigrateLegacyExternalImage(const std::string& pkgid,