Test your websites with this simple GUI based scripted webtester. Generate simple testscripts directly from surfng on the webpage, enhance them with your commands, with variables, loops, checks, … and finally run automated web tests.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
9.1 KiB

10 years ago
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef __NETWORKACCESS_MANAGER_HXX__
#define __NETWORKACCESS_MANAGER_HXX__
#include <QNetworkAccessManager>
#include <QNetworkReply>
10 years ago
#include <QNetworkConfiguration>
#include <QNetworkProxy>
class NetworkAccessManager: public QNetworkAccessManager {
Q_OBJECT;
public:
NetworkAccessManager(QObject* parent = 0): QNetworkAccessManager(parent) {
//log(__PRETTY_FUNCTION__);
10 years ago
connect(this,
SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
SLOT(authenticationRequiredLog(QNetworkReply*, QAuthenticator*)));
connect(this,
SIGNAL(encrypted(QNetworkReply*)),
SLOT(encryptedLog(QNetworkReply*)));
connect(this,
SIGNAL(finished(QNetworkReply*)),
SLOT(finishedLog(QNetworkReply*)));
connect(this,
SIGNAL(networkAccessibleChanged
(QNetworkAccessManager::NetworkAccessibility)),
SLOT(networkAccessibleChangedLog
(QNetworkAccessManager::NetworkAccessibility)));
connect(this,
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
QAuthenticator*)),
SLOT(proxyAuthenticationRequiredLog(const QNetworkProxy&,
QAuthenticator*)));
connect(this,
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
SLOT(sslErrorsLog(QNetworkReply*, const QList<QSslError>&)));
}
virtual ~NetworkAccessManager() {
//log(__PRETTY_FUNCTION__);
10 years ago
}
QNetworkConfiguration activeConfiguration() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::activeConfiguration();
}
QAbstractNetworkCache* cache() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::cache();
}
void clearAccessCache() {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::clearAccessCache();
}
QNetworkConfiguration configuration() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::configuration();
}
void connectToHost(const QString& hostName, quint16 port = 80) {
//log(__PRETTY_FUNCTION__);
10 years ago
QNetworkAccessManager::connectToHost(hostName, port);
}
void connectToHostEncrypted(const QString& hostName, quint16 port = 443,
const QSslConfiguration& sslConfiguration
= QSslConfiguration::defaultConfiguration()) {
//log(__PRETTY_FUNCTION__);
10 years ago
QNetworkAccessManager::connectToHostEncrypted(hostName, port,
sslConfiguration);
}
QNetworkCookieJar* cookieJar() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::cookieJar();
}
QNetworkReply* deleteResource(const QNetworkRequest & request) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::deleteResource(request);
}
QNetworkReply* get(const QNetworkRequest& request) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::get(request);
}
QNetworkReply* head(const QNetworkRequest& request) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::head(request);
}
NetworkAccessibility networkAccessible() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::networkAccessible();
}
QNetworkReply* post(const QNetworkRequest & request, QIODevice * data) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::post(request, data);
}
QNetworkReply* post(const QNetworkRequest& request,
const QByteArray& data) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::post(request, data);
}
QNetworkReply* post(const QNetworkRequest& request,
QHttpMultiPart* multiPart) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::post(request, multiPart);
}
QNetworkProxy proxy() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::proxy();
}
QNetworkProxyFactory* proxyFactory() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::proxyFactory();
}
QNetworkReply* put(const QNetworkRequest& request, QIODevice* data) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::put(request, data);
}
QNetworkReply* put(const QNetworkRequest& request,
QHttpMultiPart* multiPart) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::put(request, multiPart);
}
QNetworkReply* put(const QNetworkRequest& request, const QByteArray& data) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::put(request, data);
}
QNetworkReply* sendCustomRequest(const QNetworkRequest& request,
const QByteArray& verb,
QIODevice* data = 0) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::sendCustomRequest(request, verb, data);
}
void setCache(QAbstractNetworkCache* cache) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setCache(cache);
}
void setConfiguration(const QNetworkConfiguration& config) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setConfiguration(config);
}
void setCookieJar(QNetworkCookieJar* cookieJar) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setCookieJar(cookieJar);
}
void setNetworkAccessible(NetworkAccessibility accessible) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setNetworkAccessible(accessible);
}
void setProxy(const QNetworkProxy& proxy) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setProxy(proxy);
}
void setProxyFactory(QNetworkProxyFactory* factory) {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::setProxyFactory(factory);
}
QStringList supportedSchemes() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::supportedSchemes();
}
Q_SIGNALS:
void authenticationRequired(QNetworkReply*, QAuthenticator*);
void encrypted(QNetworkReply*);
void finished(QNetworkReply*);
void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility);
void proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*);
void sslErrors(QNetworkReply*, const QList<QSslError>&);
void log(QString) const;
protected:
virtual QNetworkReply* createRequest(Operation op,
const QNetworkRequest& req,
QIODevice* outgoingData = 0) {
//log(__PRETTY_FUNCTION__);
10 years ago
switch (op) {
case QNetworkAccessManager::HeadOperation: break;
case QNetworkAccessManager::GetOperation: break;
case QNetworkAccessManager::PutOperation: break;
case QNetworkAccessManager::PostOperation: break;
case QNetworkAccessManager::DeleteOperation: break;
case QNetworkAccessManager::CustomOperation: break;
case QNetworkAccessManager::UnknownOperation: break;
}
QNetworkReply* reply
(QNetworkAccessManager::createRequest(op, req, outgoingData));
connect(reply, SIGNAL(encrypted()), SLOT(encryptedLog()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
SLOT(errorLog(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(finished()), SLOT(finishedLog()));
connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)),
SLOT(sslErrorsLog(const QList<QSslError>&)));
return reply;
10 years ago
}
protected Q_SLOTS:
QStringList supportedSchemesImplementation() const {
//log(__PRETTY_FUNCTION__);
10 years ago
return QNetworkAccessManager::supportedSchemesImplementation();
}
private Q_SLOTS:
void errorLog(QNetworkReply::NetworkError) {
log("**** Network Error: "
+ dynamic_cast<QNetworkReply*>(sender())->errorString());
}
10 years ago
void authenticationRequiredLog(QNetworkReply*, QAuthenticator*) {
//log(__PRETTY_FUNCTION__);
}
void encryptedLog() {
//log(__PRETTY_FUNCTION__);
10 years ago
}
void encryptedLog(QNetworkReply*) {
//log(__PRETTY_FUNCTION__);
}
void finishedLog() {
//log(__PRETTY_FUNCTION__);
10 years ago
}
void finishedLog(QNetworkReply*) {
//log(__PRETTY_FUNCTION__);
10 years ago
}
void networkAccessibleChangedLog
(QNetworkAccessManager::NetworkAccessibility) {
//log(__PRETTY_FUNCTION__);
10 years ago
}
void proxyAuthenticationRequiredLog(const QNetworkProxy&, QAuthenticator*) {
//log(__PRETTY_FUNCTION__);
}
void sslErrorsLog(const QList<QSslError>& errors) {
Q_FOREACH(const QSslError& error, errors)
log("**** SSL-Error: "+error.errorString());
10 years ago
}
void sslErrorsLog(QNetworkReply*, const QList<QSslError>&) {
//log(__PRETTY_FUNCTION__);
10 years ago
}
};
#endif