%posttrans unittests
systemctl restart modes.service
-export XDG_RUNTIME_DIR=/run
%{modes_plugin_test_dir}/modes-plugintest-app
-%{modes_plugin_test_dir}/modes-plugintest-vconf
-%{modes_plugin_test_dir}/modes-plugintest-media
+XDG_RUNTIME_DIR=/run %{modes_plugin_test_dir}/modes-plugintest-media
%{modes_plugin_test_dir}/modes-plugintest-wifi
%{modes_plugin_test_dir}/modes-plugintest-bt
-%{modes_plugin_test_dir}/modes-plugintest-mode
%{modes_plugin_test_dir}/modes-plugintest-pkg
-%{modes_plugin_test_dir}/modes-plugintest-display
+XDG_RUNTIME_DIR=/run %{modes_plugin_test_dir}/modes-plugintest-display
+%{modes_plugin_test_dir}/modes-plugintest-vconf
+%{modes_plugin_test_dir}/modes-plugintest-mode
%postun -p /sbin/ldconfig
action->undo();
g_main_loop_quit(loop);
plugin->deleteAction(action);
- return false;
+
+ return G_SOURCE_REMOVE;
}
static gboolean checkSetUndoIdler(gpointer data)
static void changedCB(void *userData)
{
- const char *appName = (char*)userData;
- std::cout << appName << "is terminated" << std::endl;
+ 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);
- int ret = action->setChangedCallback(changedCB, (void*)testApp);
- EXPECT_EQ(MODES_ERROR_NONE, ret);
-
- app_context_h runAppContext = NULL;
- app_manager_get_app_context(testApp, &runAppContext);
- app_manager_terminate_app(runAppContext);
-
if (MODES_ERROR_NONE == result) {
- g_timeout_add(1000, appUndoTimeout, action);
+ 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, checkChangedCB)
{
- sleep(3);
+ 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);
+ ::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}