From a02c931e7f2ca3c0d4774e954d4b896778884ff6 Mon Sep 17 00:00:00 2001 From: "sangwan.kwon" Date: Wed, 18 May 2016 18:43:25 +0900 Subject: Add TC about timer Change-Id: Ia023c6caf553c1589ea50779670a3a066cf8c5d4 --- tests/logic_.cpp | 10 ++++++++++ tests/logic_.h | 15 +++++++++++++++ tests/test_logic.cpp | 17 +++++++++++++++++ 3 files changed, 42 insertions(+) (limited to 'tests') diff --git a/tests/logic_.cpp b/tests/logic_.cpp index f603168..4384e4e 100644 --- a/tests/logic_.cpp +++ b/tests/logic_.cpp @@ -16,6 +16,7 @@ /* * @file logic_.cpp * @author Janusz Kozerski (j.kozerski@samsung.com) + * @author Sangwan Kwon (sangwan.kwon@samsung.com) * @version 1.0 * @brief This file is the implementation of SQL queries */ @@ -44,6 +45,7 @@ Logic_::~Logic_(void) { clean(); } + void Logic_::clean(void) { LogDebug("Cert-checker cleaning."); @@ -62,6 +64,14 @@ void Logic_::clean(void) LogDebug("No thread to join"); } +void Logic_::job() +{ + LogDebug("Test timer job"); + m_installCnt++; + + _m_wait_for_process.notify_one(); +} + void Logic_::connman_callback_manual_(bool state) { Logic::set_online(state); diff --git a/tests/logic_.h b/tests/logic_.h index 690e986..a02a003 100644 --- a/tests/logic_.h +++ b/tests/logic_.h @@ -16,6 +16,7 @@ /* * @file logic_.h * @author Janusz Kozerski (j.kozerski@samsung.com) + * @author Sangwan Kwon (sangwan.kwon@samsung.com) * @version 1.0 * @brief This file is the tesst implementation of Logic class */ @@ -47,6 +48,9 @@ class Logic_ : public Logic { void reset_cnt(); void wait_for_worker(int installCnt, int uninstallCnt, int bufferCnt); + protected: + void job(void) override; + private: int m_installCnt; int m_uninstallCnt; @@ -74,6 +78,17 @@ public: m_logic.wait_for_worker(installCnt, uninstallCnt, bufferCnt); } + // timer operation + void timerStart(int interval) + { + m_logic.timerStart(interval); + } + + void timerStop() + { + m_logic.timerStop(); + } + private: Logic_ m_logic; }; diff --git a/tests/test_logic.cpp b/tests/test_logic.cpp index 589442a..8b32d7b 100644 --- a/tests/test_logic.cpp +++ b/tests/test_logic.cpp @@ -16,6 +16,7 @@ /* * @file test_logic.cpp * @author Janusz Kozerski (j.kozerski@samsung.com) + * @author Sangwan Kwon (sangwan.kwon@samsung.com) * @version 1.0 * @brief Tests of Logic class */ @@ -440,4 +441,20 @@ BOOST_AUTO_TEST_CASE(logic_workflow_OCSP_APP_REVOKED_2) { buff = get_buffer_(); BOOST_CHECK_MESSAGE(buff == apps, log_apps(apps, buff)); } + +BOOST_AUTO_TEST_CASE(logic_workflow_timer) { + + // Wait for setup. + BOOST_REQUIRE(setup() == NO_ERROR); + wait_for_worker(); + + // Job() will run. Install process. + timerStart(1); + wait_for_worker(5); + timerStop(); + + // If Timer is not work, wait_for_worker throw exception. + BOOST_REQUIRE(true); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3