New: Unit tests for EBooster added.

pull/1/head
Jussi Lind 15 years ago
parent 28d852e015
commit 67edb111cf

@ -4,7 +4,7 @@ usr/share/applauncherd-tests/ut_boosterfactory
usr/share/applauncherd-tests/ut_daemon
usr/share/applauncherd-tests/ut_connection
usr/share/applauncherd-tests/ut_dbooster
usr/share/applauncherd-tests/ut_ebooster
usr/share/applauncherd-tests/ut_mbooster
usr/share/applauncherd-tests/ut_qtbooster
usr/share/applauncherd-tests/ut_socketmanager

@ -12,11 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
# Set sources
set(SRC ebooster.cpp pluginfactory.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp
${COMMON}/eventhandler.cpp)
set(MOC_HDRS ${COMMON}/eventhandler.h)
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
# Set libraries to be linked.
link_libraries(${MEEGOTOUCH_LIBRARIES} ${LIBDL} ${QT_QTCORE_LIBRARY})

@ -21,13 +21,10 @@
#define EBOOSTER_H
#include "booster.h"
#include "eventhandler.h"
#include <tr1/memory>
using std::tr1::shared_ptr;
#include <signal.h>
/*!
\class EBooster
\brief EBooster is a "booster" that only exec()'s the given binary.
@ -94,15 +91,6 @@ private:
//! wait for socket connection
void accept();
private slots:
//! Qt signal handler for SIGHUP.
void handleSigHup();
//! Qt signal handler for theme change
void notifyThemeChange();
#ifdef UNIT_TEST
friend class Ut_EBooster;
#endif

@ -3,6 +3,7 @@ add_subdirectory(ut_boosterfactory)
add_subdirectory(ut_connection)
add_subdirectory(ut_daemon)
add_subdirectory(ut_dbooster)
add_subdirectory(ut_ebooster)
add_subdirectory(ut_mbooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_socketmanager)

@ -46,6 +46,10 @@
<step expected_result="0">/usr/share/applauncherd-tests/ut_qtbooster</step>
</case>
<case name="EBooster" type="Functional" description="Unit tests for EBooster class" level="Component" timeout="20">
<step expected_result="0">su - user -c 'source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_ebooster'</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

@ -0,0 +1,32 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
set(EBOOSTER ${CMAKE_HOME_DIRECTORY}/src/ebooster)
set(COMMON "${CMAKE_HOME_DIRECTORY}/src/common")
# Set sources
set(SRC ut_ebooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp
${LAUNCHER}/logger.cpp ${EBOOSTER}/ebooster.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
# Set moc headers
set(MOC_HDRS ut_ebooster.h)
# Run moc
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Enable test library
set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER} ${EBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})
add_executable(ut_ebooster ${SRC} ${MOC_SRC} )
# Install
install(PROGRAMS ut_ebooster DESTINATION /usr/share/applauncherd-tests/)

@ -0,0 +1,53 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "ut_ebooster.h"
#include "ebooster.h"
Ut_EBooster::Ut_EBooster() :
m_subject(new EBooster)
{}
Ut_EBooster::~Ut_EBooster()
{}
void Ut_EBooster::initTestCase()
{}
void Ut_EBooster::cleanupTestCase()
{}
void Ut_EBooster::testSocketName()
{
QVERIFY(EBooster::socketName() == EBooster::m_socketId);
QVERIFY(m_subject->socketId() == EBooster::m_socketId);
}
void Ut_EBooster::testType()
{
QVERIFY(EBooster::type() == 'e');
QVERIFY(m_subject->boosterType() == 'e');
}
void Ut_EBooster::testPreload()
{
QVERIFY(m_subject->preload());
}
QTEST_APPLESS_MAIN(Ut_EBooster);

@ -0,0 +1,51 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef UT_EBOOSTER_H
#define UT_EBOOSTER_H
#include<QtTest/QtTest>
#include<QObject>
#include <tr1/memory>
#define UNIT_TEST
class EBooster;
class Ut_EBooster : public QObject
{
Q_OBJECT
public:
Ut_EBooster();
virtual ~Ut_EBooster();
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testSocketName();
void testType();
void testPreload();
private:
std::tr1::shared_ptr<EBooster> m_subject;
};
#endif // UT_EBOOSTER_H
Loading…
Cancel
Save