mirror of https://github.com/cutefishos/appmotor
				
				
				
			Fixes: NB#217662 - applauncherd depends on WRT
Changes: Library preloading warnings not printed unless --debug is given. RevBy: Jussi Lindpull/1/head
							parent
							
								
									89363301fa
								
							
						
					
					
						commit
						0d74c5c35d
					
				@ -1,27 +0,0 @@
 | 
			
		||||
# Qt support
 | 
			
		||||
include(${QT_USE_FILE})
 | 
			
		||||
 | 
			
		||||
set(LAUNCHER "${CMAKE_HOME_DIRECTORY}/src/launcherlib")
 | 
			
		||||
 | 
			
		||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
 | 
			
		||||
 | 
			
		||||
# Hide all symbols except the ones explicitly exported in the code (like main())
 | 
			
		||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
 | 
			
		||||
 | 
			
		||||
# Set sources
 | 
			
		||||
set(SRC wrtbooster.cpp pluginfactory.cpp eventhandler.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
 | 
			
		||||
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp
 | 
			
		||||
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
 | 
			
		||||
 | 
			
		||||
set(MOC_HDRS eventhandler.h)
 | 
			
		||||
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
 | 
			
		||||
 | 
			
		||||
# Set libraries to be linked.
 | 
			
		||||
link_libraries(${MEEGOTOUCH_LIBRARIES} ${LIBDL} ${QT_QTCORE_LIBRARY})
 | 
			
		||||
 | 
			
		||||
# Set executable
 | 
			
		||||
add_library(wrtbooster MODULE ${SRC} ${MOC_SRC})
 | 
			
		||||
 | 
			
		||||
# Add install rule
 | 
			
		||||
install(FILES libwrtbooster.so DESTINATION /usr/lib/applauncherd/)
 | 
			
		||||
 | 
			
		||||
@ -1,118 +0,0 @@
 | 
			
		||||
#include "eventhandler.h"
 | 
			
		||||
#include "connection.h"
 | 
			
		||||
#include "logger.h"
 | 
			
		||||
#include "booster.h"
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <QtConcurrentRun>
 | 
			
		||||
#include <MApplication>
 | 
			
		||||
 | 
			
		||||
int EventHandler::m_sighupFd[2];
 | 
			
		||||
struct sigaction EventHandler::m_oldSigAction;
 | 
			
		||||
 | 
			
		||||
EventHandler::EventHandler(Booster* parent) : m_item(0), m_parent(parent)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventHandler::runEventLoop()
 | 
			
		||||
{
 | 
			
		||||
    // Exit from event loop when invoker is ready to connect
 | 
			
		||||
    connect(this, SIGNAL(connectionAccepted()), MApplication::instance() , SLOT(quit()));
 | 
			
		||||
 | 
			
		||||
    // Enable theme change handler
 | 
			
		||||
    m_item = new MGConfItem(MEEGOTOUCH_THEME_GCONF_KEY, 0);
 | 
			
		||||
    connect(m_item, SIGNAL(valueChanged()), this, SLOT(notifyThemeChange()));
 | 
			
		||||
 | 
			
		||||
    // Start another thread to listen connection from invoker
 | 
			
		||||
    QtConcurrent::run(this, &EventHandler::accept);
 | 
			
		||||
 | 
			
		||||
    // Create socket pair for SIGHUP
 | 
			
		||||
    bool handlerIsSet = false;
 | 
			
		||||
    if (::socketpair(AF_UNIX, SOCK_STREAM, 0, m_sighupFd))
 | 
			
		||||
    {
 | 
			
		||||
        Logger::logError("EventHandler: Couldn't create HUP socketpair");
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        // Install signal handler e.g. to exit cleanly if launcher dies.
 | 
			
		||||
        // This is a problem because MBooster runs a Qt event loop.
 | 
			
		||||
        EventHandler::setupUnixSignalHandlers();
 | 
			
		||||
 | 
			
		||||
        // Install a socket notifier on the socket
 | 
			
		||||
        connect(new QSocketNotifier(m_sighupFd[1], QSocketNotifier::Read, this),
 | 
			
		||||
                SIGNAL(activated(int)), this, SLOT(handleSigHup()));
 | 
			
		||||
 | 
			
		||||
        handlerIsSet = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Run event loop so MApplication and MApplicationWindow objects can receive notifications
 | 
			
		||||
    MApplication::exec();
 | 
			
		||||
 | 
			
		||||
    // Disable theme change handler
 | 
			
		||||
    disconnect(m_item, 0, this, 0);
 | 
			
		||||
    delete m_item;
 | 
			
		||||
    m_item = NULL;
 | 
			
		||||
 | 
			
		||||
    // Restore signal handlers to previous values
 | 
			
		||||
    if (handlerIsSet)
 | 
			
		||||
    {
 | 
			
		||||
        restoreUnixSignalHandlers();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventHandler::accept()
 | 
			
		||||
{
 | 
			
		||||
    if (m_parent->connection()->accept(m_parent->appData()))
 | 
			
		||||
    {
 | 
			
		||||
        emit connectionAccepted();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventHandler::notifyThemeChange()
 | 
			
		||||
{
 | 
			
		||||
    MApplication::quit();
 | 
			
		||||
    ::_exit(EXIT_SUCCESS);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// All this signal handling code is taken from Qt's Best Practices:
 | 
			
		||||
// http://doc.qt.nokia.com/latest/unix-signals.html
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
void EventHandler::hupSignalHandler(int)
 | 
			
		||||
{
 | 
			
		||||
    char a = 1;
 | 
			
		||||
    ::write(m_sighupFd[0], &a, sizeof(a));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EventHandler::handleSigHup()
 | 
			
		||||
{
 | 
			
		||||
    MApplication::quit();
 | 
			
		||||
    ::_exit(EXIT_SUCCESS);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool EventHandler::setupUnixSignalHandlers()
 | 
			
		||||
{
 | 
			
		||||
    struct sigaction hup;
 | 
			
		||||
 | 
			
		||||
    hup.sa_handler = hupSignalHandler;
 | 
			
		||||
    sigemptyset(&hup.sa_mask);
 | 
			
		||||
    hup.sa_flags |= SA_RESTART;
 | 
			
		||||
 | 
			
		||||
    if (sigaction(SIGHUP, &hup, &m_oldSigAction) > 0)
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool EventHandler::restoreUnixSignalHandlers()
 | 
			
		||||
{
 | 
			
		||||
    if (sigaction(SIGHUP, &m_oldSigAction, 0) > 0)
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
@ -1,67 +0,0 @@
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <MGConfItem>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <tr1/memory>
 | 
			
		||||
#include <QSocketNotifier>
 | 
			
		||||
 | 
			
		||||
using std::tr1::shared_ptr;
 | 
			
		||||
 | 
			
		||||
class Connection;
 | 
			
		||||
class Booster;
 | 
			
		||||
 | 
			
		||||
class EventHandler : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    //! \brief Constructor
 | 
			
		||||
    EventHandler(Booster* parent);
 | 
			
		||||
 | 
			
		||||
    //! \brief Destructor
 | 
			
		||||
    virtual ~EventHandler() {}
 | 
			
		||||
 | 
			
		||||
    void runEventLoop();
 | 
			
		||||
 | 
			
		||||
    //! UNIX signal handler for SIGHUP
 | 
			
		||||
    static void hupSignalHandler(int unused);
 | 
			
		||||
 | 
			
		||||
    //! Setup UNIX signal handlers
 | 
			
		||||
    static bool setupUnixSignalHandlers();
 | 
			
		||||
 | 
			
		||||
    //! Restore UNIX signal handlers to previous values
 | 
			
		||||
    static bool restoreUnixSignalHandlers();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    //! wait for socket connection
 | 
			
		||||
    void accept();
 | 
			
		||||
 | 
			
		||||
    //! Socket pair used to get SIGHUP
 | 
			
		||||
    static int m_sighupFd[2];
 | 
			
		||||
 | 
			
		||||
    //! Socket notifier used for m_sighupFd
 | 
			
		||||
    shared_ptr<QSocketNotifier> m_snHup;
 | 
			
		||||
 | 
			
		||||
    //! Old sigaction struct
 | 
			
		||||
    static struct sigaction m_oldSigAction;
 | 
			
		||||
 | 
			
		||||
    //! GConf item to listen theme change
 | 
			
		||||
    MGConfItem* m_item;
 | 
			
		||||
 | 
			
		||||
    // Parent object
 | 
			
		||||
    Booster* m_parent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
 | 
			
		||||
    //! Qt signal handler for SIGHUP.
 | 
			
		||||
    void handleSigHup();
 | 
			
		||||
 | 
			
		||||
    //! Qt signal handler for theme change
 | 
			
		||||
    void notifyThemeChange();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void connectionAccepted();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@ -1,45 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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 "wrtbooster.h"
 | 
			
		||||
#include <QtCore>
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
    // Create a new plugin instance.
 | 
			
		||||
    Q_DECL_EXPORT void * create()
 | 
			
		||||
    {
 | 
			
		||||
        return new WRTBooster;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Q_DECL_EXPORT char type()
 | 
			
		||||
    {
 | 
			
		||||
        return WRTBooster::type();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Q_DECL_EXPORT const char * socketName()
 | 
			
		||||
    {
 | 
			
		||||
        return WRTBooster::socketName().c_str();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Q_DECL_EXPORT const char * temporaryProcessName()
 | 
			
		||||
    {
 | 
			
		||||
        return WRTBooster::temporaryProcessName().c_str();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -1,109 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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 "wrtbooster.h"
 | 
			
		||||
#include "logger.h"
 | 
			
		||||
#include "connection.h"
 | 
			
		||||
 | 
			
		||||
#include <QtConcurrentRun>
 | 
			
		||||
#include <MApplication>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
#include <mcomponentcache.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_WRT
 | 
			
		||||
#include <wrtcomponentcache.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const string WRTBooster::m_socketId  = "/tmp/boostw";
 | 
			
		||||
const string WRTBooster::m_temporaryProcessName = "booster-w";
 | 
			
		||||
 | 
			
		||||
WRTBooster::WRTBooster()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// All this signal handling code is taken from Qt's Best Practices:
 | 
			
		||||
// http://doc.qt.nokia.com/latest/unix-signals.html
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::socketId() const
 | 
			
		||||
{
 | 
			
		||||
    return m_socketId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool WRTBooster::preload()
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
    MComponentCache::populateForWRTApplication();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_WRT
 | 
			
		||||
    WrtComponentCache::populateCache();
 | 
			
		||||
#endif
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::socketName()
 | 
			
		||||
{
 | 
			
		||||
    return m_socketId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::temporaryProcessName()
 | 
			
		||||
{
 | 
			
		||||
    return m_temporaryProcessName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const string & WRTBooster::boosterTemporaryProcessName() const
 | 
			
		||||
{
 | 
			
		||||
    return temporaryProcessName();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char WRTBooster::type()
 | 
			
		||||
{
 | 
			
		||||
    return 'w';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool WRTBooster::receiveDataFromInvoker(int socketFd)
 | 
			
		||||
{
 | 
			
		||||
    // Setup the conversation channel with the invoker.
 | 
			
		||||
    setConnection(new Connection(socketFd));
 | 
			
		||||
 | 
			
		||||
    EventHandler handler(this);
 | 
			
		||||
    handler.runEventLoop();
 | 
			
		||||
 | 
			
		||||
    // Receive application data from the invoker
 | 
			
		||||
    if(!connection()->receiveApplicationData(appData()))
 | 
			
		||||
    {
 | 
			
		||||
        connection()->close();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Close the connection if exit status doesn't need
 | 
			
		||||
    // to be sent back to invoker
 | 
			
		||||
    if (!connection()->isReportAppExitStatusNeeded())
 | 
			
		||||
    {
 | 
			
		||||
        connection()->close();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,102 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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 WRTBOOSTER_H
 | 
			
		||||
#define WRTBOOSTER_H
 | 
			
		||||
 | 
			
		||||
#include "booster.h"
 | 
			
		||||
#include "eventhandler.h"
 | 
			
		||||
#include <tr1/memory>
 | 
			
		||||
 | 
			
		||||
using std::tr1::shared_ptr;
 | 
			
		||||
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
    \class WRTBooster
 | 
			
		||||
    \brief Booster for web runtime applications running on top of MeeGo Touch.
 | 
			
		||||
 | 
			
		||||
    WRTBooster effectively fills MComponentCache with fresh objects
 | 
			
		||||
    similarly to MBooster. However, the cache content is optimized for
 | 
			
		||||
    web runtime's use.
 | 
			
		||||
 */
 | 
			
		||||
class WRTBooster : public Booster
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
    //! \brief Constructor
 | 
			
		||||
    WRTBooster();
 | 
			
		||||
 | 
			
		||||
    //! \brief Destructor
 | 
			
		||||
    virtual ~WRTBooster() {};
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual bool preload();
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Return the socket name common to all WRTBooster objects.
 | 
			
		||||
     * \return Path to the socket file.
 | 
			
		||||
     */
 | 
			
		||||
    static const string & socketName();
 | 
			
		||||
 | 
			
		||||
    //! Return the process name to be used when booster is not
 | 
			
		||||
    //! yet transformed into a running application
 | 
			
		||||
    static const string & temporaryProcessName();
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual const string & boosterTemporaryProcessName() const;
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual char boosterType() const { return type(); }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * \brief Return a unique character ('d') represtenting the type of WRTBoosters.
 | 
			
		||||
     * \return Type character.
 | 
			
		||||
     */
 | 
			
		||||
    static char type();
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual const string & socketId() const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
 | 
			
		||||
    //! \reimp
 | 
			
		||||
    virtual bool receiveDataFromInvoker(int socketFd);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    //! Disable copy-constructor
 | 
			
		||||
    WRTBooster(const WRTBooster & r);
 | 
			
		||||
 | 
			
		||||
    //! Disable assignment operator
 | 
			
		||||
    WRTBooster & operator= (const WRTBooster & r);
 | 
			
		||||
 | 
			
		||||
    static const string m_socketId;
 | 
			
		||||
 | 
			
		||||
    //! Process name to be used when booster is not
 | 
			
		||||
    //! yet transformed into a running application
 | 
			
		||||
    static const string m_temporaryProcessName;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef UNIT_TEST
 | 
			
		||||
    friend class Ut_WRTBooster;
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // WRTBOOSTER_H
 | 
			
		||||
@ -1,30 +0,0 @@
 | 
			
		||||
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
 | 
			
		||||
set(WRTBOOSTER ${CMAKE_HOME_DIRECTORY}/src/wrtbooster)
 | 
			
		||||
 | 
			
		||||
# Set sources
 | 
			
		||||
set(SRC ut_wrtbooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
 | 
			
		||||
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${WRTBOOSTER}/wrtbooster.cpp ${WRTBOOSTER}/eventhandler.cpp
 | 
			
		||||
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
 | 
			
		||||
 | 
			
		||||
# Set moc headers
 | 
			
		||||
set(MOC_HDRS ut_wrtbooster.h ${WRTBOOSTER}/eventhandler.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} ${WRTBOOSTER})
 | 
			
		||||
 | 
			
		||||
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_wrtbooster ${SRC} ${MOC_SRC} )
 | 
			
		||||
 | 
			
		||||
# Install
 | 
			
		||||
install(PROGRAMS ut_wrtbooster DESTINATION /usr/share/applauncherd-tests/)
 | 
			
		||||
 | 
			
		||||
@ -1,67 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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_wrtbooster.h"
 | 
			
		||||
#include "wrtbooster.h"
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
#include <MComponentCache>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
Ut_WRTBooster::Ut_WRTBooster() :
 | 
			
		||||
    m_subject(new WRTBooster)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
Ut_WRTBooster::~Ut_WRTBooster()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_WRTBooster::initTestCase()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_WRTBooster::cleanupTestCase()
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
void Ut_WRTBooster::testSocketName()
 | 
			
		||||
{
 | 
			
		||||
    QVERIFY(WRTBooster::socketName() == WRTBooster::m_socketId);
 | 
			
		||||
    QVERIFY(m_subject->socketId() == WRTBooster::m_socketId);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Ut_WRTBooster::testType()
 | 
			
		||||
{
 | 
			
		||||
    QVERIFY(WRTBooster::type() == 'w');
 | 
			
		||||
    QVERIFY(m_subject->boosterType() == 'w');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Ut_WRTBooster::testPreload()
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_MCOMPONENTCACHE
 | 
			
		||||
 | 
			
		||||
    m_subject->preload();
 | 
			
		||||
 | 
			
		||||
    const char * argv[] = {"foo"};
 | 
			
		||||
    int argc = 1;
 | 
			
		||||
 | 
			
		||||
    QVERIFY(MComponentCache::mApplication(argc, const_cast<char **>(argv)));
 | 
			
		||||
    QVERIFY(MComponentCache::mApplicationWindow());
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QTEST_APPLESS_MAIN(Ut_WRTBooster);
 | 
			
		||||
@ -1,51 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** 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_WRTBOOSTER_H
 | 
			
		||||
#define UT_WRTBOOSTER_H
 | 
			
		||||
 | 
			
		||||
#include<QtTest/QtTest>
 | 
			
		||||
#include<QObject>
 | 
			
		||||
 | 
			
		||||
#include <tr1/memory>
 | 
			
		||||
 | 
			
		||||
#define UNIT_TEST
 | 
			
		||||
 | 
			
		||||
class WRTBooster;
 | 
			
		||||
 | 
			
		||||
class Ut_WRTBooster : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    Ut_WRTBooster();
 | 
			
		||||
    virtual ~Ut_WRTBooster();
 | 
			
		||||
 | 
			
		||||
private Q_SLOTS:
 | 
			
		||||
    void initTestCase();
 | 
			
		||||
    void cleanupTestCase();
 | 
			
		||||
    void testSocketName();
 | 
			
		||||
    void testType();
 | 
			
		||||
    void testPreload();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::tr1::shared_ptr<WRTBooster> m_subject;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // UT_WRTBOOSTER_H
 | 
			
		||||
@ -1,3 +1,3 @@
 | 
			
		||||
install(PROGRAMS fala_sf_m.sh fala_sf_wrt.sh fala_sf_qt.sh DESTINATION /usr/share/applauncherd-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.py fala_sf_wrt.py fala_sf_qt.py DESTINATION /usr/share/applauncherd-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.sh fala_sf_qt.sh DESTINATION /usr/share/applauncherd-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.py fala_sf_qt.py DESTINATION /usr/share/applauncherd-testscripts/signal-forward)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import commands
 | 
			
		||||
 | 
			
		||||
#Launching application from the script
 | 
			
		||||
os.system("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_wrt.sh &")
 | 
			
		||||
 | 
			
		||||
time.sleep(2)
 | 
			
		||||
st, op = commands.getstatusoutput("pgrep fala_ft_hello")
 | 
			
		||||
 | 
			
		||||
#Killing application with a signal 11 (Segmentation Fault)
 | 
			
		||||
commands.getoutput("kill -10 %s" %op)
 | 
			
		||||
time.sleep(2)
 | 
			
		||||
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
invoker --type=wrt --wait-term /usr/bin/fala_ft_hello.launch
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,3 @@
 | 
			
		||||
install(PROGRAMS fala_sf_m.sh fala_sf_wrt.sh fala_sf_qt.sh DESTINATION /usr/share/applauncherd-M-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.py fala_sf_wrt.py fala_sf_qt.py DESTINATION /usr/share/applauncherd-M-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.sh fala_sf_qt.sh DESTINATION /usr/share/applauncherd-M-testscripts/signal-forward)
 | 
			
		||||
install(PROGRAMS fala_sf_m.py fala_sf_qt.py DESTINATION /usr/share/applauncherd-M-testscripts/signal-forward)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +0,0 @@
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import commands
 | 
			
		||||
 | 
			
		||||
#Launching application from the script
 | 
			
		||||
os.system("/usr/share/applauncherd-M-testscripts/signal-forward/fala_sf_wrt.sh &")
 | 
			
		||||
 | 
			
		||||
time.sleep(2)
 | 
			
		||||
st, op = commands.getstatusoutput("pgrep fala_ft_hello")
 | 
			
		||||
 | 
			
		||||
#Killing application with a signal 11 (Segmentation Fault)
 | 
			
		||||
commands.getoutput("kill -10 %s" %op)
 | 
			
		||||
time.sleep(2)
 | 
			
		||||
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
invoker --type=wrt --wait-term /usr/bin/fala_ft_hello.launch
 | 
			
		||||
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue