summaryrefslogtreecommitdiff
path: root/tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp')
-rw-r--r--tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp b/tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp
new file mode 100644
index 0000000..594b07f
--- /dev/null
+++ b/tests/test-performance/test-resourceqt-performance-collector/ResultsUpload.cpp
@@ -0,0 +1,39 @@
+/*
+ * ResultsUpload.cpp
+ *
+ * Created on: May 14, 2010
+ * Author: wlk
+ */
+
+#include "ResultsUpload.h"
+
+ResultsUpload::ResultsUpload(QString fileToUpload)
+{
+ networkManager = new QNetworkAccessManager(this);
+ uploadFile = new QFile(fileToUpload);
+ connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+ uploadFile->open(QIODevice::ReadOnly);
+
+/* QNetworkAccessManager man;
+ QFile* f = new QFile("/usr/lib/libresourceqt-tests/test-performance.ini");
+ f->open(QIODevice::ReadOnly);
+ man.post(QNetworkRequest(QUrl("http://policy.research.nokia.com/performance/upload.php")), f);*/
+ networkManager->post(QNetworkRequest(QUrl("http://policy.research.nokia.com/performance/upload.php")), uploadFile);
+}
+
+ResultsUpload::~ResultsUpload()
+{
+ if( networkManager )
+ delete networkManager;
+
+ if( uploadFile )
+ {
+ uploadFile->close();
+ delete uploadFile;
+ }
+}
+
+void ResultsUpload::replyFinished(QNetworkReply* reply)
+{
+ QMetaObject::invokeMethod(QCoreApplication::instance(), "quit");
+}