Merge commit 'origin/master' into my-master

pull/1/head
Oskari Timperi 15 years ago
commit 912a2fa8f1

@ -1,6 +1,7 @@
usr/share/applauncherd-tests/tests.xml
usr/share/applauncherd-tests/ut_daemon
usr/share/applauncherd-tests/ut_booster
usr/share/applauncherd-tests/ut_boosterfactory
usr/share/applauncherd-tests/ut_connection
usr/share/applauncherd-tests/ut_mbooster
usr/share/applauncherd-tests/ut_qtbooster

@ -9,8 +9,9 @@ set(SRC appdata.cpp booster.cpp boosterfactory.cpp connection.cpp daemon.cpp mbo
# Find libdl
find_library(LIBDL NAMES dl)
# Set libraries to be linked
link_libraries(${QT_LIBRARIES} ${MEEGOTOUCH_LIBRARIES} ${LIBDL})
# Set libraries to be linked. Shared libraries to be preloaded are not linked in anymore,
# but dlopen():ed and listed in src/launcher/preload.h instead.
link_libraries(${MEEGOTOUCH_LIBRARIES} ${LIBDL})
# Set executable
add_executable(applauncherd.bin ${SRC})

@ -1,5 +1,6 @@
add_subdirectory(ut_daemon)
add_subdirectory(ut_booster)
add_subdirectory(ut_boosterfactory)
add_subdirectory(ut_mbooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_wrtbooster)

@ -26,6 +26,10 @@
<set name="booster-tests" description="Booster unit tests" feature="AF MBooster for Launcher daemon" requirement="300195" >
<case name="BoosterFactory" type="Functional" description="Unit tests for BoosterFactory class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_boosterfactory</step>
</case>
<case name="Booster" type="Functional" description="Unit tests for Booster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_booster</step>
</case>

@ -0,0 +1,27 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcher)
# Set sources
set(SRC ut_boosterfactory.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/mbooster.cpp ${LAUNCHER}/qtbooster.cpp ${LAUNCHER}/wrtbooster.cpp ${LAUNCHER}/boosterfactory.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp)
# Set moc headers
set(MOC_HDRS ut_boosterfactory.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})
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_boosterfactory ${SRC} ${MOC_SRC})
# Install
install(PROGRAMS ut_boosterfactory DESTINATION /usr/share/applauncherd-tests/)

@ -0,0 +1,100 @@
/***************************************************************************
**
** Copyright (C) 2010 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_boosterfactory.h"
#include "boosterfactory.h"
#include "booster.h"
#include "mbooster.h"
#include "qtbooster.h"
#include "wrtbooster.h"
Ut_BoosterFactory::Ut_BoosterFactory()
{}
Ut_BoosterFactory::~Ut_BoosterFactory()
{}
void Ut_BoosterFactory::initTestCase()
{
}
void Ut_BoosterFactory::cleanupTestCase()
{}
void Ut_BoosterFactory::testCreate()
{
Booster * booster = BoosterFactory::create('q');
QVERIFY(dynamic_cast<QtBooster *>(booster));
delete booster;
booster = BoosterFactory::create('m');
QVERIFY(dynamic_cast<MBooster *>(booster));
delete booster;
booster = BoosterFactory::create('w');
QVERIFY(dynamic_cast<WRTBooster *>(booster));
delete booster;
for (int i = 0; i < 256; i++)
{
unsigned char t = static_cast<unsigned char>(i);
if (t != 'q' && t != 'm' && t != 'w')
{
QVERIFY(!BoosterFactory::create(t));
}
}
}
void Ut_BoosterFactory::testSetProcessIdToBooster()
{
BoosterFactory::setProcessIdToBooster('q', 123);
QVERIFY(QtBooster::processId() == 123);
BoosterFactory::setProcessIdToBooster('m', 234);
QVERIFY(MBooster::processId() == 234);
BoosterFactory::setProcessIdToBooster('w', 345);
QVERIFY(WRTBooster::processId() == 345);
}
void Ut_BoosterFactory::testGetBoosterTypeForPid()
{
BoosterFactory::setProcessIdToBooster('q', 1);
BoosterFactory::setProcessIdToBooster('m', 2);
BoosterFactory::setProcessIdToBooster('w', 3);
QVERIFY(BoosterFactory::getBoosterTypeForPid(1) == 'q');
QVERIFY(BoosterFactory::getBoosterTypeForPid(2) == 'm');
QVERIFY(BoosterFactory::getBoosterTypeForPid(3) == 'w');
QVERIFY(BoosterFactory::getBoosterTypeForPid(0) == 0);
for (int i = 0; i < 256; i++)
{
unsigned char t = static_cast<unsigned char>(i);
if (t != 'q' && t != 'm' && t != 'w')
{
BoosterFactory::setProcessIdToBooster(t, 1000);
QVERIFY(BoosterFactory::getBoosterTypeForPid(1000) == 0);
}
}
}
QTEST_APPLESS_MAIN(Ut_BoosterFactory);

@ -0,0 +1,46 @@
/***************************************************************************
**
** Copyright (C) 2010 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_BOOSTERFACTORY_H
#define UT_BOOSTERFACTORY_H
#include<QtTest/QtTest>
#include<QObject>
#define UNIT_TEST
class BoosterFactory;
class Ut_BoosterFactory : public QObject
{
Q_OBJECT
public:
Ut_BoosterFactory();
virtual ~Ut_BoosterFactory();
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testCreate();
void testSetProcessIdToBooster();
void testGetBoosterTypeForPid();
};
#endif // UT_BOOSTERFACTORY_H
Loading…
Cancel
Save