summaryrefslogtreecommitdiff
path: root/tests/test-security-without-aegis-token/test-security.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-09-10 13:34:20 +0300
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-09-10 13:34:20 +0300
commitb8247d868582de3a5655bf83f54a25ab5b5112e9 (patch)
tree282d5ae54d6b54faee9ba1a0f7cbd5e98ba42ceb /tests/test-security-without-aegis-token/test-security.cpp
parentf6bc677d84a93a3d1ccd9179ea0f75d8599ed600 (diff)
parenta7761546eddf14689984ad95f5f6c3aeb4024362 (diff)
Merge remote branch 'origin/master'
Diffstat (limited to 'tests/test-security-without-aegis-token/test-security.cpp')
-rw-r--r--tests/test-security-without-aegis-token/test-security.cpp47
1 files changed, 47 insertions, 0 deletions
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"