change unit tests folder name
authorYoungjae Shin <yj99.shin@samsung.com>
Mon, 11 May 2020 05:46:40 +0000 (14:46 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 11 May 2020 09:22:14 +0000 (18:22 +0900)
from unittests to tests

37 files changed:
CMakeLists.txt
tests/CMakeLists.txt [new file with mode: 0644]
tests/mdsp_test_app.cpp [new file with mode: 0644]
tests/mdsp_test_bt.cpp [new file with mode: 0644]
tests/mdsp_test_display.cpp [new file with mode: 0644]
tests/mdsp_test_integration.cpp [new file with mode: 0644]
tests/mdsp_test_media.cpp [new file with mode: 0644]
tests/mdsp_test_pkg.cpp [new file with mode: 0644]
tests/mdsp_test_vconf.cpp [new file with mode: 0644]
tests/mdsp_test_wifi.cpp [new file with mode: 0644]
tests/mode/tizen_Power-Save_mode.xml [new file with mode: 0644]
tests/mode/tizen_Quick-Panel_mode.xml [new file with mode: 0644]
tests/mode/tizen_Water-Lock_mode.xml [new file with mode: 0644]
tests/mode/tizen_appLaunch_mode.xml [new file with mode: 0644]
tests/mode/tizen_btAudioConnect_mode.xml [new file with mode: 0644]
tests/mode/tizen_btOff_mode.xml [new file with mode: 0644]
tests/mode/tizen_btOn_mode.xml [new file with mode: 0644]
tests/mode/tizen_displayBlock_mode.xml [new file with mode: 0644]
tests/mode/tizen_wifi-on_mode.xml [new file with mode: 0644]
unittests/CMakeLists.txt [deleted file]
unittests/mdsp_test_app.cpp [deleted file]
unittests/mdsp_test_bt.cpp [deleted file]
unittests/mdsp_test_display.cpp [deleted file]
unittests/mdsp_test_integration.cpp [deleted file]
unittests/mdsp_test_media.cpp [deleted file]
unittests/mdsp_test_pkg.cpp [deleted file]
unittests/mdsp_test_vconf.cpp [deleted file]
unittests/mdsp_test_wifi.cpp [deleted file]
unittests/mode/tizen_Power-Save_mode.xml [deleted file]
unittests/mode/tizen_Quick-Panel_mode.xml [deleted file]
unittests/mode/tizen_Water-Lock_mode.xml [deleted file]
unittests/mode/tizen_appLaunch_mode.xml [deleted file]
unittests/mode/tizen_btAudioConnect_mode.xml [deleted file]
unittests/mode/tizen_btOff_mode.xml [deleted file]
unittests/mode/tizen_btOn_mode.xml [deleted file]
unittests/mode/tizen_displayBlock_mode.xml [deleted file]
unittests/mode/tizen_wifi-on_mode.xml [deleted file]

index fd4247e5b1ffbde59cb509b0f81e0e1920715883..b494da55036c6cce16136b6e33c90de46a1a1d95 100644 (file)
@@ -22,4 +22,4 @@ ADD_SUBDIRECTORY(pkg)
 ADD_SUBDIRECTORY(bluetooth)
 ADD_SUBDIRECTORY(media)
 ADD_SUBDIRECTORY(display)
-ADD_SUBDIRECTORY(unittests)
+ADD_SUBDIRECTORY(tests)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..65d9a7f
--- /dev/null
@@ -0,0 +1,83 @@
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
+ADD_DEFINITIONS("-DMDS_TEST")
+ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT")
+
+PKG_CHECK_MODULES(test_pkgs REQUIRED modes dlog gmock capi-network-wifi-manager capi-network-bluetooth vconf
+       capi-appfw-application capi-appfw-app-manager aul
+       capi-media-sound-manager capi-media-player
+       pkgmgr pkgmgr-info capi-system-device
+       evas elementary ecore ecore-wl2 capi-ui-efl-util)
+INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
+
+SET(INTEGRATION_TEST "modes-plugintest-mode")
+SET(INTEGRATION_SRCS "mdsp_test_integration.cpp")
+ADD_EXECUTABLE(${INTEGRATION_TEST} ${INTEGRATION_SRCS})
+TARGET_LINK_LIBRARIES(${INTEGRATION_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${INTEGRATION_TEST} DESTINATION ${TEST_INSTALL_DIR})
+FILE(GLOB MODE_EX mode/*.xml)
+INSTALL(FILES ${MODE_EX} DESTINATION ${MODES_MODE_DEFAULT_DIR})
+#===================================================================#
+SET(WIFI_SRC_DIR "${CMAKE_SOURCE_DIR}/wifi" )
+SET(WIFI_PLUGIN_TEST "modes-plugintest-wifi")
+FILE(GLOB WIFI_SRCS ${WIFI_SRC_DIR}/*.cpp)
+SET(WIFI_SRCS ${WIFI_SRCS} "mdsp_test_wifi.cpp")
+
+ADD_EXECUTABLE(${WIFI_PLUGIN_TEST} ${WIFI_SRCS})
+TARGET_LINK_LIBRARIES(${WIFI_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${WIFI_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+#===================================================================#
+SET(BT_SRC_DIR "${CMAKE_SOURCE_DIR}/bluetooth" )
+SET(BT_PLUGIN_TEST "modes-plugintest-bt")
+FILE(GLOB BT_SRCS ${BT_SRC_DIR}/*.cpp)
+SET(BT_SRCS ${BT_SRCS} "mdsp_test_bt.cpp")
+
+ADD_EXECUTABLE(${BT_PLUGIN_TEST} ${BT_SRCS})
+TARGET_LINK_LIBRARIES(${BT_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${BT_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+#===================================================================#
+SET(APP_SRC_DIR "${CMAKE_SOURCE_DIR}/app" )
+SET(APP_PLUGIN_TEST "modes-plugintest-app")
+FILE(GLOB APP_SRCS ${APP_SRC_DIR}/*.cpp)
+SET(APP_SRCS ${APP_SRCS} "mdsp_test_app.cpp")
+
+ADD_EXECUTABLE(${APP_PLUGIN_TEST} ${APP_SRCS})
+TARGET_LINK_LIBRARIES(${APP_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${APP_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+#===================================================================#
+SET(PKG_SRC_DIR "${CMAKE_SOURCE_DIR}/pkg" )
+SET(PKG_PLUGIN_TEST "modes-plugintest-pkg")
+FILE(GLOB PKG_SRCS ${PKG_SRC_DIR}/*.cpp)
+SET(PKG_SRCS ${PKG_SRCS} "mdsp_test_pkg.cpp")
+
+ADD_EXECUTABLE(${PKG_PLUGIN_TEST} ${PKG_SRCS})
+TARGET_LINK_LIBRARIES(${PKG_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${PKG_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+#===================================================================#
+SET(VCONF_SRC_DIR "${CMAKE_SOURCE_DIR}/vconf" )
+SET(VCONF_PLUGIN_TEST "modes-plugintest-vconf")
+FILE(GLOB VCONF_SRCS ${VCONF_SRC_DIR}/*.cpp)
+SET(VCONF_SRCS ${VCONF_SRCS} "mdsp_test_vconf.cpp")
+
+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})
+#===================================================================#
+SET(MEDIA_SRC_DIR "${CMAKE_SOURCE_DIR}/media" )
+SET(MEDIA_PLUGIN_TEST "modes-plugintest-media")
+FILE(GLOB MEDIA_SRCS ${MEDIA_SRC_DIR}/*.cpp)
+SET(MEDIA_SRCS ${MEDIA_SRCS} "mdsp_test_media.cpp")
+
+ADD_EXECUTABLE(${MEDIA_PLUGIN_TEST} ${MEDIA_SRCS})
+TARGET_LINK_LIBRARIES(${MEDIA_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${MEDIA_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+#===================================================================#
+SET(DISPLAY_SRC_DIR "${CMAKE_SOURCE_DIR}/display" )
+SET(DISPLAY_PLUGIN_TEST "modes-plugintest-display")
+FILE(GLOB DISPLAY_SRCS ${DISPLAY_SRC_DIR}/*.cpp)
+SET(DISPLAY_SRCS ${DISPLAY_SRCS} "mdsp_test_display.cpp")
+
+ADD_EXECUTABLE(${DISPLAY_PLUGIN_TEST} ${DISPLAY_SRCS})
+TARGET_LINK_LIBRARIES(${DISPLAY_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${DISPLAY_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
diff --git a/tests/mdsp_test_app.cpp b/tests/mdsp_test_app.cpp
new file mode 100644 (file)
index 0000000..e25e87a
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <iostream>
+#include <string>
+
+#include <gtest/gtest.h>
+#include <glib.h>
+#include <aul.h>
+#include <Plugin.h>
+#include <app_manager.h>
+#include <app_manager_extension.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class AppPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+               plugin = objectCreate();
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+               objectDelete(plugin);
+               plugin = nullptr;
+       }
+
+       static gboolean appUndoTimeout(gpointer data)
+       {
+               PluginAction *action = (PluginAction*)data;
+               action->undo();
+               g_main_loop_quit(loop);
+               plugin->deleteAction(action);
+
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean checkSetUndoIdler(gpointer data)
+       {
+               PluginAction *action = plugin->newAction("launch");
+               EXPECT_FALSE(action->IsCurrentValue(std::string(testApp)));
+               result = action->set(std::string(testApp));
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               if (MODES_ERROR_NONE == result) {
+                       g_timeout_add(1000, appUndoTimeout, action);
+               } else {
+                       g_main_loop_quit(loop);
+                       plugin->deleteAction(action);
+               }
+               return G_SOURCE_REMOVE;
+       }
+
+       static void changedCB(void *userData)
+       {
+               PluginAction *action = (PluginAction*)userData;
+
+               cbCalled = true;
+               std::cout << ">>>>>>>> changedCB: Terminated <<<<<<<<" << std::endl;
+               appUndoTimeout(action);
+       }
+
+       static gboolean checkChangedCBIdler(gpointer data)
+       {
+               sleep(1);
+               PluginAction *action = plugin->newAction("launch");
+               EXPECT_FALSE(action->IsCurrentValue(std::string(testApp)));
+               result = action->set(std::string(testApp));
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               if (MODES_ERROR_NONE == result) {
+                       int ret = action->setChangedCallback(changedCB, action);
+                       EXPECT_EQ(MODES_ERROR_NONE, ret);
+                       g_timeout_add(20000, appUndoTimeout, action); //For running continue
+               } else {
+                       g_main_loop_quit(loop);
+                       plugin->deleteAction(action);
+               }
+
+               sleep(1);
+               app_context_h runAppContext = NULL;
+               int ret = app_manager_get_app_context(testApp, &runAppContext);
+               if (APP_MANAGER_ERROR_NONE != ret)
+                       std::cout << testApp << " get_app_context() Fail:" << ret << std::endl;
+               else
+                       app_manager_terminate_app(runAppContext);
+
+               return G_SOURCE_REMOVE;
+       }
+
+       static const char *testApp;
+       static int result;
+       static bool cbCalled;
+       static GMainLoop *loop;
+       static GThread *my_thread;
+       static Plugin *plugin;
+};
+
+const char *AppPluginTest::testApp = "org.tizen.setting";
+int AppPluginTest::result = 0;
+bool AppPluginTest::cbCalled = false;
+Plugin *AppPluginTest::plugin = nullptr;
+GMainLoop *AppPluginTest::loop = NULL;
+
+TEST_F(AppPluginTest, CheckSetUndo)
+{
+       g_idle_add(checkSetUndoIdler, plugin);
+       g_main_loop_run(loop);
+}
+
+TEST_F(AppPluginTest, checkChangedCB)
+{
+       cbCalled = false;
+       g_idle_add(checkChangedCBIdler, NULL);
+       g_main_loop_run(loop);
+       //TODO: at posttrans of unittest, changedCB is not called
+       //EXPECT_EQ(cbCalled, true);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_bt.cpp b/tests/mdsp_test_bt.cpp
new file mode 100644 (file)
index 0000000..4fc5d24
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <string>
+#include <gtest/gtest.h>
+#include <modes.h>
+#include <Plugin.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class BtPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               plugin = objectCreate();
+               loop = g_main_loop_new(NULL, FALSE);
+               handle = modes_connect();
+       }
+
+       void TearDown() override
+       {
+               objectDelete(plugin);
+               plugin = nullptr;
+               g_main_loop_unref(loop);
+               loop = NULL;
+               modes_disconnect(handle);
+               handle = NULL;
+       }
+
+       static gboolean apply_mode_idler(gpointer data)
+       {
+               result = modes_apply_mode(handle, (const char*)data);
+
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean undo_mode_idler(gpointer data)
+       {
+               result = modes_apply_mode(handle, (const char*)data);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               sleep(5);
+               result = modes_undo_mode(handle, (const char*)data);
+
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static modes_h handle;
+       static int result;
+       static GMainLoop *loop;
+       Plugin *plugin;
+};
+
+int BtPluginTest::result = 0;
+GMainLoop *BtPluginTest::loop = NULL;
+modes_h BtPluginTest::handle = NULL;
+
+TEST_F(BtPluginTest, undoModebtOff)
+{
+       g_idle_add(undo_mode_idler, (gpointer)"btOff");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(BtPluginTest, undoModebtOn)
+{
+       g_idle_add(undo_mode_idler, (gpointer)"btOn");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+// btAudioConnect does not support undo mode
+TEST_F(BtPluginTest, btAudioConnect)
+{
+       g_idle_add(apply_mode_idler, (gpointer)"btAudioConnect");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(BtPluginTest, btTest)
+{
+       int ret;
+
+       ASSERT_TRUE(nullptr != plugin);
+
+       PluginAction *action = plugin->newAction("power");
+       ret = action->set(false);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       sleep(3);//for avoiding the NOW_IN_PROGRESS error
+
+       ret = action->set(true);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       ret = action->set(std::string("on"));
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+       plugin->deleteAction(action);
+
+       action = plugin->newAction("abcdefg");
+       EXPECT_EQ(action, nullptr);
+}
+
+int main(int argc, char **argv)
+{
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
+
diff --git a/tests/mdsp_test_display.cpp b/tests/mdsp_test_display.cpp
new file mode 100644 (file)
index 0000000..c038d5a
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by displaylicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <gtest/gtest.h>
+#include <Plugin.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class displayPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+               plugin = objectCreate();
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+               objectDelete(plugin);
+               plugin = nullptr;
+       }
+
+       static gboolean displayPluginBrightnessIdler(gpointer data)
+       {
+               PluginAction *action = plugin->newAction("brightness");
+               int value = 100;
+               if (action->IsCurrentValue(value))
+                       value--;
+               result = action->set(value);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               action->undo();
+
+               plugin->deleteAction(action);
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean displayPluginDenyPalmTouchIdler(gpointer data)
+       {
+               PluginAction *action = plugin->newAction("denyPalmTouch");
+               EXPECT_FALSE(action->IsCurrentValue(true));
+               result = action->set(true);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               action->undo();
+
+               plugin->deleteAction(action);
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean displayPluginAlwaysOnIdler(gpointer data)
+       {
+               PluginAction *action = plugin->newAction("timeout");
+               EXPECT_FALSE(action->IsCurrentValue(0));
+               result = action->set(0);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               action->undo();
+
+               plugin->deleteAction(action);
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean displayPluginAutoBrightnessIdler(gpointer data)
+       {
+               PluginAction *action = plugin->newAction("autoBrightness");
+               EXPECT_FALSE(action->IsCurrentValue(1));
+               result = action->set(1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               action->undo();
+
+               result = action->set(2);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               plugin->deleteAction(action);
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+       static int result;
+       static GMainLoop *loop;
+       static Plugin *plugin;
+};
+
+int displayPluginTest::result = 0;
+Plugin *displayPluginTest::plugin = nullptr;
+GMainLoop *displayPluginTest::loop = NULL;
+
+TEST_F(displayPluginTest, setBrightness)
+{
+       g_idle_add(displayPluginBrightnessIdler, plugin);
+       g_main_loop_run(loop);
+}
+
+TEST_F(displayPluginTest, setAutoBrightness)
+{
+       g_idle_add(displayPluginAutoBrightnessIdler, plugin);
+       g_main_loop_run(loop);
+}
+
+TEST_F(displayPluginTest, setAlwaysOn)
+{
+       g_idle_add(displayPluginAlwaysOnIdler, plugin);
+       g_main_loop_run(loop);
+}
+
+TEST_F(displayPluginTest, setDenyPalmTouch)
+{
+       g_idle_add(displayPluginDenyPalmTouchIdler, plugin);
+       g_main_loop_run(loop);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_integration.cpp b/tests/mdsp_test_integration.cpp
new file mode 100644 (file)
index 0000000..825ad59
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <gtest/gtest.h>
+#include <modes.h>
+
+class IntegrationTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+               handle = modes_connect();
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+               modes_disconnect(handle);
+               handle = NULL;
+       }
+
+       static gboolean check_mode_idler(gpointer data)
+       {
+               modes_undo_mode(handle, (const char*)data);
+               result = modes_apply_mode(handle, (const char*)data);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               sleep(2);
+               result = modes_undo_mode(handle, (const char*)data);
+
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static modes_h handle;
+       static int result;
+       static GMainLoop *loop;
+};
+
+int IntegrationTest::result = 0;
+GMainLoop *IntegrationTest::loop = NULL;
+modes_h IntegrationTest::handle = NULL;
+
+TEST_F(IntegrationTest, runMode_btAudioConnect)
+{
+       g_idle_add(check_mode_idler, (gpointer)"btAudioConnect");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_btOff)
+{
+       g_idle_add(check_mode_idler, (gpointer)"btOff");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_btOn)
+{
+       g_idle_add(check_mode_idler, (gpointer)"btOn");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_powerSave)
+{
+       g_idle_add(check_mode_idler, (gpointer)"Power-Save");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_displayBlock)
+{
+       g_idle_add(check_mode_idler, (gpointer)"displayBlock");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_wifiOn)
+{
+       g_idle_add(check_mode_idler, (gpointer)"wifi-on");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+TEST_F(IntegrationTest, runMode_waterlock)
+{
+       g_idle_add(check_mode_idler, (gpointer)"Water-Lock");
+       g_main_loop_run(loop);
+       EXPECT_EQ(MODES_ERROR_NONE, result);
+}
+
+int main(int argc, char **argv)
+{
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_media.cpp b/tests/mdsp_test_media.cpp
new file mode 100644 (file)
index 0000000..8bed4ad
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by medialicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <string>
+#include <gtest/gtest.h>
+#include <Plugin.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class MediaPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+               plugin = objectCreate();
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+               objectDelete(plugin);
+               plugin = nullptr;
+       }
+
+       static gboolean mediaPlaySetUndoTimeout(gpointer data)
+       {
+               PluginAction *action = (PluginAction*)data;
+               action->undo();
+               g_main_loop_quit(loop);
+               return false;
+       }
+
+       static gboolean mediaPlaySetUndoIdler(gpointer data)
+       {
+               PluginAction *action = (PluginAction*)data;
+               const std::string file = "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3";
+               EXPECT_FALSE(action->IsCurrentValue(file));
+               result = action->set(file);
+               if (MODES_ERROR_NONE != result) {
+                       const std::string wearableFile = "/opt/usr/data/settings/Previews/Media_preview_Over_the_horizon_B2.ogg";
+                       EXPECT_FALSE(action->IsCurrentValue(wearableFile));
+                       result = action->set(wearableFile);
+               }
+
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               if (MODES_ERROR_NONE == result)
+                       g_timeout_add(1000, mediaPlaySetUndoTimeout, action);
+               else
+                       g_main_loop_quit(loop);
+
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean VolumeSetUndoIdler(gpointer data)
+       {
+               PluginAction *action;
+               action = plugin->newAction("mediaVolume");
+               EXPECT_FALSE(action->IsCurrentValue(5));
+               result = action->set(5);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("systemVolume");
+               EXPECT_FALSE(action->IsCurrentValue(2));
+               result = action->set(2);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("ringtoneVolume");
+               EXPECT_FALSE(action->IsCurrentValue(9));
+               result = action->set(9);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("notificationVolume");
+               EXPECT_FALSE(action->IsCurrentValue(1));
+               result = action->set(1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("mediaVolume");
+               EXPECT_FALSE(action->IsCurrentValue(-1));
+               result = action->set(-1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("systemVolume");
+               EXPECT_FALSE(action->IsCurrentValue(-1));
+               result = action->set(-1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("ringtoneVolume");
+               EXPECT_FALSE(action->IsCurrentValue(-1));
+               result = action->set(-1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               action = plugin->newAction("notificationVolume");
+               EXPECT_FALSE(action->IsCurrentValue(-1));
+               result = action->set(-1);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               action->undo();
+               plugin->deleteAction(action);
+
+               g_main_loop_quit(loop);
+
+               return G_SOURCE_REMOVE;
+       }
+
+       static int result;
+       static GMainLoop *loop;
+       static Plugin *plugin;
+};
+
+int MediaPluginTest::result = 0;
+Plugin *MediaPluginTest::plugin = nullptr;
+GMainLoop *MediaPluginTest::loop = nullptr;
+
+TEST_F(MediaPluginTest, setUndoMediaPlay)
+{
+       PluginAction *action = plugin->newAction("player");
+       g_idle_add(mediaPlaySetUndoIdler, action);
+       g_main_loop_run(loop);
+       plugin->deleteAction(action);
+}
+
+TEST_F(MediaPluginTest, setUndoMediaVolume)
+{
+       g_idle_add(VolumeSetUndoIdler, NULL);
+       g_main_loop_run(loop);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_pkg.cpp b/tests/mdsp_test_pkg.cpp
new file mode 100644 (file)
index 0000000..936a05b
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <string>
+#include <gtest/gtest.h>
+#include <vconf.h>
+#include <Plugin.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class PkgPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+               plugin = objectCreate();
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+               objectDelete(plugin);
+               plugin = nullptr;
+               vconf_set_str("db/setting/menuscreen/package_name", "org.tizen.homescreen-efl");
+       }
+
+       static gboolean pkgPluginIdler(gpointer data)
+       {
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       static int result;
+       static GMainLoop *loop;
+       Plugin *plugin;
+};
+
+GMainLoop *PkgPluginTest::loop = NULL;
+
+TEST_F(PkgPluginTest, setUndoTest)
+{
+       PluginAction *action = plugin->newAction("supportMode");
+       EXPECT_FALSE(action->IsCurrentValue(1));
+       int ret = action->set(1);
+       EXPECT_EQ(MODES_ERROR_NONE, ret);
+
+       g_idle_add(pkgPluginIdler, plugin);
+       g_main_loop_run(loop);
+
+       action->undo();
+
+       g_idle_add(pkgPluginIdler, plugin);
+       g_main_loop_run(loop);
+       plugin->deleteAction(action);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_vconf.cpp b/tests/mdsp_test_vconf.cpp
new file mode 100644 (file)
index 0000000..13fc138
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <vconf.h>
+#include <gtest/gtest.h>
+#include <Plugin.h>
+#include "plugin-log.h"
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class VconfPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               plugin = objectCreate();
+               loop = g_main_loop_new(NULL, FALSE);
+       }
+
+       void TearDown() override
+       {
+               objectDelete(plugin);
+               g_main_loop_unref(loop);
+               loop = NULL;
+               cb1Called = false;
+               cb2Called = false;
+       }
+
+       static void shouldNotBeCalled(void *userData)
+       {
+               ERR("This Callback(%s) should not be called", (char*)userData);
+               g_main_loop_quit(loop);
+               GTEST_FAIL();
+       }
+
+       static void valChangedCb(void *userData)
+       {
+               DBG("%s changed callback called!", (char*)userData);
+               g_main_loop_quit(loop);
+       }
+
+       static void callback1(void *userData)
+       {
+               PluginAction *action = (PluginAction*)userData;
+               DBG("%s changed callback called!", action->getKey().c_str());
+
+               //In practice, it is handled by Action. refer to Action.cpp
+               action->unSetChangedCallback(callback1);
+
+               cb1Called = true;
+       }
+
+       static void callback2(void *userData)
+       {
+               DBG("%s changed callback called!", (char*)userData);
+               cb2Called = true;
+               g_main_loop_quit(loop);
+       }
+
+       static gboolean changedCallbackidler(gpointer data)
+       {
+               DBG("start change the value db/setting/psmode");
+               vconf_set_int("db/setting/psmode", 7);
+               return G_SOURCE_REMOVE;
+       }
+
+       static GMainLoop *loop;
+       static Plugin *plugin;
+       static bool cb1Called;
+       static bool cb2Called;
+};
+
+bool VconfPluginTest::cb1Called = false;
+bool VconfPluginTest::cb2Called = false;
+Plugin *VconfPluginTest::plugin = nullptr;
+GMainLoop *VconfPluginTest::loop = NULL;
+
+
+TEST_F(VconfPluginTest, VconfInt)
+{
+       int ret;
+       const char *key = "db.setting.psmode";
+
+       PluginAction *action = plugin->newAction(key);;
+       ret = action->set(0);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       EXPECT_FALSE(action->IsCurrentValue(1));
+       ret = action->set(1);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       action->undo();
+       plugin->deleteAction(action);
+}
+
+TEST_F(VconfPluginTest, VconfDouble)
+{
+       int ret;
+       const char *key = "db.system.timechange_external";
+
+       PluginAction *action = plugin->newAction(key);;
+       ret = action->set(0.0);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       EXPECT_FALSE(action->IsCurrentValue(1.0));
+       ret = action->set(1.0);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       action->undo();
+       plugin->deleteAction(action);
+}
+
+TEST_F(VconfPluginTest, VconfBool)
+{
+       int ret;
+       const char *key = "db.setting.sound.button_sounds";
+
+       PluginAction *action = plugin->newAction(key);;
+       ret = action->set(true);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       EXPECT_FALSE(action->IsCurrentValue(false));
+       ret = action->set(false);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       action->undo();
+       plugin->deleteAction(action);
+}
+
+TEST_F(VconfPluginTest, VconfStr)
+{
+       int ret;
+       const char *key = "db.setting.device_name";
+       const std::string devName = "Tizen";
+       const std::string tmpName = "ModesTest";
+
+       PluginAction *action = plugin->newAction(key);
+       ret = action->set(devName);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       EXPECT_FALSE(action->IsCurrentValue(tmpName));
+       ret = action->set(tmpName);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       action->undo();
+       plugin->deleteAction(action);
+}
+
+TEST_F(VconfPluginTest, callbackPluginVconf)
+{
+       int oldVal = 0;
+       const char *key = "db.setting.psmode";
+       int ret = vconf_get_int("db/setting/psmode", &oldVal);
+       EXPECT_EQ(ret, 0);
+
+       PluginAction *action = plugin->newAction(key);
+       ret = action->set(0);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       ret = action->setChangedCallback(valChangedCb, (void*)key);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       g_idle_add(changedCallbackidler, nullptr);
+       g_main_loop_run(loop);
+
+       // It should be removed by the changed callback procedure.
+       action->unSetChangedCallback(valChangedCb);
+
+       ret = action->setChangedCallback(shouldNotBeCalled, (void*)key);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+       action->unSetChangedCallback(shouldNotBeCalled);
+       plugin->deleteAction(action);
+       vconf_set_int("db/setting/psmode", oldVal);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mdsp_test_wifi.cpp b/tests/mdsp_test_wifi.cpp
new file mode 100644 (file)
index 0000000..9605663
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <string>
+#include <gtest/gtest.h>
+#include <Plugin.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" Plugin* objectCreate(void);
+extern "C" void objectDelete(Plugin *plugin);
+
+class WifiPluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               plugin = objectCreate();
+       }
+
+       void TearDown() override
+       {
+               objectDelete(plugin);
+               plugin = nullptr;
+       }
+
+       static gboolean timer(gpointer data)
+       {
+               GMainLoop *loop = (GMainLoop*)data;
+               g_main_loop_quit(loop);
+               return G_SOURCE_REMOVE;
+       }
+
+       Plugin *plugin;
+};
+
+TEST_F(WifiPluginTest, wifiTest)
+{
+       int ret;
+
+       ASSERT_TRUE(nullptr != plugin);
+
+       bool val;
+       PluginAction *action = plugin->newAction("power");
+       val = action->IsCurrentValue(false);
+       ret = action->set(val);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       GMainLoop *loop = g_main_loop_new(NULL, FALSE);
+       g_timeout_add(1000, timer, (gpointer)loop);
+       g_main_loop_run(loop);
+
+       ret = action->set(!val);
+       EXPECT_EQ(ret, MODES_ERROR_NONE);
+
+       ret = action->set(0);
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+
+       ret = action->set(1);
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+
+       ret = action->set(0.0);
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+
+       ret = action->set(1.0);
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+
+       ret = action->set(std::string("off"));
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+
+       ret = action->set(std::string("on"));
+       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
+       plugin->deleteAction(action);
+
+       action = plugin->newAction("abcdefg");
+       EXPECT_EQ(action, nullptr);
+}
+
+int main(int argc, char **argv) {
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mode/tizen_Power-Save_mode.xml b/tests/mode/tizen_Power-Save_mode.xml
new file mode 100644 (file)
index 0000000..6e47222
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="Power-Save" type="normal">
+    <action rule="pkg.supportMode" restrict="lock">ULTRA_POWER_SAVING</action>
+    <action rule="wifi.power" restrict="lock">off</action>
+    <action rule="bluetooth.power" restrict="lock">off</action>
+    <action rule="display.brightness" restrict="lock">30</action>
+    <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>
diff --git a/tests/mode/tizen_Quick-Panel_mode.xml b/tests/mode/tizen_Quick-Panel_mode.xml
new file mode 100644 (file)
index 0000000..0773ef0
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="Quick-Panel" type="normal">
+    <action rule="wifi.power">on</action>
+    <action rule="vconf.db.setting.sound.sound_on">1</action>
+    <action rule="vconf.db.setting.sound.vibration_on">1</action>
+    <action rule="vconf.db.location.setting.Usemylocation">1</action>
+    <action rule="vconf.db.setting.auto_rotate_screen">1</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_Water-Lock_mode.xml b/tests/mode/tizen_Water-Lock_mode.xml
new file mode 100644 (file)
index 0000000..d499433
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="Water-Lock" type="normal">
+    <action rule="vconf.db.setting.sound.sound_on" restrict="lock">false</action>
+    <action rule="vconf.db.setting.sound.vibration_on" restrict="lock">true</action>
+    <undo rule="media.player">/opt/usr/data/settings/Alarms/Alarms_on_call.ogg</undo>
+  </mode>
+</tizenModes>
+
+
diff --git a/tests/mode/tizen_appLaunch_mode.xml b/tests/mode/tizen_appLaunch_mode.xml
new file mode 100644 (file)
index 0000000..f286dac
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="EssentialCheck" type="normal">
+    <action rule="app.launch" restrict="essential">org.tizen.modesupervisor</action>
+    <action rule="wifi.power">off</action>
+    <action rule="bluetooth.power">off</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_btAudioConnect_mode.xml b/tests/mode/tizen_btAudioConnect_mode.xml
new file mode 100644 (file)
index 0000000..6359800
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="btAudioConnect" type="normal">
+    <action rule="bluetooth.power" restrict="lock">on</action>
+    <action rule="bluetooth.audioConnect" restrict="lock">08:AE:D6:5E:AE:16</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_btOff_mode.xml b/tests/mode/tizen_btOff_mode.xml
new file mode 100644 (file)
index 0000000..5d3d3b1
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="btOff" type="normal">
+    <action rule="bluetooth.power" restrict="lock">off</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_btOn_mode.xml b/tests/mode/tizen_btOn_mode.xml
new file mode 100644 (file)
index 0000000..40e64a3
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="btOn" type="normal">
+    <action rule="bluetooth.power" restrict="lock">on</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_displayBlock_mode.xml b/tests/mode/tizen_displayBlock_mode.xml
new file mode 100644 (file)
index 0000000..66a027d
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="displayBlock" type="normal">
+    <action rule="display.timeout" restrict="lock">ALWAYS_ON</action>
+    <action rule="display.denyPalmTouch" restrict="lock">on</action>
+  </mode>
+</tizenModes>
diff --git a/tests/mode/tizen_wifi-on_mode.xml b/tests/mode/tizen_wifi-on_mode.xml
new file mode 100644 (file)
index 0000000..d2aad8d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="wifi-on" type="normal">
+    <action rule="wifi.power">on</action>
+  </mode>
+</tizenModes>
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
deleted file mode 100644 (file)
index 65d9a7f..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
-ADD_DEFINITIONS("-DMDS_TEST")
-ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT")
-
-PKG_CHECK_MODULES(test_pkgs REQUIRED modes dlog gmock capi-network-wifi-manager capi-network-bluetooth vconf
-       capi-appfw-application capi-appfw-app-manager aul
-       capi-media-sound-manager capi-media-player
-       pkgmgr pkgmgr-info capi-system-device
-       evas elementary ecore ecore-wl2 capi-ui-efl-util)
-INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
-
-SET(INTEGRATION_TEST "modes-plugintest-mode")
-SET(INTEGRATION_SRCS "mdsp_test_integration.cpp")
-ADD_EXECUTABLE(${INTEGRATION_TEST} ${INTEGRATION_SRCS})
-TARGET_LINK_LIBRARIES(${INTEGRATION_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${INTEGRATION_TEST} DESTINATION ${TEST_INSTALL_DIR})
-FILE(GLOB MODE_EX mode/*.xml)
-INSTALL(FILES ${MODE_EX} DESTINATION ${MODES_MODE_DEFAULT_DIR})
-#===================================================================#
-SET(WIFI_SRC_DIR "${CMAKE_SOURCE_DIR}/wifi" )
-SET(WIFI_PLUGIN_TEST "modes-plugintest-wifi")
-FILE(GLOB WIFI_SRCS ${WIFI_SRC_DIR}/*.cpp)
-SET(WIFI_SRCS ${WIFI_SRCS} "mdsp_test_wifi.cpp")
-
-ADD_EXECUTABLE(${WIFI_PLUGIN_TEST} ${WIFI_SRCS})
-TARGET_LINK_LIBRARIES(${WIFI_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${WIFI_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
-#===================================================================#
-SET(BT_SRC_DIR "${CMAKE_SOURCE_DIR}/bluetooth" )
-SET(BT_PLUGIN_TEST "modes-plugintest-bt")
-FILE(GLOB BT_SRCS ${BT_SRC_DIR}/*.cpp)
-SET(BT_SRCS ${BT_SRCS} "mdsp_test_bt.cpp")
-
-ADD_EXECUTABLE(${BT_PLUGIN_TEST} ${BT_SRCS})
-TARGET_LINK_LIBRARIES(${BT_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${BT_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
-#===================================================================#
-SET(APP_SRC_DIR "${CMAKE_SOURCE_DIR}/app" )
-SET(APP_PLUGIN_TEST "modes-plugintest-app")
-FILE(GLOB APP_SRCS ${APP_SRC_DIR}/*.cpp)
-SET(APP_SRCS ${APP_SRCS} "mdsp_test_app.cpp")
-
-ADD_EXECUTABLE(${APP_PLUGIN_TEST} ${APP_SRCS})
-TARGET_LINK_LIBRARIES(${APP_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${APP_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
-#===================================================================#
-SET(PKG_SRC_DIR "${CMAKE_SOURCE_DIR}/pkg" )
-SET(PKG_PLUGIN_TEST "modes-plugintest-pkg")
-FILE(GLOB PKG_SRCS ${PKG_SRC_DIR}/*.cpp)
-SET(PKG_SRCS ${PKG_SRCS} "mdsp_test_pkg.cpp")
-
-ADD_EXECUTABLE(${PKG_PLUGIN_TEST} ${PKG_SRCS})
-TARGET_LINK_LIBRARIES(${PKG_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${PKG_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
-#===================================================================#
-SET(VCONF_SRC_DIR "${CMAKE_SOURCE_DIR}/vconf" )
-SET(VCONF_PLUGIN_TEST "modes-plugintest-vconf")
-FILE(GLOB VCONF_SRCS ${VCONF_SRC_DIR}/*.cpp)
-SET(VCONF_SRCS ${VCONF_SRCS} "mdsp_test_vconf.cpp")
-
-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})
-#===================================================================#
-SET(MEDIA_SRC_DIR "${CMAKE_SOURCE_DIR}/media" )
-SET(MEDIA_PLUGIN_TEST "modes-plugintest-media")
-FILE(GLOB MEDIA_SRCS ${MEDIA_SRC_DIR}/*.cpp)
-SET(MEDIA_SRCS ${MEDIA_SRCS} "mdsp_test_media.cpp")
-
-ADD_EXECUTABLE(${MEDIA_PLUGIN_TEST} ${MEDIA_SRCS})
-TARGET_LINK_LIBRARIES(${MEDIA_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${MEDIA_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
-#===================================================================#
-SET(DISPLAY_SRC_DIR "${CMAKE_SOURCE_DIR}/display" )
-SET(DISPLAY_PLUGIN_TEST "modes-plugintest-display")
-FILE(GLOB DISPLAY_SRCS ${DISPLAY_SRC_DIR}/*.cpp)
-SET(DISPLAY_SRCS ${DISPLAY_SRCS} "mdsp_test_display.cpp")
-
-ADD_EXECUTABLE(${DISPLAY_PLUGIN_TEST} ${DISPLAY_SRCS})
-TARGET_LINK_LIBRARIES(${DISPLAY_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${DISPLAY_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
diff --git a/unittests/mdsp_test_app.cpp b/unittests/mdsp_test_app.cpp
deleted file mode 100644 (file)
index e25e87a..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <iostream>
-#include <string>
-
-#include <gtest/gtest.h>
-#include <glib.h>
-#include <aul.h>
-#include <Plugin.h>
-#include <app_manager.h>
-#include <app_manager_extension.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class AppPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-               plugin = objectCreate();
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-               objectDelete(plugin);
-               plugin = nullptr;
-       }
-
-       static gboolean appUndoTimeout(gpointer data)
-       {
-               PluginAction *action = (PluginAction*)data;
-               action->undo();
-               g_main_loop_quit(loop);
-               plugin->deleteAction(action);
-
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean checkSetUndoIdler(gpointer data)
-       {
-               PluginAction *action = plugin->newAction("launch");
-               EXPECT_FALSE(action->IsCurrentValue(std::string(testApp)));
-               result = action->set(std::string(testApp));
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               if (MODES_ERROR_NONE == result) {
-                       g_timeout_add(1000, appUndoTimeout, action);
-               } else {
-                       g_main_loop_quit(loop);
-                       plugin->deleteAction(action);
-               }
-               return G_SOURCE_REMOVE;
-       }
-
-       static void changedCB(void *userData)
-       {
-               PluginAction *action = (PluginAction*)userData;
-
-               cbCalled = true;
-               std::cout << ">>>>>>>> changedCB: Terminated <<<<<<<<" << std::endl;
-               appUndoTimeout(action);
-       }
-
-       static gboolean checkChangedCBIdler(gpointer data)
-       {
-               sleep(1);
-               PluginAction *action = plugin->newAction("launch");
-               EXPECT_FALSE(action->IsCurrentValue(std::string(testApp)));
-               result = action->set(std::string(testApp));
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               if (MODES_ERROR_NONE == result) {
-                       int ret = action->setChangedCallback(changedCB, action);
-                       EXPECT_EQ(MODES_ERROR_NONE, ret);
-                       g_timeout_add(20000, appUndoTimeout, action); //For running continue
-               } else {
-                       g_main_loop_quit(loop);
-                       plugin->deleteAction(action);
-               }
-
-               sleep(1);
-               app_context_h runAppContext = NULL;
-               int ret = app_manager_get_app_context(testApp, &runAppContext);
-               if (APP_MANAGER_ERROR_NONE != ret)
-                       std::cout << testApp << " get_app_context() Fail:" << ret << std::endl;
-               else
-                       app_manager_terminate_app(runAppContext);
-
-               return G_SOURCE_REMOVE;
-       }
-
-       static const char *testApp;
-       static int result;
-       static bool cbCalled;
-       static GMainLoop *loop;
-       static GThread *my_thread;
-       static Plugin *plugin;
-};
-
-const char *AppPluginTest::testApp = "org.tizen.setting";
-int AppPluginTest::result = 0;
-bool AppPluginTest::cbCalled = false;
-Plugin *AppPluginTest::plugin = nullptr;
-GMainLoop *AppPluginTest::loop = NULL;
-
-TEST_F(AppPluginTest, CheckSetUndo)
-{
-       g_idle_add(checkSetUndoIdler, plugin);
-       g_main_loop_run(loop);
-}
-
-TEST_F(AppPluginTest, checkChangedCB)
-{
-       cbCalled = false;
-       g_idle_add(checkChangedCBIdler, NULL);
-       g_main_loop_run(loop);
-       //TODO: at posttrans of unittest, changedCB is not called
-       //EXPECT_EQ(cbCalled, true);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_bt.cpp b/unittests/mdsp_test_bt.cpp
deleted file mode 100644 (file)
index 4fc5d24..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <string>
-#include <gtest/gtest.h>
-#include <modes.h>
-#include <Plugin.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class BtPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               plugin = objectCreate();
-               loop = g_main_loop_new(NULL, FALSE);
-               handle = modes_connect();
-       }
-
-       void TearDown() override
-       {
-               objectDelete(plugin);
-               plugin = nullptr;
-               g_main_loop_unref(loop);
-               loop = NULL;
-               modes_disconnect(handle);
-               handle = NULL;
-       }
-
-       static gboolean apply_mode_idler(gpointer data)
-       {
-               result = modes_apply_mode(handle, (const char*)data);
-
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean undo_mode_idler(gpointer data)
-       {
-               result = modes_apply_mode(handle, (const char*)data);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               sleep(5);
-               result = modes_undo_mode(handle, (const char*)data);
-
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static modes_h handle;
-       static int result;
-       static GMainLoop *loop;
-       Plugin *plugin;
-};
-
-int BtPluginTest::result = 0;
-GMainLoop *BtPluginTest::loop = NULL;
-modes_h BtPluginTest::handle = NULL;
-
-TEST_F(BtPluginTest, undoModebtOff)
-{
-       g_idle_add(undo_mode_idler, (gpointer)"btOff");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(BtPluginTest, undoModebtOn)
-{
-       g_idle_add(undo_mode_idler, (gpointer)"btOn");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-// btAudioConnect does not support undo mode
-TEST_F(BtPluginTest, btAudioConnect)
-{
-       g_idle_add(apply_mode_idler, (gpointer)"btAudioConnect");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(BtPluginTest, btTest)
-{
-       int ret;
-
-       ASSERT_TRUE(nullptr != plugin);
-
-       PluginAction *action = plugin->newAction("power");
-       ret = action->set(false);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-       sleep(3);//for avoiding the NOW_IN_PROGRESS error
-
-       ret = action->set(true);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       ret = action->set(std::string("on"));
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-       plugin->deleteAction(action);
-
-       action = plugin->newAction("abcdefg");
-       EXPECT_EQ(action, nullptr);
-}
-
-int main(int argc, char **argv)
-{
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
-
diff --git a/unittests/mdsp_test_display.cpp b/unittests/mdsp_test_display.cpp
deleted file mode 100644 (file)
index c038d5a..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by displaylicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <gtest/gtest.h>
-#include <Plugin.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class displayPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-               plugin = objectCreate();
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-               objectDelete(plugin);
-               plugin = nullptr;
-       }
-
-       static gboolean displayPluginBrightnessIdler(gpointer data)
-       {
-               PluginAction *action = plugin->newAction("brightness");
-               int value = 100;
-               if (action->IsCurrentValue(value))
-                       value--;
-               result = action->set(value);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               action->undo();
-
-               plugin->deleteAction(action);
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean displayPluginDenyPalmTouchIdler(gpointer data)
-       {
-               PluginAction *action = plugin->newAction("denyPalmTouch");
-               EXPECT_FALSE(action->IsCurrentValue(true));
-               result = action->set(true);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               action->undo();
-
-               plugin->deleteAction(action);
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean displayPluginAlwaysOnIdler(gpointer data)
-       {
-               PluginAction *action = plugin->newAction("timeout");
-               EXPECT_FALSE(action->IsCurrentValue(0));
-               result = action->set(0);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               action->undo();
-
-               plugin->deleteAction(action);
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean displayPluginAutoBrightnessIdler(gpointer data)
-       {
-               PluginAction *action = plugin->newAction("autoBrightness");
-               EXPECT_FALSE(action->IsCurrentValue(1));
-               result = action->set(1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               action->undo();
-
-               result = action->set(2);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               plugin->deleteAction(action);
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-       static int result;
-       static GMainLoop *loop;
-       static Plugin *plugin;
-};
-
-int displayPluginTest::result = 0;
-Plugin *displayPluginTest::plugin = nullptr;
-GMainLoop *displayPluginTest::loop = NULL;
-
-TEST_F(displayPluginTest, setBrightness)
-{
-       g_idle_add(displayPluginBrightnessIdler, plugin);
-       g_main_loop_run(loop);
-}
-
-TEST_F(displayPluginTest, setAutoBrightness)
-{
-       g_idle_add(displayPluginAutoBrightnessIdler, plugin);
-       g_main_loop_run(loop);
-}
-
-TEST_F(displayPluginTest, setAlwaysOn)
-{
-       g_idle_add(displayPluginAlwaysOnIdler, plugin);
-       g_main_loop_run(loop);
-}
-
-TEST_F(displayPluginTest, setDenyPalmTouch)
-{
-       g_idle_add(displayPluginDenyPalmTouchIdler, plugin);
-       g_main_loop_run(loop);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_integration.cpp b/unittests/mdsp_test_integration.cpp
deleted file mode 100644 (file)
index 825ad59..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <gtest/gtest.h>
-#include <modes.h>
-
-class IntegrationTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-               handle = modes_connect();
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-               modes_disconnect(handle);
-               handle = NULL;
-       }
-
-       static gboolean check_mode_idler(gpointer data)
-       {
-               modes_undo_mode(handle, (const char*)data);
-               result = modes_apply_mode(handle, (const char*)data);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               sleep(2);
-               result = modes_undo_mode(handle, (const char*)data);
-
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static modes_h handle;
-       static int result;
-       static GMainLoop *loop;
-};
-
-int IntegrationTest::result = 0;
-GMainLoop *IntegrationTest::loop = NULL;
-modes_h IntegrationTest::handle = NULL;
-
-TEST_F(IntegrationTest, runMode_btAudioConnect)
-{
-       g_idle_add(check_mode_idler, (gpointer)"btAudioConnect");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_btOff)
-{
-       g_idle_add(check_mode_idler, (gpointer)"btOff");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_btOn)
-{
-       g_idle_add(check_mode_idler, (gpointer)"btOn");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_powerSave)
-{
-       g_idle_add(check_mode_idler, (gpointer)"Power-Save");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_displayBlock)
-{
-       g_idle_add(check_mode_idler, (gpointer)"displayBlock");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_wifiOn)
-{
-       g_idle_add(check_mode_idler, (gpointer)"wifi-on");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-TEST_F(IntegrationTest, runMode_waterlock)
-{
-       g_idle_add(check_mode_idler, (gpointer)"Water-Lock");
-       g_main_loop_run(loop);
-       EXPECT_EQ(MODES_ERROR_NONE, result);
-}
-
-int main(int argc, char **argv)
-{
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_media.cpp b/unittests/mdsp_test_media.cpp
deleted file mode 100644 (file)
index 8bed4ad..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by medialicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <string>
-#include <gtest/gtest.h>
-#include <Plugin.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class MediaPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-               plugin = objectCreate();
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-               objectDelete(plugin);
-               plugin = nullptr;
-       }
-
-       static gboolean mediaPlaySetUndoTimeout(gpointer data)
-       {
-               PluginAction *action = (PluginAction*)data;
-               action->undo();
-               g_main_loop_quit(loop);
-               return false;
-       }
-
-       static gboolean mediaPlaySetUndoIdler(gpointer data)
-       {
-               PluginAction *action = (PluginAction*)data;
-               const std::string file = "/opt/usr/data/settings/Ringtones/ringtone_sdk.mp3";
-               EXPECT_FALSE(action->IsCurrentValue(file));
-               result = action->set(file);
-               if (MODES_ERROR_NONE != result) {
-                       const std::string wearableFile = "/opt/usr/data/settings/Previews/Media_preview_Over_the_horizon_B2.ogg";
-                       EXPECT_FALSE(action->IsCurrentValue(wearableFile));
-                       result = action->set(wearableFile);
-               }
-
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               if (MODES_ERROR_NONE == result)
-                       g_timeout_add(1000, mediaPlaySetUndoTimeout, action);
-               else
-                       g_main_loop_quit(loop);
-
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean VolumeSetUndoIdler(gpointer data)
-       {
-               PluginAction *action;
-               action = plugin->newAction("mediaVolume");
-               EXPECT_FALSE(action->IsCurrentValue(5));
-               result = action->set(5);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("systemVolume");
-               EXPECT_FALSE(action->IsCurrentValue(2));
-               result = action->set(2);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("ringtoneVolume");
-               EXPECT_FALSE(action->IsCurrentValue(9));
-               result = action->set(9);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("notificationVolume");
-               EXPECT_FALSE(action->IsCurrentValue(1));
-               result = action->set(1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("mediaVolume");
-               EXPECT_FALSE(action->IsCurrentValue(-1));
-               result = action->set(-1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("systemVolume");
-               EXPECT_FALSE(action->IsCurrentValue(-1));
-               result = action->set(-1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("ringtoneVolume");
-               EXPECT_FALSE(action->IsCurrentValue(-1));
-               result = action->set(-1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               action = plugin->newAction("notificationVolume");
-               EXPECT_FALSE(action->IsCurrentValue(-1));
-               result = action->set(-1);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               action->undo();
-               plugin->deleteAction(action);
-
-               g_main_loop_quit(loop);
-
-               return G_SOURCE_REMOVE;
-       }
-
-       static int result;
-       static GMainLoop *loop;
-       static Plugin *plugin;
-};
-
-int MediaPluginTest::result = 0;
-Plugin *MediaPluginTest::plugin = nullptr;
-GMainLoop *MediaPluginTest::loop = nullptr;
-
-TEST_F(MediaPluginTest, setUndoMediaPlay)
-{
-       PluginAction *action = plugin->newAction("player");
-       g_idle_add(mediaPlaySetUndoIdler, action);
-       g_main_loop_run(loop);
-       plugin->deleteAction(action);
-}
-
-TEST_F(MediaPluginTest, setUndoMediaVolume)
-{
-       g_idle_add(VolumeSetUndoIdler, NULL);
-       g_main_loop_run(loop);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_pkg.cpp b/unittests/mdsp_test_pkg.cpp
deleted file mode 100644 (file)
index 936a05b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <string>
-#include <gtest/gtest.h>
-#include <vconf.h>
-#include <Plugin.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class PkgPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-               plugin = objectCreate();
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-               objectDelete(plugin);
-               plugin = nullptr;
-               vconf_set_str("db/setting/menuscreen/package_name", "org.tizen.homescreen-efl");
-       }
-
-       static gboolean pkgPluginIdler(gpointer data)
-       {
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       static int result;
-       static GMainLoop *loop;
-       Plugin *plugin;
-};
-
-GMainLoop *PkgPluginTest::loop = NULL;
-
-TEST_F(PkgPluginTest, setUndoTest)
-{
-       PluginAction *action = plugin->newAction("supportMode");
-       EXPECT_FALSE(action->IsCurrentValue(1));
-       int ret = action->set(1);
-       EXPECT_EQ(MODES_ERROR_NONE, ret);
-
-       g_idle_add(pkgPluginIdler, plugin);
-       g_main_loop_run(loop);
-
-       action->undo();
-
-       g_idle_add(pkgPluginIdler, plugin);
-       g_main_loop_run(loop);
-       plugin->deleteAction(action);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_vconf.cpp b/unittests/mdsp_test_vconf.cpp
deleted file mode 100644 (file)
index 13fc138..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <vconf.h>
-#include <gtest/gtest.h>
-#include <Plugin.h>
-#include "plugin-log.h"
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class VconfPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               plugin = objectCreate();
-               loop = g_main_loop_new(NULL, FALSE);
-       }
-
-       void TearDown() override
-       {
-               objectDelete(plugin);
-               g_main_loop_unref(loop);
-               loop = NULL;
-               cb1Called = false;
-               cb2Called = false;
-       }
-
-       static void shouldNotBeCalled(void *userData)
-       {
-               ERR("This Callback(%s) should not be called", (char*)userData);
-               g_main_loop_quit(loop);
-               GTEST_FAIL();
-       }
-
-       static void valChangedCb(void *userData)
-       {
-               DBG("%s changed callback called!", (char*)userData);
-               g_main_loop_quit(loop);
-       }
-
-       static void callback1(void *userData)
-       {
-               PluginAction *action = (PluginAction*)userData;
-               DBG("%s changed callback called!", action->getKey().c_str());
-
-               //In practice, it is handled by Action. refer to Action.cpp
-               action->unSetChangedCallback(callback1);
-
-               cb1Called = true;
-       }
-
-       static void callback2(void *userData)
-       {
-               DBG("%s changed callback called!", (char*)userData);
-               cb2Called = true;
-               g_main_loop_quit(loop);
-       }
-
-       static gboolean changedCallbackidler(gpointer data)
-       {
-               DBG("start change the value db/setting/psmode");
-               vconf_set_int("db/setting/psmode", 7);
-               return G_SOURCE_REMOVE;
-       }
-
-       static GMainLoop *loop;
-       static Plugin *plugin;
-       static bool cb1Called;
-       static bool cb2Called;
-};
-
-bool VconfPluginTest::cb1Called = false;
-bool VconfPluginTest::cb2Called = false;
-Plugin *VconfPluginTest::plugin = nullptr;
-GMainLoop *VconfPluginTest::loop = NULL;
-
-
-TEST_F(VconfPluginTest, VconfInt)
-{
-       int ret;
-       const char *key = "db.setting.psmode";
-
-       PluginAction *action = plugin->newAction(key);;
-       ret = action->set(0);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       EXPECT_FALSE(action->IsCurrentValue(1));
-       ret = action->set(1);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       action->undo();
-       plugin->deleteAction(action);
-}
-
-TEST_F(VconfPluginTest, VconfDouble)
-{
-       int ret;
-       const char *key = "db.system.timechange_external";
-
-       PluginAction *action = plugin->newAction(key);;
-       ret = action->set(0.0);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       EXPECT_FALSE(action->IsCurrentValue(1.0));
-       ret = action->set(1.0);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       action->undo();
-       plugin->deleteAction(action);
-}
-
-TEST_F(VconfPluginTest, VconfBool)
-{
-       int ret;
-       const char *key = "db.setting.sound.button_sounds";
-
-       PluginAction *action = plugin->newAction(key);;
-       ret = action->set(true);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       EXPECT_FALSE(action->IsCurrentValue(false));
-       ret = action->set(false);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       action->undo();
-       plugin->deleteAction(action);
-}
-
-TEST_F(VconfPluginTest, VconfStr)
-{
-       int ret;
-       const char *key = "db.setting.device_name";
-       const std::string devName = "Tizen";
-       const std::string tmpName = "ModesTest";
-
-       PluginAction *action = plugin->newAction(key);
-       ret = action->set(devName);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       EXPECT_FALSE(action->IsCurrentValue(tmpName));
-       ret = action->set(tmpName);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       action->undo();
-       plugin->deleteAction(action);
-}
-
-TEST_F(VconfPluginTest, callbackPluginVconf)
-{
-       int oldVal = 0;
-       const char *key = "db.setting.psmode";
-       int ret = vconf_get_int("db/setting/psmode", &oldVal);
-       EXPECT_EQ(ret, 0);
-
-       PluginAction *action = plugin->newAction(key);
-       ret = action->set(0);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       ret = action->setChangedCallback(valChangedCb, (void*)key);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-       g_idle_add(changedCallbackidler, nullptr);
-       g_main_loop_run(loop);
-
-       // It should be removed by the changed callback procedure.
-       action->unSetChangedCallback(valChangedCb);
-
-       ret = action->setChangedCallback(shouldNotBeCalled, (void*)key);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-       action->unSetChangedCallback(shouldNotBeCalled);
-       plugin->deleteAction(action);
-       vconf_set_int("db/setting/psmode", oldVal);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mdsp_test_wifi.cpp b/unittests/mdsp_test_wifi.cpp
deleted file mode 100644 (file)
index 9605663..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <string>
-#include <gtest/gtest.h>
-#include <Plugin.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" Plugin* objectCreate(void);
-extern "C" void objectDelete(Plugin *plugin);
-
-class WifiPluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               plugin = objectCreate();
-       }
-
-       void TearDown() override
-       {
-               objectDelete(plugin);
-               plugin = nullptr;
-       }
-
-       static gboolean timer(gpointer data)
-       {
-               GMainLoop *loop = (GMainLoop*)data;
-               g_main_loop_quit(loop);
-               return G_SOURCE_REMOVE;
-       }
-
-       Plugin *plugin;
-};
-
-TEST_F(WifiPluginTest, wifiTest)
-{
-       int ret;
-
-       ASSERT_TRUE(nullptr != plugin);
-
-       bool val;
-       PluginAction *action = plugin->newAction("power");
-       val = action->IsCurrentValue(false);
-       ret = action->set(val);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       GMainLoop *loop = g_main_loop_new(NULL, FALSE);
-       g_timeout_add(1000, timer, (gpointer)loop);
-       g_main_loop_run(loop);
-
-       ret = action->set(!val);
-       EXPECT_EQ(ret, MODES_ERROR_NONE);
-
-       ret = action->set(0);
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-
-       ret = action->set(1);
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-
-       ret = action->set(0.0);
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-
-       ret = action->set(1.0);
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-
-       ret = action->set(std::string("off"));
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-
-       ret = action->set(std::string("on"));
-       EXPECT_EQ(ret, MODES_ERROR_NOT_SUPPORTED);
-       plugin->deleteAction(action);
-
-       action = plugin->newAction("abcdefg");
-       EXPECT_EQ(action, nullptr);
-}
-
-int main(int argc, char **argv) {
-       ::testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}
diff --git a/unittests/mode/tizen_Power-Save_mode.xml b/unittests/mode/tizen_Power-Save_mode.xml
deleted file mode 100644 (file)
index 6e47222..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="Power-Save" type="normal">
-    <action rule="pkg.supportMode" restrict="lock">ULTRA_POWER_SAVING</action>
-    <action rule="wifi.power" restrict="lock">off</action>
-    <action rule="bluetooth.power" restrict="lock">off</action>
-    <action rule="display.brightness" restrict="lock">30</action>
-    <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>
diff --git a/unittests/mode/tizen_Quick-Panel_mode.xml b/unittests/mode/tizen_Quick-Panel_mode.xml
deleted file mode 100644 (file)
index 0773ef0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="Quick-Panel" type="normal">
-    <action rule="wifi.power">on</action>
-    <action rule="vconf.db.setting.sound.sound_on">1</action>
-    <action rule="vconf.db.setting.sound.vibration_on">1</action>
-    <action rule="vconf.db.location.setting.Usemylocation">1</action>
-    <action rule="vconf.db.setting.auto_rotate_screen">1</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_Water-Lock_mode.xml b/unittests/mode/tizen_Water-Lock_mode.xml
deleted file mode 100644 (file)
index d499433..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="Water-Lock" type="normal">
-    <action rule="vconf.db.setting.sound.sound_on" restrict="lock">false</action>
-    <action rule="vconf.db.setting.sound.vibration_on" restrict="lock">true</action>
-    <undo rule="media.player">/opt/usr/data/settings/Alarms/Alarms_on_call.ogg</undo>
-  </mode>
-</tizenModes>
-
-
diff --git a/unittests/mode/tizen_appLaunch_mode.xml b/unittests/mode/tizen_appLaunch_mode.xml
deleted file mode 100644 (file)
index f286dac..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="EssentialCheck" type="normal">
-    <action rule="app.launch" restrict="essential">org.tizen.modesupervisor</action>
-    <action rule="wifi.power">off</action>
-    <action rule="bluetooth.power">off</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_btAudioConnect_mode.xml b/unittests/mode/tizen_btAudioConnect_mode.xml
deleted file mode 100644 (file)
index 6359800..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="btAudioConnect" type="normal">
-    <action rule="bluetooth.power" restrict="lock">on</action>
-    <action rule="bluetooth.audioConnect" restrict="lock">08:AE:D6:5E:AE:16</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_btOff_mode.xml b/unittests/mode/tizen_btOff_mode.xml
deleted file mode 100644 (file)
index 5d3d3b1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="btOff" type="normal">
-    <action rule="bluetooth.power" restrict="lock">off</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_btOn_mode.xml b/unittests/mode/tizen_btOn_mode.xml
deleted file mode 100644 (file)
index 40e64a3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="btOn" type="normal">
-    <action rule="bluetooth.power" restrict="lock">on</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_displayBlock_mode.xml b/unittests/mode/tizen_displayBlock_mode.xml
deleted file mode 100644 (file)
index 66a027d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="displayBlock" type="normal">
-    <action rule="display.timeout" restrict="lock">ALWAYS_ON</action>
-    <action rule="display.denyPalmTouch" restrict="lock">on</action>
-  </mode>
-</tizenModes>
diff --git a/unittests/mode/tizen_wifi-on_mode.xml b/unittests/mode/tizen_wifi-on_mode.xml
deleted file mode 100644 (file)
index d2aad8d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="wifi-on" type="normal">
-    <action rule="wifi.power">on</action>
-  </mode>
-</tizenModes>