diff options
author | Vsevolod Buzinov <ext-vsevolod.buzinov@nokia.com> | 2010-08-31 17:33:38 +0300 |
---|---|---|
committer | Vsevolod Buzinov <ext-vsevolod.buzinov@nokia.com> | 2010-08-31 17:33:38 +0300 |
commit | a7761546eddf14689984ad95f5f6c3aeb4024362 (patch) | |
tree | 45dc6ab1318d448db1fb5d682c3d96cd9fa3f276 /tests/test-security-without-aegis-token | |
parent | e259ac49bc79329e2b6736eab08f666e3ab87615 (diff) |
Added security-related changes such as error signal in resource engine
Diffstat (limited to 'tests/test-security-without-aegis-token')
-rw-r--r-- | tests/test-security-without-aegis-token/test-security-without-aegis-token.pro | 20 | ||||
-rw-r--r-- | tests/test-security-without-aegis-token/test-security.cpp | 47 |
2 files changed, 67 insertions, 0 deletions
diff --git a/tests/test-security-without-aegis-token/test-security-without-aegis-token.pro b/tests/test-security-without-aegis-token/test-security-without-aegis-token.pro new file mode 100644 index 0000000..fd8b042 --- /dev/null +++ b/tests/test-security-without-aegis-token/test-security-without-aegis-token.pro @@ -0,0 +1,20 @@ +include(../../common.pri) +TEMPLATE = app +TARGET = test-security-without-aegis-token +QT = testlib core +CONFIG -= app_bundle +DEPENDPATH += $${POLICY} $${BASE}/src . +INCLUDEPATH += $${LIBRESOURCEQT}/src $${LIBRESOURCEQT}/include $${LIBRESOURCEINC} $${LIBDBUSQEVENTLOOP} + +# Input +SOURCES += test-security.cpp + +LIBS += -L$${LIBDBUSQEVENTLOOP}/build -L$${LIBRESOURCEQT}/build -ldbus-qeventloop -lresourceqt + +# Install options +# Install options +target.path = /usr/lib/libresourceqt-tests/ +#target.files = test-security-without-aegis-token + +INSTALLS = target + diff --git a/tests/test-security-without-aegis-token/test-security.cpp b/tests/test-security-without-aegis-token/test-security.cpp new file mode 100644 index 0000000..1a90009 --- /dev/null +++ b/tests/test-security-without-aegis-token/test-security.cpp @@ -0,0 +1,47 @@ +#include "qt4/policy/resource-set.h" +#include <cstdio> +#include <cstdlib> +#include <QCoreApplication> + +using namespace ResourcePolicy; + +class TestSecurity: public QObject +{ + Q_OBJECT + +public: + void testSecurity() { + + ResourceSet *resourceSet = new ResourceSet("call", this); + resourceSet->addResource(ResourcePolicy::AudioRecorderType); + + connect(resourceSet, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>&)), + this, SLOT(resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>&))); + + connect(resourceSet, SIGNAL(errorCallback(quint32, const char*)), this, SLOT(errorCallback(quint32, const char*))); + + resourceSet->acquire(); + } + +private slots: + void resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>& /*grantedOptionalResList*/) { + printf(">>> resource acquired\n"); + exit(0); + } + + void errorCallback(quint32 code, const char* message) { + printf(">>> error %u, %s\n", code, message); + exit(1); + } +}; + +int main(int argc, char* argv[]) { + QCoreApplication app(argc, argv); + + TestSecurity *test = new TestSecurity(); + test->testSecurity(); + + return app.exec(); +} + +#include "test-security.moc" |