return AppInstallerPtr(new wgt::WgtInstaller(pkgmgr));
}
-WgtBackendInterface::AppQueryInterfacePtr
+WgtBackendInterface::AppInstallerPtr
+WgtBackendInterface::CreateFailExpectedInstaller(
+ ci::PkgMgrPtr pkgmgr, int fail_at) const {
+ return AppInstallerPtr(new FailExpectedWgtInstaller(pkgmgr, fail_at));
+}
+
+HybridBackendInterface::AppQueryInterfacePtr
HybridBackendInterface::CreateQueryInterface() const {
return AppQueryInterfacePtr(new wgt::WgtAppQueryInterface());
}
-WgtBackendInterface::AppInstallerPtr
+HybridBackendInterface::AppInstallerPtr
HybridBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const {
return AppInstallerPtr(new hybrid::HybridInstaller(pkgmgr));
}
+HybridBackendInterface::AppInstallerPtr
+HybridBackendInterface::CreateFailExpectedInstaller(
+ ci::PkgMgrPtr pkgmgr, int fail_at) const {
+ return AppInstallerPtr(new FailExpectedHybridInstaller(pkgmgr, fail_at));
+}
+
} // namespace smoke_test
#ifndef UNIT_TESTS_SMOKE_UTILS_H_
#define UNIT_TESTS_SMOKE_UTILS_H_
-#include <common/pkgmgr_interface.h>
#include <common/app_installer.h>
+#include <common/pkgmgr_interface.h>
+#include <common/step/configuration/step_fail.h>
#include <unit_tests/common/smoke_utils.h>
#include <memory>
#include <string>
#include <vector>
+#include "hybrid/hybrid_installer.h"
+#include "wgt/wgt_installer.h"
#include "wgt/wgt_app_query_interface.h"
namespace smoke_test {
AppQueryInterfacePtr CreateQueryInterface() const override;
AppInstallerPtr CreateInstaller(
common_installer::PkgMgrPtr pkgmgr) const override;
+ AppInstallerPtr CreateFailExpectedInstaller(
+ common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
};
class HybridBackendInterface: public BackendInterface {
AppQueryInterfacePtr CreateQueryInterface() const override;
AppInstallerPtr CreateInstaller(
common_installer::PkgMgrPtr pkgmgr) const override;
+ AppInstallerPtr CreateFailExpectedInstaller(
+ common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
+};
+
+#define OVERRIDE_STEPS_BLOCK(TYPE, STEPS) \
+ void STEPS() override { \
+ TYPE::STEPS(); \
+ if (fail_at_ > -1) \
+ AddStepAtIndex<common_installer::configuration::StepFail>(fail_at_); \
+ else \
+ AddStep<common_installer::configuration::StepFail>(); \
+ } \
+
+class FailExpectedWgtInstaller : public wgt::WgtInstaller {
+ public:
+ explicit FailExpectedWgtInstaller(
+ common_installer::PkgMgrPtr pkgmgr, int fail_at)
+ : wgt::WgtInstaller(pkgmgr), fail_at_(fail_at) { }
+
+ private:
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, InstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UpdateSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, UninstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReinstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DeltaSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MoveSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverySteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountInstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MountUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectInstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestDirectUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialInstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ManifestPartialUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, PartialUninstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateInstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, ReadonlyUpdateUninstallSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, DisablePkgSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, EnablePkgSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, MigrateExtImgSteps)
+ OVERRIDE_STEPS_BLOCK(wgt::WgtInstaller, RecoverDBSteps)
+
+ int fail_at_;
+};
+
+class FailExpectedHybridInstaller : public hybrid::HybridInstaller {
+ public:
+ explicit FailExpectedHybridInstaller(
+ common_installer::PkgMgrPtr pkgmgr, int fail_at)
+ : hybrid::HybridInstaller(pkgmgr), fail_at_(fail_at) { }
+
+ private:
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, InstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UpdateSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, UninstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReinstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DeltaSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MoveSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverySteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountInstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MountUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectInstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestDirectUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialInstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ManifestPartialUpdateSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, PartialUninstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateInstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, ReadonlyUpdateUninstallSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, DisablePkgSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, EnablePkgSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, MigrateExtImgSteps)
+ OVERRIDE_STEPS_BLOCK(hybrid::HybridInstaller, RecoverDBSteps)
+
+ int fail_at_;
};
} // namespace smoke_test