revise vconf plugin test
authorYoungjae Shin <yj99.shin@samsung.com>
Thu, 11 Jun 2020 06:17:39 +0000 (15:17 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 15 Jun 2020 07:25:18 +0000 (16:25 +0900)
Change-Id: I7c005a8b54f4ea78da7ca6e5d1da0328fce46364

include/plugin-log.h
tests/CMakeLists.txt
tests/mdsp_test_vconf.cpp
tests/mode/tizen_Power-Save_mode.xml
vconf/VconfFactory.cpp

index 648301e..9e637b3 100644 (file)
 #define MDS_LOG_BLUE "\033[34m"
 #define MDS_LOG_END "\033[0m"
 
-#undef __DBG
-#undef __INFO
-#undef __WARN
-#undef __ERR
-
 #undef _DBG
 #undef _INFO
 #undef _WARN
 #include <stdio.h>
 #include <string.h>
 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-#define __DBG(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
-#define __INFO(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
-#define __WARN(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
-#define __ERR(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
+#define _DBG(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
+#define _INFO(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
+#define _WARN(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
+#define _ERR(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
 #else
 #define LOG_TAG "MODES"
 #include <dlog.h>
-#define __DBG(fmt, arg...) SLOGD(fmt, ##arg)
-#define __INFO(fmt, arg...) SLOGI(fmt, ##arg)
-#define __WARN(fmt, arg...) SLOGW(fmt, ##arg)
-#define __ERR(fmt, arg...) SLOGE(fmt, ##arg)
+#define _DBG(fmt, arg...) SLOGD(fmt, ##arg)
+#define _INFO(fmt, arg...) SLOGI(fmt, ##arg)
+#define _WARN(fmt, arg...) SLOGW(fmt, ##arg)
+#define _ERR(fmt, arg...) SLOGE(fmt, ##arg)
+#define SECURE_DBG(fmt, arg...) SECURE_SLOGI(fmt, ##arg)
+#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
 #endif /* MDS_STDOUT */
 
-
 #ifdef MDS_PLUGIN
-#define _DBG(fmt, arg...) __DBG(MDS_LOG_BROWN "<Plugin>" MDS_LOG_END fmt, ##arg)
-#define _INFO(fmt, arg...) __INFO(MDS_LOG_BLUE "<Plugin>" MDS_LOG_END fmt, ##arg)
-#define _WARN(fmt, arg...) __WARN(MDS_LOG_GREEN "<Plugin>" MDS_LOG_END fmt, ##arg)
-#define _ERR(fmt, arg...) __ERR(MDS_LOG_RED "<Plugin>" MDS_LOG_END fmt, ##arg)
+#define DBG(fmt, arg...) _DBG(MDS_LOG_BROWN "<Plugin>" MDS_LOG_END fmt, ##arg)
+#define INFO(fmt, arg...) _INFO(MDS_LOG_BLUE "<Plugin>" MDS_LOG_END fmt, ##arg)
+#define WARN(fmt, arg...) _WARN(MDS_LOG_GREEN "<Plugin>" MDS_LOG_END fmt, ##arg)
+#define ERR(fmt, arg...) _ERR(MDS_LOG_RED "<Plugin>" MDS_LOG_END fmt, ##arg)
 #elif defined(MDS_TEST)
-#define _DBG(fmt, arg...) __DBG(MDS_LOG_BROWN "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
-#define _INFO(fmt, arg...) __INFO(MDS_LOG_BLUE "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
-#define _WARN(fmt, arg...) __WARN(MDS_LOG_GREEN "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
-#define _ERR(fmt, arg...) __ERR(MDS_LOG_RED "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
+#define DBG(fmt, arg...) _DBG(MDS_LOG_BROWN "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
+#define INFO(fmt, arg...) _INFO(MDS_LOG_BLUE "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
+#define WARN(fmt, arg...) _WARN(MDS_LOG_GREEN "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
+#define ERR(fmt, arg...) _ERR(MDS_LOG_RED "<Plugin-Test>" MDS_LOG_END fmt, ##arg)
 #else
-#define _DBG(fmt, arg...) __DBG(fmt, ##arg)
-#define _INFO(fmt, arg...) __INFO(fmt, ##arg)
-#define _WARN(fmt, arg...) __WARN(fmt, ##arg)
-#define _ERR(fmt, arg...) __ERR(fmt, ##arg)
-#endif /* MDS_PLUGIN */
-
-#define MDS_DEBUGGING
-
-#ifdef MDS_DEBUGGING
-#define API_CALL _DBG(">>>>>>>> API called")
-#define API_END _DBG(">>>>>>>> API ended")
-#define FN_CALL _DBG(">>>>>>>> called")
-#define FN_END _DBG("<<<<<<<< ended")
 #define DBG(fmt, arg...) _DBG(fmt, ##arg)
+#define INFO(fmt, arg...) _INFO(fmt, ##arg)
 #define WARN(fmt, arg...) _WARN(fmt, ##arg)
 #define ERR(fmt, arg...) _ERR(fmt, ##arg)
-#define INFO(fmt, arg...) _INFO(fmt, ##arg)
-#define SECURE_DBG(fmt, arg...) SECURE_SLOGI(fmt, ##arg)
-#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
-
-#else /* MDS_DEBUGGING */
-#define API_CALL
-#define API_END
-#define FN_CALL
-#define FN_END
-#define DBG(fmt, arg...)
-#define WARN(fmt, arg...)
-#define ERR(fmt, arg...)
-#define INFO(fmt, arg...)
-#define SECURE_DBG(fmt, arg...)
-#define SECURE_ERR(fmt, arg...)
-
-#endif /* MDS_DEBUGGING */
+#endif /* MDS_PLUGIN */
 
 #define RET_IF(expr) \
        do { \
index 5c24640..1c1bf07 100644 (file)
@@ -60,11 +60,14 @@ ADD_EXECUTABLE(${STD_PLUGIN_TEST} mdsp_test_std.cpp)
 TARGET_LINK_LIBRARIES(${STD_PLUGIN_TEST} ${test_pkgs_LIBRARIES} ${STD_PLUGIN})
 INSTALL(TARGETS ${STD_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
 #===================================================================#
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/vconf)
+SET(VCONF_SRC_DIR "${CMAKE_SOURCE_DIR}/vconf" )
 SET(VCONF_PLUGIN_TEST "modes-plugintest-vconf")
+#It is for actionMap of VconfFactory
+FILE(GLOB VCONF_SRCS ${VCONF_SRC_DIR}/*.cpp)
+SET(VCONF_SRCS ${VCONF_SRCS} "mdsp_test_vconf.cpp")
 
-ADD_EXECUTABLE(${VCONF_PLUGIN_TEST} mdsp_test_vconf.cpp)
-TARGET_LINK_LIBRARIES(${VCONF_PLUGIN_TEST} ${test_pkgs_LIBRARIES} ${VCONF_PLUGIN})
+ADD_EXECUTABLE(${VCONF_PLUGIN_TEST} ${VCONF_SRCS})
+TARGET_LINK_LIBRARIES(${VCONF_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
 INSTALL(TARGETS ${VCONF_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
 #===================================================================#
 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/wifi)
index 13fc138..07c030e 100644 (file)
@@ -58,6 +58,7 @@ protected:
        static void callback1(void *userData)
        {
                PluginAction *action = (PluginAction*)userData;
+               ASSERT_TRUE(nullptr != action);
                DBG("%s changed callback called!", action->getKey().c_str());
 
                //In practice, it is handled by Action. refer to Action.cpp
@@ -98,6 +99,8 @@ TEST_F(VconfPluginTest, VconfInt)
        const char *key = "db.setting.psmode";
 
        PluginAction *action = plugin->newAction(key);;
+       ASSERT_TRUE(nullptr != action);
+
        ret = action->set(0);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
@@ -114,7 +117,9 @@ TEST_F(VconfPluginTest, VconfDouble)
        int ret;
        const char *key = "db.system.timechange_external";
 
-       PluginAction *action = plugin->newAction(key);;
+       PluginAction *action = plugin->newAction(key);
+       ASSERT_TRUE(nullptr != action);
+
        ret = action->set(0.0);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
@@ -129,9 +134,11 @@ TEST_F(VconfPluginTest, VconfDouble)
 TEST_F(VconfPluginTest, VconfBool)
 {
        int ret;
-       const char *key = "db.setting.sound.button_sounds";
+       const char *key = "db.setting.sound.sound_on";
 
        PluginAction *action = plugin->newAction(key);;
+       ASSERT_TRUE(nullptr != action);
+
        ret = action->set(true);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
@@ -151,6 +158,8 @@ TEST_F(VconfPluginTest, VconfStr)
        const std::string tmpName = "ModesTest";
 
        PluginAction *action = plugin->newAction(key);
+       ASSERT_TRUE(nullptr != action);
+
        ret = action->set(devName);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
@@ -170,6 +179,8 @@ TEST_F(VconfPluginTest, callbackPluginVconf)
        EXPECT_EQ(ret, 0);
 
        PluginAction *action = plugin->newAction(key);
+       ASSERT_TRUE(nullptr != action);
+
        ret = action->set(0);
        EXPECT_EQ(ret, MODES_ERROR_NONE);
 
index 6e47222..63e56f3 100644 (file)
@@ -8,7 +8,6 @@
     <action rule="vconf.db.setting.sound.sound_on" restrict="lock">0</action>
     <action rule="vconf.db.setting.sound.vibration_on" restrict="lock">0</action>
     <action rule="vconf.db.location.setting.Usemylocation" restrict="lock">0</action>
-    <action rule="vconf.db.setting.menuscreen.package_name" restrict="lock">org.tizen.menu-screen</action>
     <undo rule="vconf.db.setting.menuscreen.package_name" restrict="lock">org.tizen.homescreen-efl</undo>
   </mode>
 </tizenModes>
index f3466cd..15fc497 100644 (file)
@@ -39,7 +39,6 @@ VconfFactory::VconfFactory()
        actionMap["db.setting.menuscreen.package_name"] = &newVconf<VconfStr>;
 #ifdef MDS_TEST
        actionMap["db.system.timechange_external"] = &newVconf<VconfDbl>;
-       actionMap["db.setting.sound.button_sounds"] = &newVconf<VconfBool>;
        actionMap["db.setting.device_name"] = &newVconf<VconfStr>;
 #endif
 }