--- /dev/null
+/*
+ * 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 "modes.h"
+
+#include <stdlib.h>
+#include <glib.h>
+#include "mdsc.h"
+#include "common/dbus.h"
+#include "common/dbus_def.h"
+
+struct mds_action_handle {
+ char *id;
+ char *rule;
+ char *value;
+};
+
+struct mds_mode_handle {
+ char *name;
+ modes_type_mode_e type;
+ bool hidden;
+ GList *action_list;
+};
+
+static int _mdsc_dbus_add_mode_sync(mdsDbus *mdsc_dbus, GVariant *mode_data)
+{
+ int result = MODES_ERROR_NONE;
+ gboolean ret;
+ GError *error = NULL;
+
+ RETV_IF(NULL == mode_data, MODES_ERROR_INVALID_PARAMETER);
+
+ ret = mds_dbus_call_add_mode_sync(mdsc_dbus, mode_data, &result, NULL, &error);
+ if (FALSE == ret) {
+ ERR("mds_dbus_call_add_mode_sync() Fail(%s)", error ? error->message : "unknown");
+ g_error_free(error);
+ return MODES_ERROR_SYSTEM;
+ }
+
+ return result;
+}
+
+static int _mdsc_dbus_remove_mode_sync(mdsDbus *mdsc_dbus, const char *mode)
+{
+ int result = MODES_ERROR_NONE;
+ gboolean ret;
+ GError *error = NULL;
+
+ RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
+
+ ret = mds_dbus_call_remove_mode_sync(mdsc_dbus, mode, &result, NULL, &error);
+ if (FALSE == ret) {
+ ERR("mds_dbus_call_remove_mode_sync() Fail(%s)", error ? error->message : "unknown");
+ g_error_free(error);
+ return MODES_ERROR_SYSTEM;
+ }
+
+ return result;
+}
+
+static void _mdsc_free_action(gpointer data)
+{
+ RET_IF(NULL == data);
+
+ struct mds_action_handle *action_data = data;
+
+ free(action_data->id);
+ free(action_data->rule);
+ free(action_data->value);
+ free(action_data);
+}
+
+static GVariant* _mdsc_create_mode_data(modes_mode_h mode)
+{
+ RETV_IF(NULL == mode, NULL);
+
+ GVariantBuilder *action_builder = g_variant_builder_new(G_VARIANT_TYPE(MODES_DBUS_ACTION_LIST_SIG));
+ GList *it = g_list_first(mode->action_list);
+
+ while (NULL != it) {
+ struct mds_action_handle *action_data = (struct mds_action_handle *)it->data;
+ g_variant_builder_add(action_builder, MODES_DBUS_ACTION_SIG, MODES_DBUS_SAFE_STR(action_data->id),
+ MODES_DBUS_SAFE_STR(action_data->rule), MODES_DBUS_SAFE_STR(action_data->value));
+ it = g_list_next(it);
+ }
+
+ GVariant *action = g_variant_new(MODES_DBUS_ACTION_LIST_SIG, action_builder);
+ GVariant *mode_data = g_variant_new(MODES_DBUS_MODE_SIG, mode->name, mode->type, mode->hidden, action);
+ g_variant_builder_unref(action_builder);
+
+ return mode_data;
+}
+
+API modes_mode_h modes_create_mode(const char *name, modes_type_mode_e type)
+{
+ struct mds_mode_handle *mode;
+
+ RETV_IF(NULL == name, NULL);
+
+ mode = malloc(sizeof(struct mds_mode_handle));
+ RETV_IF(NULL == mode, NULL);
+
+ mode->name = strdup(name);
+ mode->type = type;
+ mode->hidden = false;
+ mode->action_list = NULL;
+
+ return mode;
+}
+
+API int modes_set_hidden(modes_mode_h mode, bool hidden)
+{
+ RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
+
+ mode->hidden = hidden;
+
+ return MODES_ERROR_NONE;
+}
+
+API modes_action_h modes_create_action(const char *name, const char *value)
+{
+ struct mds_action_handle *action;
+
+ RETV_IF(NULL == name, NULL);
+ RETV_IF(NULL == value, NULL);
+
+ action = malloc(sizeof(struct mds_action_handle));
+ RETV_IF(NULL == action, NULL);
+
+ action->rule = strdup(name);
+ action->value = strdup(value);
+ action->id = NULL;
+
+ return action;
+}
+
+API int modes_mode_add_action(modes_mode_h mode, modes_action_h action)
+{
+ RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == action, MODES_ERROR_INVALID_PARAMETER);
+
+ mode->action_list = g_list_append(mode->action_list, action);
+
+ return MODES_ERROR_NONE;
+}
+
+API int modes_add_mode(modes_h handle, modes_mode_h mode)
+{
+ int ret;
+
+ RETV_IF(NULL == handle, MODES_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
+
+ GVariant *mode_data = _mdsc_create_mode_data(mode);
+ RETV_IF(NULL == mode_data, MODES_ERROR_INVALID_PARAMETER);
+
+ ret = _mdsc_dbus_add_mode_sync(handle->conn, mode_data);
+ if (MODES_ERROR_NONE != ret) {
+ ERR("_mdsc_dbus_add_mode_sync() Fail(%d)", ret);
+ return ret;
+ }
+
+ return MODES_ERROR_NONE;
+}
+
+API int modes_remove_mode(modes_h handle, const char *name)
+{
+ int ret;
+ RETV_IF(NULL == handle, MODES_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == name, MODES_ERROR_INVALID_PARAMETER);
+
+ ret = _mdsc_dbus_remove_mode_sync(handle->conn, name);
+ if (MODES_ERROR_NONE != ret) {
+ ERR("_mdsc_dbus_remove_mode_sync() Fail(%d)", ret);
+ return ret;
+ }
+
+ return MODES_ERROR_NONE;
+}
+
+API void modes_destroy_mode(modes_mode_h mode)
+{
+ RET_IF(NULL == mode);
+
+ free(mode->name);
+
+ g_list_free_full(mode->action_list, _mdsc_free_action);
+
+ free(mode);
+}
+
+++ /dev/null
-/*
- * 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 "modes.h"
-
-#include <stdlib.h>
-#include <glib.h>
-#include "mdsc.h"
-#include "common/dbus.h"
-#include "common/dbus_def.h"
-
-struct mds_action_handle {
- char *id;
- char *rule;
- char *value;
-};
-
-struct mds_mode_handle {
- char *name;
- modes_type_mode_e type;
- bool hidden;
- GList *action_list;
-};
-
-static int _mdsc_dbus_register_mode_sync(mdsDbus *mdsc_dbus, GVariant *mode_data)
-{
- int result = MODES_ERROR_NONE;
- gboolean ret;
- GError *error = NULL;
-
- RETV_IF(NULL == mode_data, MODES_ERROR_INVALID_PARAMETER);
-
- ret = mds_dbus_call_register_mode_sync(mdsc_dbus, mode_data, &result, NULL, &error);
- if (FALSE == ret) {
- ERR("mds_dbus_call_register_mode_sync() Fail(%s)", error ? error->message : "unknown");
- g_error_free(error);
- return MODES_ERROR_SYSTEM;
- }
-
- return result;
-}
-
-static void _mdsc_free_action(gpointer data)
-{
- RET_IF(NULL == data);
-
- struct mds_action_handle *action_data = data;
-
- free(action_data->id);
- free(action_data->rule);
- free(action_data->value);
- free(action_data);
-}
-
-static GVariant* _mdsc_create_mode_data(modes_mode_h mode)
-{
- RETV_IF(NULL == mode, NULL);
-
- GVariantBuilder *action_builder = g_variant_builder_new(G_VARIANT_TYPE(MODES_DBUS_ACTION_LIST_SIG));
- GList *it = g_list_first(mode->action_list);
-
- while (NULL != it) {
- struct mds_action_handle *action_data = (struct mds_action_handle *)it->data;
- g_variant_builder_add(action_builder, MODES_DBUS_ACTION_SIG, MODES_DBUS_SAFE_STR(action_data->id),
- MODES_DBUS_SAFE_STR(action_data->rule), MODES_DBUS_SAFE_STR(action_data->value));
- it = g_list_next(it);
- }
-
- GVariant *action = g_variant_new(MODES_DBUS_ACTION_LIST_SIG, action_builder);
- GVariant *mode_data = g_variant_new(MODES_DBUS_MODE_SIG, mode->name, mode->type, mode->hidden, action);
- g_variant_builder_unref(action_builder);
-
- return mode_data;
-}
-
-API modes_mode_h modes_create_mode(const char *name, modes_type_mode_e type)
-{
- struct mds_mode_handle *mode;
-
- RETV_IF(NULL == name, NULL);
-
- mode = malloc(sizeof(struct mds_mode_handle));
- RETV_IF(NULL == mode, NULL);
-
- mode->name = strdup(name);
- mode->type = type;
- mode->hidden = false;
- mode->action_list = NULL;
-
- return mode;
-}
-
-API int modes_set_hidden(modes_mode_h mode, bool hidden)
-{
- RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
-
- mode->hidden = hidden;
-
- return MODES_ERROR_NONE;
-}
-
-API modes_action_h modes_create_action(const char *name, const char *value)
-{
- struct mds_action_handle *action;
-
- RETV_IF(NULL == name, NULL);
- RETV_IF(NULL == value, NULL);
-
- action = malloc(sizeof(struct mds_action_handle));
- RETV_IF(NULL == action, NULL);
-
- action->rule = strdup(name);
- action->value = strdup(value);
- action->id = NULL;
-
- return action;
-}
-
-API int modes_mode_add_action(modes_mode_h mode, modes_action_h action)
-{
- RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == action, MODES_ERROR_INVALID_PARAMETER);
-
- mode->action_list = g_list_append(mode->action_list, action);
-
- return MODES_ERROR_NONE;
-}
-
-API int modes_register_mode(modes_h handle, modes_mode_h mode)
-{
- int ret;
-
- RETV_IF(NULL == handle, MODES_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == mode, MODES_ERROR_INVALID_PARAMETER);
-
- GVariant *mode_data = _mdsc_create_mode_data(mode);
- RETV_IF(NULL == mode_data, MODES_ERROR_INVALID_PARAMETER);
-
- ret = _mdsc_dbus_register_mode_sync(handle->conn, mode_data);
- if (MODES_ERROR_NONE != ret) {
- ERR("_mdsc_bus_client_change_mode_sync() Fail(%d)", ret);
- return ret;
- }
-
- return MODES_ERROR_NONE;
-}
-
-API void modes_destroy_mode(modes_mode_h mode)
-{
- RET_IF(NULL == mode);
-
- free(mode->name);
-
- g_list_free_full(mode->action_list, _mdsc_free_action);
-
- free(mode);
-}
-
<arg type="s" name="modeName" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
- <method name="registerMode">
+ <method name="addMode">
<arg type="(sibv)" name="modeData" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
+ <method name="removeMode">
+ <arg type="s" name="modeName" direction="in"/>
+ <arg type="i" name="ret" direction="out"/>
+ </method>
<method name="getModes">
<arg type="a(sii)" name="modeList" direction="out"/>
<arg type="i" name="ret" direction="out"/>
int modes_mode_add_action(modes_mode_h mode, modes_action_h action);
/**
- * @brief Register Mode.
- * @details Calls this function to register mode.
+ * @brief Add Mode.
+ * @details Calls this function to add mode.
* @since_tizen 6.0
* @privlevel platform
* @privilege http://tizen.org/privilege/systemsettings.admin
* @param[in] Handle of modes server
- * @param[in] Mode handle to register
+ * @param[in] Mode handle to add
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MODES_ERROR_NONE Successful
* @retval #MODES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MODES_ERROR_SYSTEM System errors
*/
-int modes_register_mode(modes_h handle, modes_mode_h mode);
+int modes_add_mode(modes_h handle, modes_mode_h mode);
/**
* @brief Destroy Mode handle
*/
void modes_destroy_mode(modes_mode_h mode);
+/**
+ * @brief Remove Mode.
+ * @details Calls this function to remove mode.
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege http://tizen.org/privilege/systemsettings.admin
+ * @param[in] Handle of modes server
+ * @param[in] Mode name to be removed
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MODES_ERROR_NONE Successful
+ * @retval #MODES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MODES_ERROR_CONFLICT Try to remove applied mode.
+ * @retval #MODES_ERROR_SYSTEM System errors
+ */
+int modes_remove_mode(modes_h handle, const char *name);
+
/**
* @brief Adds callback for recognizing the changed of mode.
* @details Sets a function to be called when the mode is changed.
return MODES_ERROR_NONE;
}
-int ModeManager::registerMode(const Mode &mode)
+int ModeManager::addMode(const Mode &mode)
{
- string filename;
+ string filename = MODES_CUSTOM_MODE_DEFAULT_DIR "/tizen_" + mode.getName() + "_mode.xml";
XMLGenerator xmlWriter;
auto element = std::make_pair(mode.getName(), std::make_tuple(filename, mode.getModeType(), false));
}
try {
- filename = MODES_CUSTOM_MODE_DEFAULT_DIR "/tizen_" + mode.getName() + "_mode.xml";
xmlWriter.makeModeXML(filename, mode);
} catch (ModesEx &e) {
ERR("XML generator Fail(%s)", e.what());
return MODES_ERROR_INVALID_PARAMETER;
}
- DBG("[%zu] Register modeName : %s, modePath : %s, type : %d, hidden : false", modeMap.size(), mode.getName().c_str(), filename.c_str(), mode.getModeType());
+ DBG("[%zu] addMode modeName : %s, modePath : %s, type : %d, hidden : false", modeMap.size(), mode.getName().c_str(), filename.c_str(), mode.getModeType());
+
+ return MODES_ERROR_NONE;
+}
+
+int ModeManager::removeMode(const string &modeName)
+{
+ if (true == careTaker.isSavedMode(modeName)) {
+ ERR("Mode(%s) is applied.", modeName.c_str());
+ return MODES_ERROR_CONFLICT;
+ }
+
+ auto result = modeMap.find(modeName);
+ if (result == modeMap.end()) {
+ ERR("Invalid mode(%s), not found", modeName.c_str());
+ return MODES_ERROR_INVALID_PARAMETER;
+ }
+
+ string filename = std::get<0>(result->second);
+ if (string::npos == filename.find(MODES_CUSTOM_MODE_DEFAULT_DIR))
+ {
+ ERR("Invalid mode(%s), custom mode only can be removed.", modeName.c_str());
+ return MODES_ERROR_INVALID_PARAMETER;
+ }
+
+ modeMap.erase(result);
+
+ if (0 != remove(filename.c_str()))
+ ERR("remove(%s) Fail(%d)", filename.c_str(), errno);
+
+ DBG("[%zu] Remove modeName : %s, modePath : %s", modeMap.size(), modeName.c_str(), filename.c_str());
return MODES_ERROR_NONE;
}
void init();
void addModeDirectory(const std::string &dirPath);
int applyMode(const std::string &modeName, ClientPrivilege &priv, bool isTest);
- int registerMode(const Mode &mode);
+ int addMode(const Mode &mode);
+ int removeMode(const std::string &modeName);
int undoMode(const std::string &modeName);
int undoMode(const std::string &modeName, ClientPrivilege &priv);
std::list<std::tuple<std::string, int, int>> getModes();
return TRUE;
}
-gboolean RequestHandler::registerModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
+gboolean RequestHandler::addModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
GVariant *modeData, gpointer userData)
{
RETV_IF(NULL == modeMgr, FALSE);
try {
Mode mode = getModefromData(modeData);
- int ret = modeMgr->registerMode(mode);
- mds_dbus_complete_register_mode(object, invocation, ret);
+ int ret = modeMgr->addMode(mode);
+ mds_dbus_complete_add_mode(object, invocation, ret);
} catch (ModesEx &e) {
- mds_dbus_complete_register_mode(object,
+ mds_dbus_complete_add_mode(object,
invocation, MODES_ERROR_INVALID_PARAMETER);
}
return TRUE;
}
+gboolean RequestHandler::removeModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
+ const gchar *modeName, gpointer userData)
+{
+ RETV_IF(NULL == modeMgr, FALSE);
+ RETV_IF(NULL == modeName, FALSE);
+
+ int ret = modeMgr->removeMode(modeName);
+ mds_dbus_complete_remove_mode(object, invocation, ret);
+
+ return TRUE;
+}
+
gboolean RequestHandler::getModesHandler(mdsDbus *object, GDBusMethodInvocation *invocation, gpointer userData)
{
int ret = MODES_ERROR_NONE;
const gchar *modeName, gpointer userData);
static gboolean undoModeHandler(mdsDbus * object, GDBusMethodInvocation *invocation,
const gchar *modeName, gpointer userData);
- static gboolean registerModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
+ static gboolean addModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
GVariant *arg_modeData, gpointer userData);
+ static gboolean removeModeHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
+ const gchar *modeName, gpointer userData);
static gboolean getModesHandler(mdsDbus *object, GDBusMethodInvocation *invocation,
gpointer userData);
clientConn.addRequestHandler("handle-can-apply", (GCallback)&RequestHandler::canApplyModeHandler);
clientConn.addRequestHandler("handle-apply-mode", (GCallback)&RequestHandler::applyModeHandler);
clientConn.addRequestHandler("handle-undo-mode", (GCallback)&RequestHandler::undoModeHandler);
- clientConn.addRequestHandler("handle-register-mode", (GCallback)&RequestHandler::registerModeHandler);
+ clientConn.addRequestHandler("handle-add-mode", (GCallback)&RequestHandler::addModeHandler);
+ clientConn.addRequestHandler("handle-remove-mode", (GCallback)&RequestHandler::removeModeHandler);
clientConn.addRequestHandler("handle-get-modes", (GCallback)&RequestHandler::getModesHandler);
}
<deny send_destination="@DBUS_INTERFACE@" send_type="method_call"/>
<allow send_destination="@DBUS_INTERFACE@" send_path="/org/tizen/modes/dbus" send_interface="@DBUS_INTERFACE@"/>
- <check send_destination="@DBUS_INTERFACE@" send_interface="@DBUS_INTERFACE@" send_member="registerMode" privilege="http://tizen.org/privilege/systemsettings.admin"/>
+ <check send_destination="@DBUS_INTERFACE@" send_interface="@DBUS_INTERFACE@" send_member="addMode" privilege="http://tizen.org/privilege/systemsettings.admin"/>
+ <check send_destination="@DBUS_INTERFACE@" send_interface="@DBUS_INTERFACE@" send_member="removeMode" privilege="http://tizen.org/privilege/systemsettings.admin"/>
<check send_destination="@DBUS_INTERFACE@" send_interface="@DBUS_INTERFACE@" send_member="getModes" privilege="http://tizen.org/privilege/systemsettings.admin"/>
<deny send_type="signal" send_path="/org/tizen/modes/dbus" send_interface="@DBUS_INTERFACE@"/>
#include <modes.h>
#include "common/definitions.h"
-#define CREATED_MODE_NAME "created"
-
class ClientTest : public ::testing::Test {
protected:
void SetUp() override
static gboolean applyModeIdler(gpointer data)
{
- result = modes_apply_mode(handle, (const char*)data);
+ result = modes_apply_mode(handle, (char*)data);
g_main_loop_quit(loop);
return G_SOURCE_REMOVE;
static gboolean undoModeIdler(gpointer data)
{
- result = modes_apply_mode(handle, (const char*)data);
+ result = modes_apply_mode(handle, (char*)data);
EXPECT_EQ(MODES_ERROR_NONE, result);
sleep(1);
- result = modes_undo_mode(handle, (const char*)data);
+ result = modes_undo_mode(handle, (char*)data);
g_main_loop_quit(loop);
return G_SOURCE_REMOVE;
}
- static gboolean registerModeIdler(gpointer data)
+ static void addModeTest(gpointer data)
{
- modes_mode_h created_mode = modes_create_mode(CREATED_MODE_NAME, MODES_TYPE_MODE_NORMAL);
+ modes_mode_h created_mode = modes_create_mode((char*)data, MODES_TYPE_MODE_NORMAL);
modes_action_h action_handle[2];
action_handle[0] = modes_create_action("test.printBool", "on");
action_handle[1] = modes_create_action("test.printBool", "off");
result = modes_set_hidden(created_mode, true);
EXPECT_EQ(MODES_ERROR_NONE, result);
- result = modes_register_mode(handle, created_mode);
+ result = modes_add_mode(handle, created_mode);
modes_destroy_mode(created_mode);
+ EXPECT_EQ(MODES_ERROR_NONE, result);
+
+ result = modes_apply_mode(handle, (char*)data);
+ EXPECT_EQ(MODES_ERROR_NONE, result);
+ }
+
+ static gboolean addModeIdler(gpointer data)
+ {
+ addModeTest(data);
+ modes_undo_mode(handle, (char*)data);
+ modes_remove_mode(handle, (char*)data);
+ g_main_loop_quit(loop);
+
+ return G_SOURCE_REMOVE;
+ }
+
+ static gboolean removeModeIdler(gpointer data)
+ {
+ addModeTest(data);
+
+ result = modes_remove_mode(handle, (char*)data);
+ EXPECT_EQ(MODES_ERROR_CONFLICT, result);
+
+ modes_undo_mode(handle, (char*)data);
+ result = modes_remove_mode(handle, (char*)data);
+ EXPECT_EQ(MODES_ERROR_NONE, result);
g_main_loop_quit(loop);
return G_SOURCE_REMOVE;
EXPECT_EQ(MODES_ERROR_NO_DATA, ret);
}
-TEST_F(ClientTest, registerMode)
+TEST_F(ClientTest, addMode)
{
- g_idle_add(registerModeIdler, NULL);
+ g_idle_add(addModeIdler, (gpointer)"created");
g_main_loop_run(loop);
EXPECT_EQ(MODES_ERROR_NONE, result);
- if (0 != remove(MODES_CUSTOM_MODE_DEFAULT_DIR "/tizen_" CREATED_MODE_NAME "_mode.xml")) {
- std::cout << "remove() Fail :" << MODES_CUSTOM_MODE_DEFAULT_DIR "/tizen_" CREATED_MODE_NAME "_mode.xml" << " errno = " << errno << std::endl;
- }
+}
+
+TEST_F(ClientTest, removeMode)
+{
+ g_idle_add(removeModeIdler, (gpointer)"deltest");
+ g_main_loop_run(loop);
+ EXPECT_EQ(MODES_ERROR_NONE, result);
+
+ int ret = modes_remove_mode(handle, "deltestN");
+ EXPECT_EQ(MODES_ERROR_INVALID_PARAMETER, ret);
}
TEST_F(ClientTest, undoModeEx1)
TEST_F(ClientTest, getModes)
{
const char* const typeList[2] = {
- "MODES_TYPE_MODE_NORMAL",
- "MODES_TYPE_MODE_ONESHOT"
+ "MODES_TYPE_MODE_NORMAL",
+ "MODES_TYPE_MODE_ONESHOT"
};
GList *list, *cur;