summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/logic_.cpp10
-rw-r--r--tests/logic_.h15
-rw-r--r--tests/test_logic.cpp17
3 files changed, 42 insertions, 0 deletions
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()