From: JinWang An Date: Tue, 21 Jan 2020 04:29:07 +0000 (+0900) Subject: Update unittest code for modes_h X-Git-Tag: submit/tizen/20200406.072014~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b85e1dc1cf71a52a1949b0ddfb33a975c31bd695;p=platform%2Fcore%2Fsystem%2Fmodes-plugins.git Update unittest code for modes_h --- diff --git a/unittests/mdsp_test_bt.cpp b/unittests/mdsp_test_bt.cpp index cfa604e..f07937b 100644 --- a/unittests/mdsp_test_bt.cpp +++ b/unittests/mdsp_test_bt.cpp @@ -31,6 +31,7 @@ protected: { plugin = objectCreate(); loop = g_main_loop_new(NULL, FALSE); + handle = modes_connect(); } void TearDown() override @@ -39,11 +40,13 @@ protected: plugin = NULL; g_main_loop_unref(loop); loop = NULL; + modes_disconnect(handle); + handle = NULL; } static gboolean apply_mode_idler(gpointer data) { - result = modes_apply_mode((const char*)data); + result = modes_apply_mode(handle, (const char*)data); g_main_loop_quit(loop); return G_SOURCE_REMOVE; @@ -51,15 +54,16 @@ protected: static gboolean undo_mode_idler(gpointer data) { - result = modes_apply_mode((const char*)data); + result = modes_apply_mode(handle, (const char*)data); EXPECT_EQ(MODES_ERROR_NONE, result); sleep(5); - result = modes_undo_mode((const char*)data); + 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; @@ -67,6 +71,7 @@ protected: int BtPluginTest::result = 0; GMainLoop *BtPluginTest::loop = NULL; +modes_h BtPluginTest::handle = NULL; TEST_F(BtPluginTest, undoModebtOff) { diff --git a/unittests/mdsp_test_integration.cpp b/unittests/mdsp_test_integration.cpp index 1a9b6de..566246a 100644 --- a/unittests/mdsp_test_integration.cpp +++ b/unittests/mdsp_test_integration.cpp @@ -22,32 +22,37 @@ 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((const char*)data); - result = modes_apply_mode((const char*)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((const char*)data); + 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) {