Make smoke utils as a library 05/228605/5
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 24 Mar 2020 06:20:40 +0000 (15:20 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Fri, 17 Apr 2020 03:24:44 +0000 (03:24 +0000)
This wgt-smoke-utils library is used at smoke test of unified-installer.

Requires:
 - https://review.tizen.org/gerrit/c/platform/core/appfw/app-installers/+/228720

Change-Id: I7689f92e3699073fbd4c1836e917d06f7470784a
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
CMakeLists.txt
packaging/wgt-backend.spec
src/unit_tests/CMakeLists.txt
src/unit_tests/extensive_smoke_test.cc
src/unit_tests/smoke_test.cc
src/unit_tests/smoke_utils.cc [deleted file]
src/unit_tests/smoke_utils.h [deleted file]
src/unit_tests/wgt_smoke_utils.cc [new file with mode: 0644]
src/unit_tests/wgt_smoke_utils.h [new file with mode: 0644]

index 86b3f98c5e4c3f2af19591d49d05230b382415b1..ff9ec022a32ed6aeaee60ecd2c7ae0e9b0401d96 100644 (file)
@@ -34,6 +34,7 @@ SET(TARGET_SMOKE_TEST "smoke-test")
 SET(TARGET_SMOKE_TEST_EXTENSIVE "extensive-smoke-test")
 SET(TARGET_SMOKE_TEST_HELPER "smoke-test-helper")
 SET(TARGET_MANIFEST_TEST "manifest-test")
+SET(TARGET_WGT_SMOKE_UTILS "wgt-smoke-utils")
 
 ADD_DEFINITIONS("-DPROJECT_TAG=\"WGT_BACKEND\"")
 
index 18a431e7eabcf3c7a102fe8da8862a196d625377..e83df85a33bcbb824830d2623a56afd2f0f62a23 100644 (file)
@@ -95,6 +95,8 @@ ln -s %{_bindir}/wgt-backend %{buildroot}%{_sysconfdir}/package-manager/backend/
 %manifest wgt-installer-tests.manifest
 %{_bindir}/wgt-installer-ut/*
 %{_datadir}/wgt-installer-ut/*
+%{_libdir}/libwgt-smoke-utils.so*
+%{_includedir}/app-installers/unit_tests/wgt_smoke_utils.h
 
 %changelog
 * Thu Dec 18 2015 Pawel Sikorski <p.sikorski@samsung.com> 0.1-1
index 380ad2d1a69534c9ec63f7c25b55852893aa76ff..203e3d73a522c1623049e9b559d6234018b55f30 100644 (file)
@@ -4,13 +4,9 @@ SET(TARGET_SMOKE_UTILS smoke-utils)
 # Executables
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST}
   smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_EXTENSIVE}
   extensive_smoke_test.cc
-  smoke_utils.h
-  smoke_utils.cc
 )
 ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
   smoke_test_helper.cc
@@ -18,6 +14,9 @@ ADD_EXECUTABLE(${TARGET_SMOKE_TEST_HELPER}
 ADD_EXECUTABLE(${TARGET_MANIFEST_TEST}
   manifest_test.cc
 )
+ADD_LIBRARY(${TARGET_WGT_SMOKE_UTILS} SHARED
+  wgt_smoke_utils.cc
+)
 
 TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
 TARGET_INCLUDE_DIRECTORIES(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
@@ -30,13 +29,11 @@ APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC
   Boost
   GTEST
   GUM_DEPS
-  VCONF_DEPS
 )
 APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC
   Boost
@@ -46,12 +43,15 @@ APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC
 # FindGTest module do not sets all needed libraries in GTEST_LIBRARIES and
 # GTest main libraries is still missing, so additional linking of
 # GTEST_MAIN_LIBRARIES is needed.
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
-TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
+TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_EXTENSIVE} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${GTEST_MAIN_LIBRARIES} ${TARGET_SMOKE_UTILS} ${TARGET_WGT_SMOKE_UTILS})
 TARGET_LINK_LIBRARIES(${TARGET_SMOKE_TEST_HELPER} PRIVATE ${TARGET_LIBNAME_WGT})
 TARGET_LINK_LIBRARIES(${TARGET_MANIFEST_TEST} PRIVATE ${TARGET_LIBNAME_WGT} ${GTEST_MAIN_LIBRARIES})
+TARGET_LINK_LIBRARIES(${TARGET_WGT_SMOKE_UTILS} PRIVATE ${TARGET_LIBNAME_WGT} ${TARGET_LIBNAME_HYBRID} ${TARGET_SMOKE_UTILS})
 
 INSTALL(TARGETS ${TARGET_SMOKE_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_EXTENSIVE} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_SMOKE_TEST_HELPER} DESTINATION ${BINDIR}/${DESTINATION_DIR})
 INSTALL(TARGETS ${TARGET_MANIFEST_TEST} DESTINATION ${BINDIR}/${DESTINATION_DIR})
+INSTALL(TARGETS ${TARGET_WGT_SMOKE_UTILS} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES wgt_smoke_utils.h DESTINATION ${INCLUDEDIR}/app-installers/unit_tests/)
index 92abb49aed27d552be67b600b4f4a439c4c7dcfa..bc4ef46bbfc82afb0f379ef5f9dc780bb457799d 100644 (file)
@@ -10,7 +10,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest-death-test.h>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/wgt_smoke_utils.h"
 
 namespace ci = common_installer;
 
index 53fc9ebc6b2422e197dcc2a4caffdb98ea6cef11..40a13048936a5d805e06a9b790786c690403984d 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <memory>
 
-#include "unit_tests/smoke_utils.h"
+#include "unit_tests/wgt_smoke_utils.h"
 
 namespace st = smoke_test;
 namespace bf = boost::filesystem;
diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc
deleted file mode 100644 (file)
index 44c8158..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#include <unit_tests/common/smoke_utils.h>
-
-#include <string>
-#include <vector>
-#include <utility>
-
-#include "wgt/wgt_installer.h"
-#include "hybrid/hybrid_installer.h"
-
-#include "unit_tests/smoke_utils.h"
-
-namespace ci = common_installer;
-namespace st = smoke_test;
-
-namespace smoke_test {
-
-const bf::path kSmokePackagesDirectory =
-    "/usr/share/wgt-installer-ut/test_samples/smoke/";
-
-bool ValidatePackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params) {
-  Apps apps;
-  for (const auto& appid : appids) {
-    apps.push_back(std::make_pair(appid, appid));
-  }
-  return ValidatePackage(pkgid, apps, params);
-}
-
-bool ValidateExternalPackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params) {
-  Apps apps;
-  for (const auto& appid : appids) {
-    apps.push_back(std::make_pair(appid, appid));
-  }
-  return ValidateExternalPackage(pkgid, apps, params);
-}
-
-bool ValidateExtendedPackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params) {
-  Apps apps;
-  for (const auto& appid : appids) {
-    apps.push_back(std::make_pair(appid, appid));
-  }
-  return ValidateExtendedPackage(pkgid, apps, params);
-}
-
-WgtBackendInterface::AppQueryInterfacePtr
-WgtBackendInterface::CreateQueryInterface() const {
-  return AppQueryInterfacePtr(new wgt::WgtAppQueryInterface());
-}
-
-WgtBackendInterface::AppInstallerPtr
-WgtBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const {
-  return AppInstallerPtr(new wgt::WgtInstaller(pkgmgr));
-}
-
-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());
-}
-
-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
diff --git a/src/unit_tests/smoke_utils.h b/src/unit_tests/smoke_utils.h
deleted file mode 100644 (file)
index 14e0994..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef UNIT_TESTS_SMOKE_UTILS_H_
-#define UNIT_TESTS_SMOKE_UTILS_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/utils/wgt_app_query_interface.h"
-
-namespace smoke_test {
-
-bool ValidatePackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params);
-
-bool ValidateExternalPackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params);
-
-bool ValidateExtendedPackage(const std::string& pkgid,
-    const std::vector<std::string>& appids,
-    const TestParameters& params);
-
-extern const bf::path kSmokePackagesDirectory;
-
-class WgtBackendInterface: public BackendInterface {
- public:
-  using BackendInterface::BackendInterface;
-
- private:
-  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 {
- public:
-  using BackendInterface::BackendInterface;
-
- private:
-  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
-
-
-#endif  // UNIT_TESTS_SMOKE_UTILS_H_
diff --git a/src/unit_tests/wgt_smoke_utils.cc b/src/unit_tests/wgt_smoke_utils.cc
new file mode 100644 (file)
index 0000000..d467315
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "unit_tests/wgt_smoke_utils.h"
+
+#include <unit_tests/common/smoke_utils.h>
+
+#include <string>
+#include <vector>
+#include <utility>
+
+#include "wgt/wgt_installer.h"
+#include "hybrid/hybrid_installer.h"
+
+namespace ci = common_installer;
+namespace st = smoke_test;
+
+namespace smoke_test {
+
+const bf::path kSmokePackagesDirectory =
+    "/usr/share/wgt-installer-ut/test_samples/smoke/";
+
+bool ValidatePackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params) {
+  Apps apps;
+  for (const auto& appid : appids) {
+    apps.push_back(std::make_pair(appid, appid));
+  }
+  return ValidatePackage(pkgid, apps, params);
+}
+
+bool ValidateExternalPackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params) {
+  Apps apps;
+  for (const auto& appid : appids) {
+    apps.push_back(std::make_pair(appid, appid));
+  }
+  return ValidateExternalPackage(pkgid, apps, params);
+}
+
+bool ValidateExtendedPackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params) {
+  Apps apps;
+  for (const auto& appid : appids) {
+    apps.push_back(std::make_pair(appid, appid));
+  }
+  return ValidateExtendedPackage(pkgid, apps, params);
+}
+
+WgtBackendInterface::AppQueryInterfacePtr
+WgtBackendInterface::CreateQueryInterface() const {
+  return AppQueryInterfacePtr(new wgt::WgtAppQueryInterface());
+}
+
+WgtBackendInterface::AppInstallerPtr
+WgtBackendInterface::CreateInstaller(ci::PkgMgrPtr pkgmgr) const {
+  return AppInstallerPtr(new wgt::WgtInstaller(pkgmgr));
+}
+
+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());
+}
+
+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
diff --git a/src/unit_tests/wgt_smoke_utils.h b/src/unit_tests/wgt_smoke_utils.h
new file mode 100644 (file)
index 0000000..6de6b32
--- /dev/null
@@ -0,0 +1,137 @@
+// Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef UNIT_TESTS_WGT_SMOKE_UTILS_H_
+#define UNIT_TESTS_WGT_SMOKE_UTILS_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/utils/wgt_app_query_interface.h"
+
+namespace smoke_test {
+
+bool ValidatePackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params);
+
+bool ValidateExternalPackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params);
+
+bool ValidateExtendedPackage(const std::string& pkgid,
+    const std::vector<std::string>& appids,
+    const TestParameters& params);
+
+extern const bf::path kSmokePackagesDirectory;
+
+class WgtBackendInterface: public BackendInterface {
+ public:
+  using BackendInterface::BackendInterface;
+
+// private:
+  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 {
+ public:
+  using BackendInterface::BackendInterface;
+
+  AppQueryInterfacePtr CreateQueryInterface() const override;
+  AppInstallerPtr CreateInstaller(
+      common_installer::PkgMgrPtr pkgmgr) const override;
+  AppInstallerPtr CreateFailExpectedInstaller(
+      common_installer::PkgMgrPtr pkgmgr, int fail_at) const override;
+};
+
+#ifdef OVERRIDE_STEPS_BLOCK
+#undef OVERRIDE_STEPS_BLOCK
+#endif
+#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
+
+
+#endif  // UNIT_TESTS_WGT_SMOKE_UTILS_H_