class Singleton refactored 62/144962/9
authorMariusz Wachowicz <m.wachowicz@partner.samsung.com>
Fri, 18 Aug 2017 12:18:25 +0000 (14:18 +0200)
committerMariusz Wachowicz <m.wachowicz@partner.samsung.com>
Tue, 22 Aug 2017 11:34:06 +0000 (11:34 +0000)
solves static initialization order fiasco

Change-Id: I909cd25305f8660ac3548126ebf65eec2d0421e5

18 files changed:
src/AccessoriesSwitchProvider.cpp
src/Atspi.hpp
src/MenuBuilder.cpp
src/NavigationInterface.cpp
src/NavigationInterface.hpp
src/PointScanner.cpp
src/RowScanner.cpp
src/ScanningProperties.cpp
src/ScreenScannerManager.cpp
src/SelectActivity.cpp
src/Singleton.hpp
src/SwitchInteractionManager.cpp
src/SwitchInteractionManager.hpp
src/UniversalSwitch.hpp
src/VConf.cpp
src/VConf.hpp
tests/no-ui-scenarios/MenuBuilderTests.cpp
tests/no-ui-scenarios/VConfImplTests.cpp

index 8041dc2794089aed18293aeac5668fd3fee0fb18..61aefb19cac8afc3e74d35e8f93155f274c27ce6 100644 (file)
@@ -682,7 +682,8 @@ AccessoriesSwitchProvider::AccessoriesSwitchProvider()
        keyUpHandler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, keyUpCb, this);
 
        // Due to platform restrictions, vconf key used below is being set to 'true' only if hardware keyboard (either usb or bluetooth) started to input data
-       onDisconnectionHandler = VConfSingleton::instance().registerKeyChangedCb<bool>("memory/isf/hw_keyboard_input_detected", [this](bool x) {
+       onDisconnectionHandler = Singleton<VConfInterface>::instance().registerKeyChangedCb<bool>("memory/isf/hw_keyboard_input_detected",
+       [this](bool x) {
                if (!x)
                        notify(shared_from_this());
        });
index 325bdc6eb503c6833d1006017a9c9d35413eaefd..357e27c36e24a7274083177d625f003cb5ef3df4 100644 (file)
@@ -45,6 +45,7 @@ public:
        Optional<size_t> getIndexInParent(const std::shared_ptr<AtspiAccessible> &accessibleObj) const;
        std::shared_ptr<AtspiSelection> getSelectionInterface(const std::shared_ptr<AtspiAccessible> &accessibleObj) const;
        bool selectChild(const std::shared_ptr<AtspiSelection> &accessibleObj, size_t index) const;
+
 private:
        bool ConnectAtClient();
        bool DisconnectAtClient();
index 5b1ff33753e2d5aa8ca7f3f36162312d294c2fba..a50e7b083487cf83f0f894a78f589e50beb5268d 100644 (file)
@@ -40,7 +40,8 @@ std::string MenuItem::getShowingStateVconfKey() const
 
 int MenuItem::getMessageIndex() const  /*works for Vconf keynodes having integer value*/
 {
-       auto val = VConfSingleton::instance().get(menuItemStateVconfKey.c_str(), 0) - 1;        /*Int type vconf key. Correct index starts from 1, 0 means error*/
+       // Int type vconf key. Correct index starts from 1, 0 means error
+       auto val = Singleton<VConfInterface>::instance().get(menuItemStateVconfKey.c_str(), 0) - 1;
        if (val >= static_cast<int>(names.size()) || val < 0) {
                ERROR("Wrong message index from vconf, using default value");
                return 0;
@@ -412,14 +413,14 @@ std::vector<std::shared_ptr<MenuItem>> MenuMap::find(std::string menuLabel)
 {
 
        if (menuLabel.find("IDS_MENU_MAIN") != std::string::npos &&
-                       !VConfSingleton::instance().get("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", false))
+                       !Singleton<VConfInterface>::instance().get("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", false))
                menuLabel = "IDS_MENU_MAIN_NORMAL";
 
        std::vector<std::shared_ptr<MenuItem>> foundMenuItems;
        auto keyRange = map.equal_range(menuLabel);
        for (auto ii = keyRange.first; ii != keyRange.second; ++ii) {
                const auto &showingStateVconfKey = ii->second->getShowingStateVconfKey();
-               if (showingStateVconfKey.empty() || VConfSingleton::instance().get(showingStateVconfKey.c_str(), false))
+               if (showingStateVconfKey.empty() || Singleton<VConfInterface>::instance().get(showingStateVconfKey.c_str(), false))
                        foundMenuItems.push_back(ii->second);
        }
 
index 86662ba5f44dc608a144ffdf77be7d2eca03df51..4dd1d7411beea7e0e8e0dde62038ed00554cd899 100644 (file)
@@ -383,6 +383,7 @@ public:
                LISTEN(FirstElementInRow);
                LISTEN(LastElementInRow);
 #undef LISTEN
+
 #define LISTEN(n, SignalName) \
        do { navProxy.listen(SignalName, std::function<void()>([=]() { emitCallback(CallbackType::n); })); } while(0)
                LISTEN(DashedRow, "SpecialRow");
@@ -401,7 +402,6 @@ public:
                [ = ](AtspiAccessiblePtr root, std::vector<std::pair<std::string, std::string>> attrs) {
                        hack_setRootObjectAttributes(root, std::move(attrs));
                }));
-
        }
 
        ~NavigationImpl() = default;
@@ -461,4 +461,8 @@ private:
 };
 
 template<>
-std::unique_ptr<NavigationInterface> NavigationSingleton::implementation = std::unique_ptr<NavigationInterface>(new NavigationImpl);
+template<>
+std::unique_ptr<NavigationInterface> Singleton<NavigationInterface>::createImplementation<NavigationInterface>()
+{
+       return std::unique_ptr<NavigationInterface> { new NavigationImpl };
+}
\ No newline at end of file
index 04da3308186ab438f0f0a8abdcfaff2988c36378..6134acd26d1ff1a4934562b11f84901cc833e347 100644 (file)
@@ -9,9 +9,6 @@
 #include <vector>
 #include <memory>
 
-class NavigationInterface;
-using NavigationSingleton = MockableSingleton<NavigationInterface>;
-
 class NavigationInterface
 {
 public:
@@ -47,7 +44,7 @@ public:
 
                virtual ~CallbackHandleBase()
                {
-                       NavigationSingleton::instance().unregisterCb(this);
+                       Singleton<NavigationInterface>::instance().unregisterCb(this);
                }
        };
        using CallbackHandle = std::unique_ptr<CallbackHandleBase>;
index b746f830b0c3ce3ad87324b5b70177f84f752251..e6d69c19aefc6d067a1e6f4ad03165a7472cf08d 100644 (file)
@@ -104,7 +104,7 @@ Optional<std::shared_ptr<UIElement>> PointScannerImpl::acceptAutoscanningPhase()
                state = State::END;
 
                DEBUG("Scanning complete");
-               return std::move(NavigationSingleton::instance().getElementAtPoint(pointX, pointY));
+               return Singleton<NavigationInterface>::instance().getElementAtPoint(pointX, pointY);
        case State::END:
                ERROR("State::END case should not be reached");
        }
index 0bc142ab99ba5348c7dd00d79d1c26da9ba47606..ecac8d8c75d893310aa30cf05e6f1426a249caf0 100644 (file)
@@ -101,7 +101,7 @@ RowScannerImpl::RowScannerImpl(const ScanningProperties &properties)
 {
        ASSERT(properties.getAutoScanInterval() > 0, "autoScanInterval has to be bigger than 0");
 
-       auto &navigation = NavigationSingleton::instance();
+       auto &navigation = Singleton<NavigationInterface>::instance();
        navigation.resetPosition();
        using CT = NavigationInterface::CallbackType;
        navigationHandles.push_back(navigation.registerCb<CT::DashedRow>([ = ]() {
@@ -165,7 +165,7 @@ Optional<std::shared_ptr<UIElement>> RowScannerImpl::acceptAutoscanningPhase()
                stopScanning();
                state = State::END;
                DEBUG("Scanning complete");
-               return NavigationSingleton::instance().getCurrentElement();
+               return Singleton<NavigationInterface>::instance().getCurrentElement();
        case State::END:
                ERROR("State::END case should not be reached");
        }
@@ -282,10 +282,10 @@ void RowScannerImpl::nextRow()
 {
        switch (properties.getDirectionVertical()) {
        case VerticalScanningDirection::TO_BOTTOM:
-               NavigationSingleton::instance().nextRow();
+               Singleton<NavigationInterface>::instance().nextRow();
                return;
        case VerticalScanningDirection::TO_TOP:
-               NavigationSingleton::instance().prevRow();
+               Singleton<NavigationInterface>::instance().prevRow();
                return;
        }
 }
@@ -294,10 +294,10 @@ void RowScannerImpl::nextElementInRow()
 {
        switch (properties.getDirectionHorizontal()) {
        case HorizontalScanningDirection::TO_RIGHT:
-               NavigationSingleton::instance().nextElementInRow();
+               Singleton<NavigationInterface>::instance().nextElementInRow();
                return;
        case HorizontalScanningDirection::TO_LEFT:
-               NavigationSingleton::instance().prevElementInRow();
+               Singleton<NavigationInterface>::instance().prevElementInRow();
                return;
        }
 }
index 89c9a3e9521e7c6d44e3be2582d92bee599ad4b8..97c0c919f31390bdf12cfc268465688cab821928 100644 (file)
@@ -78,7 +78,8 @@ void ScanningProperties::readScanningProperties()
 template<class T,  class SetterMethod>
 void ScanningProperties::registerAndSet(const std::string &key, T defaultValue, SetterMethod setterMethod)
 {
-       vconfHandles.push_back(VConfSingleton::instance().registerAndGet<T>(key, defaultValue, std::bind(setterMethod, this, std::placeholders::_1)));
+       vconfHandles.push_back(Singleton<VConfInterface>::instance()
+                                                  .registerAndGet<T>(key, defaultValue, std::bind(setterMethod, this, std::placeholders::_1)));
 }
 
 void ScanningProperties::setCachedAutoScanEnabled(bool state)
index d5331e1b0e1f2d2cdc329568b8715f3c0ae92b62..1565b39bb5df88d2bb8a6ad6ec85985e7d2dbb54 100644 (file)
@@ -8,7 +8,8 @@ static constexpr double DELAYED_ACCEPTATION_TIME_S = 0.2;
 
 ScreenScannerManager::ScreenScannerManager()
 {
-       contextChangedHandle.push_back(NavigationSingleton::instance().registerCb<NavigationInterface::CallbackType::ContextChanged>(
+       contextChangedHandle.push_back(Singleton<NavigationInterface>::instance()
+                                                                  .registerCb<NavigationInterface::CallbackType::ContextChanged>(
        [this](std::shared_ptr<UIElement> obj) {
                onContextChanged(obj);
        }));
@@ -76,7 +77,7 @@ void ScreenScannerManager::acceptAutoscanning()
 {
        Optional<std::shared_ptr<UIElement>> element;
        if (!properties.isAutoScanEnabled() && properties.getMethod() == ScanningMethod::ROW)
-               element = NavigationSingleton::instance().getCurrentElement();
+               element = Singleton<NavigationInterface>::instance().getCurrentElement();
        else {
                if (!screenScanner) {
                        ERROR("scanner type not selected");
@@ -122,4 +123,3 @@ void ScreenScannerManager::restartCb(void *data, Evas_Object *obj, void *event)
        auto ssm = static_cast<ScreenScannerManager *>(data);
        ssm->onRestart();
 }
-
index d36eff0ddf95654f7f3685ffc365f7f2e92a2de2..0895ce948417cc332a60092aed0075c48cf32cea 100644 (file)
@@ -110,8 +110,8 @@ void SelectActivity::update(const std::shared_ptr<UIElement> &elem)
        }
 
        realUiElement = elem;
-       if (VConfSingleton::instance().get(AUTO_TAP_KEY, 1) == 2) {
-               VConfSingleton::instance().registerAndGet<int>(AUTO_TAP_WAITING_PERIOD_KEY, AUTO_TAP_WAITING_PERIOD_DEFAULT_TIME,
+       if (Singleton<VConfInterface>::instance().get(AUTO_TAP_KEY, 1) == 2) {
+               Singleton<VConfInterface>::instance().registerAndGet<int>(AUTO_TAP_WAITING_PERIOD_KEY, AUTO_TAP_WAITING_PERIOD_DEFAULT_TIME,
                                std::bind(&SelectActivity::setAutoTapWaitingPeriodCb, this, std::placeholders::_1));
                timer = ecore_timer_add(autoTapWaitingPeriod, autoTapCb, this);
                return;
@@ -256,16 +256,16 @@ std::string SelectActivity::getCompleteLabelOfMenu()
                return getCompleteLabelOfMainMenu();
 
        if (nestedMenusLabels.back() == "IDS_MENU_SETTINGS") {
-               auto completeLabelOfSettingsMenu = VConfSingleton::instance().get(AUTO_SCAN_KEY, false) ?
-                                                                                  "IDS_MENU_SETTINGS_AUTO_SCAN_ON" : "IDS_MENU_SETTINGS_AUTO_SCAN_OFF";
-               callbackHandle.push(VConfSingleton::instance().registerKeyChangedCb<bool>(AUTO_SCAN_KEY,
-                                                       std::bind(&SelectActivity::refreshMenu, this)));
+               auto completeLabelOfSettingsMenu = Singleton<VConfInterface>::instance()
+                                                                                  .get(AUTO_SCAN_KEY, false) ? "IDS_MENU_SETTINGS_AUTO_SCAN_ON" : "IDS_MENU_SETTINGS_AUTO_SCAN_OFF";
+               callbackHandle.push(Singleton<VConfInterface>::instance()
+                                                       .registerKeyChangedCb<bool>(AUTO_SCAN_KEY, std::bind(&SelectActivity::refreshMenu, this)));
                return completeLabelOfSettingsMenu;
        }
 
        if (nestedMenusLabels.back() == "IDS_MENU_AUTO_SCROLL")
-               return (VConfSingleton::instance().get(AUTO_SCROLL_KEY, 1) - 1) ?
-                          "IDS_MENU_AUTO_SCROLL_ON" : "IDS_MENU_AUTO_SCROLL_OFF";
+               return (Singleton<VConfInterface>::instance()
+                               .get(AUTO_SCROLL_KEY, 1) - 1) ? "IDS_MENU_AUTO_SCROLL_ON" : "IDS_MENU_AUTO_SCROLL_OFF";
 
        if (nestedMenusLabels.back() == "IDS_MENU_BUTTONS_KEYS")
                return getCompleteLabelOfButtonsKeysMenu();
@@ -382,8 +382,8 @@ int SelectActivity::addItemsToMenu(Evas_Object *gengrid, const std::string &comp
                        elm_atspi_accessible_can_highlight_set(object, EINA_FALSE);
 
                if (!menuItems.back()->getMenuItemStateVconfKey().empty()) {
-                       callbackHandle.push(VConfSingleton::instance().registerKeyChangedCb<int>(menuItems.back()->getMenuItemStateVconfKey(),
-                                                               std::bind(&SelectActivity::refreshMenu, this)));
+                       callbackHandle.push(Singleton<VConfInterface>::instance()
+                                                               .registerKeyChangedCb<int>(menuItems.back()->getMenuItemStateVconfKey(), std::bind(&SelectActivity::refreshMenu, this)));
                }
                menuItems.pop_back();
        }
index 9dd6eae85ccebb047986c194b76a5d2029fafea6..f458ecdfa95240173661b803feb4ae3a5f15b70a 100644 (file)
@@ -1,25 +1,25 @@
 #ifndef SINGLETON_HPP
 #define SINGLETON_HPP
 
-#include "UniversalSwitchLog.hpp"
-
+#include <type_traits>
 #include <memory>
 
 /*
  * Classes below provides convenient way to create singletons without writing boilerplate code.
  * The usage is as follows:
+ *     Define function createImplementation if class is derived from interface
  *     Singleton<MyClass>::instance.myMethod();
  * Class provided as template parameter must contain public empty constructor
  */
 
-template <class Implementation>
+template <class T>
 class Singleton
 {
 public:
-       static Implementation &instance()
+       static T &instance()
        {
-               static Implementation implementation;
-               return implementation;
+               static std::unique_ptr<T> instance{ createImplementation() };
+               return *instance;
        }
 
 private:
@@ -28,31 +28,15 @@ private:
        Singleton(Singleton &&) = delete;
        Singleton &operator = (const Singleton &) = delete;
        Singleton &operator = (Singleton &&) = delete;
-};
 
-template <class Implementation>
-class MockableSingleton
-{
-public:
-       static Implementation &instance()
+       template<class Q = T>
+       static typename std::enable_if<std::is_default_constructible<Q>::value, std::unique_ptr<Q>>::type createImplementation()
        {
-               ASSERT(implementation, "implementation in MockableSingleton do not properly initialized");
-               return *implementation;
+               return std::unique_ptr<Q> { new Q };
        }
 
-       static void setImplementation(std::unique_ptr<Implementation> &&impl)
-       {
-               implementation = std::move(impl);
-       }
-
-private:
-       MockableSingleton() = default;
-       MockableSingleton(const MockableSingleton &) = delete;
-       MockableSingleton(MockableSingleton &&) = delete;
-       MockableSingleton &operator = (const MockableSingleton &) = delete;
-       MockableSingleton &operator = (MockableSingleton &&) = delete;
-
-       static std::unique_ptr<Implementation> implementation;
+       template<class Q = T>
+       static typename std::enable_if < !std::is_default_constructible<Q>::value, std::unique_ptr<Q >>::type createImplementation();
 };
 
 #endif
index 41d34e26740c238eb4c5b53c50452b217cd7b35b..88db0cb52947fd36443601c22b33604ab7f715d9 100644 (file)
@@ -19,7 +19,7 @@ void SwitchInteractionManager::startInteraction(const NotifyMethod &method, cons
        }
 
        if (currentSwitch && sw && currentSwitch->getId()->getGlobalId() != sw->getId()->getGlobalId()) {
-               uncoditionallyStopInteraction();
+               unconditionallyStopInteraction();
                return;
        }
 
@@ -42,7 +42,7 @@ void SwitchInteractionManager::stopInteraction(const std::shared_ptr<Switch> &sw
        if (!currentSwitch || !sw || currentSwitch->getId()->getGlobalId() != sw->getId()->getGlobalId())
                return;
 
-       uncoditionallyStopInteraction();
+       unconditionallyStopInteraction();
 }
 
 double SwitchInteractionManager::getMinimalSwitchInteractionTime() const
@@ -64,15 +64,18 @@ SwitchInteractionManager::SwitchInteractionManager()
        : minimalSwitchInteractionTime(0.0), switchInteractionInterval(0.0), notificationRepetitionInterval(0.0),
          minimalSwitchInteractionTimer(nullptr), switchInteractionIntervalTimer(nullptr), notificationRepetitionIntervalTimer(nullptr)
 {
-       minimalSwitchInteractionTimeHandler = VConfSingleton::instance().registerAndGet<double>(VCONF_PREFIX "TAP_DURATION_VALUE", 0.0, [this](int x) {
+       minimalSwitchInteractionTimeHandler = Singleton<VConfInterface>::instance()
+       .registerAndGet<double>(VCONF_PREFIX "TAP_DURATION_VALUE", 0.0, [this](int x) {
                minimalSwitchInteractionTime = x;
        });
 
-       switchInteractionIntervalHandler = VConfSingleton::instance().registerAndGet<double>(VCONF_PREFIX "SGL_IACTION_INT_VALUE", 0.0, [this](int x) {
+       switchInteractionIntervalHandler = Singleton<VConfInterface>::instance()
+       .registerAndGet<double>(VCONF_PREFIX "SGL_INACTION_INT_VALUE", 0.0, [this](int x) {
                switchInteractionInterval = x;
        });
 
-       notificationRepetitionIntervalHandler = VConfSingleton::instance().registerAndGet<double>(VCONF_PREFIX "AUTO_MOVE_INT_VALUE", 0.0, [this](int x) {
+       notificationRepetitionIntervalHandler = Singleton<VConfInterface>::instance()
+       .registerAndGet<double>(VCONF_PREFIX "AUTO_MOVE_INT_VALUE", 0.0, [this](int x) {
                notificationRepetitionInterval = x;
        });
 }
@@ -84,7 +87,7 @@ SwitchInteractionManager::~SwitchInteractionManager()
        deleteAndClearTimer(notificationRepetitionIntervalTimer);
 }
 
-void SwitchInteractionManager::uncoditionallyStopInteraction()
+void SwitchInteractionManager::unconditionallyStopInteraction()
 {
        deleteAndClearTimer(minimalSwitchInteractionTimer);
        deleteAndClearTimer(notificationRepetitionIntervalTimer);
index 46d6aade7fd53b5064681389733d2e726d6134f3..4cef8ab6d71bd7fdd13d757ce8e233928bc40b3f 100644 (file)
@@ -28,7 +28,7 @@ private:
        SwitchInteractionManager &operator = (const SwitchInteractionManager &) = delete;
        SwitchInteractionManager &operator = (SwitchInteractionManager &&) = delete;
 
-       void uncoditionallyStopInteraction();
+       void unconditionallyStopInteraction();
 
        void deleteAndClearTimer(Ecore_Timer *&timer);
        bool isActiveInteraction = false;
index ce1db76185922090fba43f1b91f08c2589413ca0..99a4cec99c0864c971dfd5d8db3a752a179a28d3 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "Singleton.hpp"
 
+#include <memory>
+
 class SwitchManager;
 class CompositeSwitchProvider;
 class Configuration;
index 094bfeefaed62100d9ea6e2bc2d3716852a49b37..d94ec5bd2d6511ddf671b1832a08a3704be2be57 100644 (file)
@@ -226,4 +226,8 @@ public:
 };
 
 template<>
-std::unique_ptr<VConfInterface> VConfSingleton::implementation = std::unique_ptr<VConfInterface>(new VConfImpl);
+template<>
+std::unique_ptr<VConfInterface> Singleton<VConfInterface>::createImplementation<VConfInterface>()
+{
+       return std::unique_ptr<VConfInterface> { new VConfImpl };
+}
index 08d0d433819a3b538974860f51497900de84d74f..ff16b9d57f46c1bbf74082f546872de74d73af07 100644 (file)
@@ -46,6 +46,4 @@ public:
        }
 };
 
-using VConfSingleton = MockableSingleton<VConfInterface>;
-
 #endif
index 2bd9efd7320b6218a7a4e0c961a06fa86e64ddcb..98fa7986536bb3030b525a1ee8fe723ddd021a46 100644 (file)
@@ -8,24 +8,24 @@ class MenuBuilderTest : public ::testing::Test
 public:
        void setIntKeys(int val)
        {
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCROLL", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_METHOD", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIRECTION_VERTICAL", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_GRANULARITY_UNIT", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_AUTO_SCROLL", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_METHOD", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SCAN_DIRECTION_VERTICAL", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_SOUND", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_FEEDBACK_VOICE", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_GRANULARITY_UNIT", val);
        }
 
        void setBoolKeys(bool val)
        {
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_GESTURES_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_ACTIONS_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_SETTINGS_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_RECENT_APPS_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_HOME_SCREEN_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_BACK_MENU_ITEM", val);
-               VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_BUTTONS_AND_KEYS_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_GESTURES_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_ACTIONS_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_SETTINGS_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_RECENT_APPS_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_HOME_SCREEN_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_BACK_MENU_ITEM", val);
+               Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_BUTTONS_AND_KEYS_MENU_ITEM", val);
        }
 
        void SetUp()
@@ -69,7 +69,7 @@ TEST_F(MenuBuilderTest, testContentOfMenuMainNormal)
 
 TEST_F(MenuBuilderTest, testImpactOfContextualMenuVconfValueOnMenuMain)
 {
-       VConfSingleton::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", false);
+       Singleton<VConfInterface>::instance().set("__KEY_ACCESSIBILITY_UNIVERSAL_SWITCH_SETTINGS_SHOW_CONTEXTUAL_MENU", false);
        testIfMenuMainIsEqualToNormal("IDS_MENU_MAIN_HOME_APPS");
        testIfMenuMainIsEqualToNormal("IDS_MENU_MAIN_SLIDER");
        testIfMenuMainIsEqualToNormal("IDS_MENU_MAIN_EDITABLE_TEXT");
index 198297faadc647b9a16a0bcd474bba9d5e7cb2c5..7416bae3fbe11a5689caf4d42c0c04c41cc9441a 100644 (file)
@@ -6,60 +6,60 @@
 
 void restoreDefault()
 {
-       VConfSingleton::instance().set("VconfImplTest/int/20", 20);
-       VConfSingleton::instance().set("VconfImplTest/string/foo", std::string("foo"));
-       VConfSingleton::instance().set("VconfImplTest/bool/true", true);
-       VConfSingleton::instance().set("VconfImplTest/double/3.14", 3.14);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 20);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/string/foo", std::string("foo"));
+       Singleton<VConfInterface>::instance().set("VconfImplTest/bool/true", true);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/double/3.14", 3.14);
 }
 
 TEST(VconfImplTest, get)
 {
-       EXPECT_EQ(VConfSingleton::instance().get("not_defined", 10), 10);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("not_defined", 10), 10);
 
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/int/20", 10), 20);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/int/20", true), true);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/int/20", 10), 20);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/int/20", true), true);
 
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/string/foo", 10), 10);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/string/foo", std::string("bar")), std::string("foo"));
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/string/foo", 10), 10);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/string/foo", std::string("bar")), std::string("foo"));
 
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/bool/true", false), true);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/bool/true", 10.1), 10.1);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/bool/true", false), true);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/bool/true", 10.1), 10.1);
 
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/double/3.14", 1.1), 3.14);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/double/3.14", 1), 1);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/double/3.14", 1.1), 3.14);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/double/3.14", 1), 1);
 }
 
 TEST(VconfImplTest, set)
 {
-       VConfSingleton::instance().set("not_defined", 20);
-       EXPECT_EQ(VConfSingleton::instance().get("not_defined", 8), 8);
+       Singleton<VConfInterface>::instance().set("not_defined", 20);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("not_defined", 8), 8);
 
 
-       VConfSingleton::instance().set("VconfImplTest/int/20", 13);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/int/20", 7), 13);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 13);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/int/20", 7), 13);
        //change type
-       VConfSingleton::instance().set("VconfImplTest/int/20", 1.1);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/int/20", 12.6), 1.1);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 1.1);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/int/20", 12.6), 1.1);
 
-       VConfSingleton::instance().set("VconfImplTest/string/foo", std::string("bar2"));
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/string/foo", std::string("bar1")), std::string("bar2"));
+       Singleton<VConfInterface>::instance().set("VconfImplTest/string/foo", std::string("bar2"));
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/string/foo", std::string("bar1")), std::string("bar2"));
        //change type
-       VConfSingleton::instance().set("VconfImplTest/string/foo", 12);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/string/foo", 13), 12);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/string/foo", 12);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/string/foo", 13), 12);
 
-       VConfSingleton::instance().set("VconfImplTest/bool/true", false);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/bool/true", true), false);
-       VConfSingleton::instance().set("VconfImplTest/bool/true", true);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/bool/true", true), true);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/bool/true", false);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/bool/true", true), false);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/bool/true", true);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/bool/true", true), true);
        //change type
-       VConfSingleton::instance().set("VconfImplTest/bool/true", 12.1);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/bool/true", 8.1), 12.1);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/bool/true", 12.1);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/bool/true", 8.1), 12.1);
 
-       VConfSingleton::instance().set("VconfImplTest/double/3.14", 12.1);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/double/3.14", 1.1), 12.1);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/double/3.14", 12.1);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/double/3.14", 1.1), 12.1);
        //change type
-       VConfSingleton::instance().set("VconfImplTest/double/3.14", 8);
-       EXPECT_EQ(VConfSingleton::instance().get("VconfImplTest/double/3.14", 7), 8);
+       Singleton<VConfInterface>::instance().set("VconfImplTest/double/3.14", 8);
+       EXPECT_EQ(Singleton<VConfInterface>::instance().get("VconfImplTest/double/3.14", 7), 8);
 
        restoreDefault();
 }
@@ -101,9 +101,9 @@ void testCallback(int x)
 TEST(VconfImplTest, registerKeyChangedCb_int)
 {
        INFO("registerKeyChangedCb_int");
-       auto h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", testCallback);
+       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", testCallback);
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 132);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 132);
        });
        EXPECT_EQ(testCallbackValue, 132);
 }
@@ -112,12 +112,12 @@ TEST(VconfImplTest, registerKeyChangedCb_int_lambda)
 {
        int v = 0;
        int count = 0;
-       auto h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v = x;
                count++;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 133);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 133);
        });
        EXPECT_EQ(v, 133);
        EXPECT_EQ(count, 1);
@@ -127,16 +127,16 @@ TEST(VconfImplTest, registerKeyChangedCb_bool_lambda)
 {
        bool v = false;
        int count = 0;
-       auto h = VConfSingleton::instance().registerKeyChangedCb<bool>("VconfImplTest/int/20", [&](bool x) {
+       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<bool>("VconfImplTest/int/20", [&](bool x) {
                v = x;
                count++;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", true);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", true);
        });
        EXPECT_EQ(v, true);
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", false);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", false);
        });
        EXPECT_EQ(v, false);
        EXPECT_EQ(count, 2);
@@ -145,11 +145,11 @@ TEST(VconfImplTest, registerKeyChangedCb_bool_lambda)
 TEST(VconfImplTest, registerKeyChangedCb_double_lambda)
 {
        double v = 0.0;
-       auto h = VConfSingleton::instance().registerKeyChangedCb<double>("VconfImplTest/int/20", [&](double x) {
+       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<double>("VconfImplTest/int/20", [&](double x) {
                v = x;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 13.6);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 13.6);
        });
        EXPECT_EQ(v, 13.6);
 }
@@ -157,11 +157,11 @@ TEST(VconfImplTest, registerKeyChangedCb_double_lambda)
 TEST(VconfImplTest, registerKeyChangedCb_string_lambda)
 {
        std::string v;
-       auto h = VConfSingleton::instance().registerKeyChangedCb<std::string>("VconfImplTest/int/20", [&](std::string x) {
+       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<std::string>("VconfImplTest/int/20", [&](std::string x) {
                v = x;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", std::string("foo2"));
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", std::string("foo2"));
        });
        EXPECT_EQ(v, "foo2");
 }
@@ -172,21 +172,21 @@ TEST(VconfImplTest, registerKeyChangedCb_int_unregister)
        int v = 0;
        int count = 0;
        {
-               auto h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+               auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                        v = x;
                        count++;
                });
                eventLoop::run([]() {
-                       VConfSingleton::instance().set("VconfImplTest/int/20", 1);
+                       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 1);
                });
                EXPECT_EQ(v, 1);
                eventLoop::run([]() {
-                       VConfSingleton::instance().set("VconfImplTest/int/20", 2);
+                       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 2);
                });
                EXPECT_EQ(v, 2);
        }
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 3);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 3);
        });
        EXPECT_EQ(v, 2);
        EXPECT_EQ(count, 2);
@@ -198,21 +198,21 @@ TEST(VconfImplTest, registerKeyChangedCb_int_unregister_2x)
        {
                int v = 0;
                {
-                       auto h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+                       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                                v = x;
                                count++;
                        });
                        eventLoop::run([]() {
-                               VConfSingleton::instance().set("VconfImplTest/int/20", 11);
+                               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 11);
                        });
                        EXPECT_EQ(v, 11);
                        eventLoop::run([]() {
-                               VConfSingleton::instance().set("VconfImplTest/int/20", 12);
+                               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 12);
                        });
                        EXPECT_EQ(v, 12);
                }
                eventLoop::run([]() {
-                       VConfSingleton::instance().set("VconfImplTest/int/20", 13);
+                       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 13);
                });
                EXPECT_EQ(v, 12);
        }
@@ -220,21 +220,21 @@ TEST(VconfImplTest, registerKeyChangedCb_int_unregister_2x)
        {
                int v = 0;
                {
-                       auto h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+                       auto h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                                v = x;
                                count++;
                        });
                        eventLoop::run([]() {
-                               VConfSingleton::instance().set("VconfImplTest/int/20", 21);
+                               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 21);
                        });
                        EXPECT_EQ(v, 21);
                        eventLoop::run([]() {
-                               VConfSingleton::instance().set("VconfImplTest/int/20", 22);
+                               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 22);
                        });
                        EXPECT_EQ(v, 22);
                }
                eventLoop::run([]() {
-                       VConfSingleton::instance().set("VconfImplTest/int/20", 23);
+                       Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 23);
                });
                EXPECT_EQ(v, 22);
        }
@@ -251,25 +251,25 @@ TEST(VconfImplTest, registerKeyChangedCb_all)
        std::string s("empty");
        int count1 = 0, count2 = 0, count3 = 0, count4 = 0;
 
-       auto h1 = VConfSingleton::instance().registerKeyChangedCb<bool>("VconfImplTest/int/20", [&](bool x) {
+       auto h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<bool>("VconfImplTest/int/20", [&](bool x) {
                b = x;
                count1++;
        });
-       auto h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       auto h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                i = x;
                count2++;
        });
-       auto h3 = VConfSingleton::instance().registerKeyChangedCb<double>("VconfImplTest/int/20", [&](double x) {
+       auto h3 = Singleton<VConfInterface>::instance().registerKeyChangedCb<double>("VconfImplTest/int/20", [&](double x) {
                v = x;
                count3++;
        });
-       auto h4 = VConfSingleton::instance().registerKeyChangedCb<std::string>("VconfImplTest/int/20", [&](std::string x) {
+       auto h4 = Singleton<VConfInterface>::instance().registerKeyChangedCb<std::string>("VconfImplTest/int/20", [&](std::string x) {
                s = x;
                count4++;
        });
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 10);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 10);
        });
        EXPECT_EQ(i, 10);
        EXPECT_EQ(b, false);
@@ -277,7 +277,7 @@ TEST(VconfImplTest, registerKeyChangedCb_all)
        EXPECT_EQ(s, "empty");
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 20.2);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 20.2);
        });
        EXPECT_EQ(i, 10);
        EXPECT_EQ(b, false);
@@ -285,7 +285,7 @@ TEST(VconfImplTest, registerKeyChangedCb_all)
        EXPECT_EQ(s, "empty");
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", true);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", true);
        });
        EXPECT_EQ(i, 10);
        EXPECT_EQ(b, true);
@@ -293,7 +293,7 @@ TEST(VconfImplTest, registerKeyChangedCb_all)
        EXPECT_EQ(s, "empty");
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", std::string("foo"));
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", std::string("foo"));
        });
        EXPECT_EQ(i, 10);
        EXPECT_EQ(b, true);
@@ -312,13 +312,13 @@ TEST(VconfImplTest, registerKeyChangedCb_unregisterInCallback)
        int v = 0;
        int count = 0;
        VConfInterface::CallbackHandle h;
-       h = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v = x;
                count++;
                h.reset();
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 13);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 13);
        });
        EXPECT_EQ(v, 13);
        EXPECT_EQ(count, 1);
@@ -330,21 +330,21 @@ TEST(VconfImplTest, registerKeyChangedCb_unregisterSecondInCallback)
        int v1 = 1, v2 = 2, v3 = 3;
        int count1 = 0, count2 = 0, count3 = 0;
        VConfInterface::CallbackHandle h1, h2, h3;
-       h1 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v1 = x;
                count1++;
        });
-       h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v2 = x;
                count2++;
        });
-       h3 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h3 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v3 = x;
                h2.reset();
                count3++;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 14);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 14);
        });
        EXPECT_EQ(v1, 14);
        EXPECT_EQ(v2, 2);
@@ -364,17 +364,17 @@ TEST(VconfImplTest, registerKeyChangedCb_registerInCallback)
        int count1 = 0, count2 = 0;
 
        VConfInterface::CallbackHandle h1, h2;
-       h1 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v1 = x;
                count1++;
-               h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+               h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                        v2 = x;
                        count2++;
                });
        });
        EXPECT_EQ(h2, nullptr);
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 15);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 15);
        });
        EXPECT_EQ(v1, 15);
        EXPECT_EQ(v2, 2);
@@ -383,7 +383,7 @@ TEST(VconfImplTest, registerKeyChangedCb_registerInCallback)
        EXPECT_EQ(count2, 0);
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 16);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 16);
        });
 
        EXPECT_EQ(v1, 16);
@@ -397,18 +397,18 @@ TEST(VconfImplTest, registerKeyChangedCb_unregisterAndRegisterInCallback)
        int v1 = 1, v2 = 2;
        int count1 = 0, count2 = 0;
        VConfInterface::CallbackHandle h1, h2;
-       h1 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v1 = x;
                count1++;
                h1.reset();
-               h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+               h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                        v2 = x;
                        count2++;
                });
        });
        EXPECT_EQ(h2, nullptr);
        eventLoop::run([&]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 115);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 115);
        });
        EXPECT_NE(h2, nullptr);
        EXPECT_EQ(v1, 115);
@@ -416,7 +416,7 @@ TEST(VconfImplTest, registerKeyChangedCb_unregisterAndRegisterInCallback)
        EXPECT_EQ(count1, 1);
        EXPECT_EQ(count2, 0);
        eventLoop::run([&]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 116);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 116);
        });
        EXPECT_EQ(v1, 115);
        EXPECT_EQ(v2, 116);
@@ -424,7 +424,7 @@ TEST(VconfImplTest, registerKeyChangedCb_unregisterAndRegisterInCallback)
        EXPECT_EQ(count2, 1);
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 117);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 117);
        });
 
        EXPECT_EQ(v1, 115);
@@ -438,10 +438,10 @@ TEST(VconfImplTest, registerKeyChangedCb_registerAndUnregisterInCallback)
        int v1 = 1, v2 = 2;
        int count1 = 0, count2 = 0;
        VConfInterface::CallbackHandle h1, h2;
-       h1 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v1 = x;
                count1++;
-               h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+               h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                        v2 = x;
                        count2++;
                });
@@ -449,7 +449,7 @@ TEST(VconfImplTest, registerKeyChangedCb_registerAndUnregisterInCallback)
        });
        EXPECT_EQ(h2, nullptr);
        eventLoop::run([&]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 115);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 115);
        });
        EXPECT_NE(h2, nullptr);
        EXPECT_EQ(v1, 115);
@@ -457,7 +457,7 @@ TEST(VconfImplTest, registerKeyChangedCb_registerAndUnregisterInCallback)
        EXPECT_EQ(count1, 1);
        EXPECT_EQ(count2, 0);
        eventLoop::run([&]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 116);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 116);
        });
        EXPECT_EQ(v1, 115);
        EXPECT_EQ(v2, 116);
@@ -465,7 +465,7 @@ TEST(VconfImplTest, registerKeyChangedCb_registerAndUnregisterInCallback)
        EXPECT_EQ(count2, 1);
 
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 117);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 117);
        });
 
        EXPECT_EQ(v1, 115);
@@ -480,23 +480,23 @@ TEST(VconfImplTest, registerKeyChangedCb_callbackOrder)
        int v = 1;
        int count1 = 0, count2 = 0, count3 = 0;
        VConfInterface::CallbackHandle h1, h2, h3;
-       h1 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h1 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v += 2;
                v *= 3;
                count1++;
        });
-       h2 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h2 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v += 5;
                v *= 7;
                count2++;
        });
-       h3 = VConfSingleton::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
+       h3 = Singleton<VConfInterface>::instance().registerKeyChangedCb<int>("VconfImplTest/int/20", [&](int x) {
                v += 11;
                v *= 13;
                count3++;
        });
        eventLoop::run([]() {
-               VConfSingleton::instance().set("VconfImplTest/int/20", 14);
+               Singleton<VConfInterface>::instance().set("VconfImplTest/int/20", 14);
        });
        EXPECT_EQ(v, (((((1 + 11) * 13) + 5) * 7) + 2) * 3); //calbacks are called in reverse order
        EXPECT_EQ(count1, 1);