From 473de0fb27052aff62e4b391feb1b6447f83ec41 Mon Sep 17 00:00:00 2001 From: Janusz Kozerski Date: Fri, 25 Sep 2015 14:47:34 +0200 Subject: Add popup Since Notification framework doesn't support system daemons, the cert-checker's internal popup should be provided. Add implementation of popup binary - /usr/bin/cert-checker-popup Cert-checker forks(), execs a popup binary, waits for popup termination, and then reads user response from pipe. Change-Id: Ie2e70f661feb1f262841d59a1b4c6a7ec49901f9 --- tests/CMakeLists.txt | 6 ++++-- tests/popup_test.cpp | 14 ++++++++++---- tests/stubs_.cpp | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ef836cd..511aeb9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,13 +1,14 @@ PKG_CHECK_MODULES(CERT_CHECKER_TESTS_DEP REQUIRED + capi-appfw-application cert-svc-vcore + db-util dbus-1 dbus-glib-1 - db-util + elementary glib-2.0 gio-2.0 icu-i18n - notification key-manager libsystemd-journal libtzplatform-config @@ -76,6 +77,7 @@ SET(CERT_CHECKER_POPUP_TEST_SOURCES ${CERT_CHECKER_TESTS_SRC_PATH}/popup_test.cpp # cert-checker ${CERT_CHECKER_SRC_PATH}/app.cpp + ${CERT_CHECKER_SRC_PATH}/ui/popup-runner.cpp ${CERT_CHECKER_SRC_PATH}/ui/UIBackend.cpp # logs ${CERT_CHECKER_SRC_PATH}/log/log.cpp diff --git a/tests/popup_test.cpp b/tests/popup_test.cpp index e2e1e3d..d08747e 100644 --- a/tests/popup_test.cpp +++ b/tests/popup_test.cpp @@ -25,13 +25,19 @@ using namespace CCHECKER; -int main(void) +int main(int argc, char** argv) { - LogDebug("Cert-checker start!"); + LogDebug("Cert-checker popup-test start!"); + + int timeout = 60; + if (argc > 1) { + timeout = atoi(argv[1]); + } + LogDebug("popup-test timeout: " << timeout); setlocale(LC_ALL, ""); - UI::UIBackend ui(20); // timeout 20 seconds + UI::UIBackend ui(timeout); app_t app(std::string("test_APP_ID"), std::string("test PKG ID"), @@ -40,6 +46,6 @@ int main(void) ui.call_popup(app); - LogDebug("Cert-checker exit!"); + LogDebug("Cert-checker popup-test exit!"); return 0; } diff --git a/tests/stubs_.cpp b/tests/stubs_.cpp index b475690..9eb8cfa 100644 --- a/tests/stubs_.cpp +++ b/tests/stubs_.cpp @@ -112,8 +112,7 @@ void DB::SqlQuery::get_app_list(std::list &apps_buffer) // UI UI::UIBackend::UIBackend(int timeout) : - m_notification(nullptr), - m_responseTimeout(timeout) + m_responseTimeout(timeout) {} UI::UIBackend::~UIBackend() -- cgit v1.2.3