summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-29 08:59:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-29 08:59:32 (GMT)
commitc02ef9eb331f03dbd59d2fd938c53b54f5c65cea (patch)
tree93defa0a21c2ecc1261c5d549087916a69cb4f55 /tests/auto
parent60d37c9c2f99ee1b10293c4dbc0264664dd8cad0 (diff)
parent60948c48adc376cefa774bd101de34c60db52dea (diff)
downloadQt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.zip
Qt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.tar.gz
Qt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (25 commits) QNAM: Fix doc rendering of QNetworkRequest remove the connecting thread, and use async call to dbus instead. QScriptValue::construct(): Don't crash if function throws non-Object Network code: Fix code comment spellchecking errors. QNAM: fix build QNAM HTTP: Remove the error() of QHttpNetworkConnection QNAM HTTP: Remove enableEncryption() QNAM HTTP: Remove unused code QNAM HTTP: Move authenticationRequired() to QHttpNetworkReply QNAM HTTP: Move proxyAuthenticationRequired() to QHttpNetworkReply QNAM HTTP: Move cacheCredentials() to QHttpNetworkReply QNAM HTTP: Use sslErrors() from QHttpNetworkReply QNAM HTTP: Remove Wait4AuthState QNAM: Internal function renaming QNAM HTTP: Internal variable spelling mistakes QNAM HTTP: Pause connection when emitting proxy auth signal QNAM HTTP: Also pause connection when emitting sslErrors() QNAM HTTP: Also resume uploads after connection pause QNAM HTTP: Process authenticationRequired() from HTTP properly QNAM HTTP: Pause sockets while emitting to user code. ...
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp54
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp25
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h1
3 files changed, 45 insertions, 35 deletions
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 89f608e..4a32a5a 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -57,7 +57,7 @@ public:
public Q_SLOTS:
void finishedReply();
void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail);
- void challenge401(const QHttpNetworkRequest &request, QAuthenticator *authenticator, const QHttpNetworkConnection *connection);
+ void challenge401(const QHttpNetworkRequest &request, QAuthenticator *authenticator);
#ifndef QT_NO_OPENSSL
void sslErrors(const QList<QSslError> &errors);
#endif
@@ -175,11 +175,9 @@ void tst_QHttpNetworkConnection::head()
QFETCH(QString, statusString);
QFETCH(int, contentLength);
- QHttpNetworkConnection connection(host);
+ QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Head);
@@ -235,11 +233,9 @@ void tst_QHttpNetworkConnection::get()
QFETCH(int, contentLength);
QFETCH(int, downloadSize);
- QHttpNetworkConnection connection(host);
+ QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
QHttpNetworkRequest request(protocol + host + path);
@@ -315,11 +311,9 @@ void tst_QHttpNetworkConnection::put()
QFETCH(QString, data);
QFETCH(bool, succeed);
- QHttpNetworkConnection connection(host);
+ QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Put);
@@ -336,8 +330,6 @@ void tst_QHttpNetworkConnection::put()
connect(reply, SIGNAL(finished()), SLOT(finishedReply()));
connect(reply, SIGNAL(finishedWithError(QNetworkReply::NetworkError, const QString &)),
SLOT(finishedWithError(QNetworkReply::NetworkError, const QString &)));
- connect(&connection, SIGNAL(error(QNetworkReply::NetworkError, const QString &)),
- SLOT(finishedWithError(QNetworkReply::NetworkError, const QString &)));
QTime stopWatch;
stopWatch.start();
@@ -407,11 +399,9 @@ void tst_QHttpNetworkConnection::post()
QFETCH(int, contentLength);
QFETCH(int, downloadSize);
- QHttpNetworkConnection connection(host);
+ QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Post);
@@ -496,14 +486,14 @@ void tst_QHttpNetworkConnection::_connect()
}
void tst_QHttpNetworkConnection::challenge401(const QHttpNetworkRequest &request,
- QAuthenticator *authenticator,
- const QHttpNetworkConnection *connection)
+ QAuthenticator *authenticator)
{
Q_UNUSED(request)
- Q_UNUSED(connection)
- QHttpNetworkConnection *c = qobject_cast<QHttpNetworkConnection*>(sender());
- if (connection) {
+ QHttpNetworkReply *reply = qobject_cast<QHttpNetworkReply*>(sender());
+ if (reply) {
+ QHttpNetworkConnection *c = reply->connection();
+
QVariant val = c->property("setCredentials");
if (val.toBool()) {
QVariant user = c->property("username");
@@ -549,17 +539,15 @@ void tst_QHttpNetworkConnection::get401()
QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
- connect(&connection, SIGNAL(authenticationRequired(const QHttpNetworkRequest&, QAuthenticator *, const QHttpNetworkConnection*)),
- SLOT(challenge401(const QHttpNetworkRequest&, QAuthenticator *, const QHttpNetworkConnection*)));
connection.setProperty("setCredentials", setCredentials);
connection.setProperty("username", username);
connection.setProperty("password", password);
QHttpNetworkRequest request(protocol + host + path);
QHttpNetworkReply *reply = connection.sendRequest(request);
+ connect(reply, SIGNAL(authenticationRequired(const QHttpNetworkRequest&, QAuthenticator *)),
+ SLOT(challenge401(const QHttpNetworkRequest&, QAuthenticator *)));
finishedCalled = false;
finishedWithErrorCalled = false;
@@ -618,11 +606,9 @@ void tst_QHttpNetworkConnection::compression()
QFETCH(bool, autoCompress);
QFETCH(QString, contentCoding);
- QHttpNetworkConnection connection(host);
+ QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QCOMPARE(connection.isEncrypted(), encrypt);
QHttpNetworkRequest request(protocol + host + path);
@@ -668,8 +654,10 @@ void tst_QHttpNetworkConnection::sslErrors(const QList<QSslError> &errors)
{
Q_UNUSED(errors)
- QHttpNetworkConnection *connection = qobject_cast<QHttpNetworkConnection*>(sender());
- if (connection) {
+ QHttpNetworkReply *reply = qobject_cast<QHttpNetworkReply*>(sender());
+ if (reply) {
+ QHttpNetworkConnection *connection = reply->connection();
+
QVariant val = connection->property("ignoreFromSignal");
if (val.toBool())
connection->ignoreSslErrors();
@@ -711,17 +699,15 @@ void tst_QHttpNetworkConnection::ignoresslerror()
QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
if (ignoreInit)
connection.ignoreSslErrors();
QCOMPARE(connection.isEncrypted(), encrypt);
- connect(&connection, SIGNAL(sslErrors(const QList<QSslError>&)),
- SLOT(sslErrors(const QList<QSslError>&)));
connection.setProperty("ignoreFromSignal", ignoreFromSignal);
QHttpNetworkRequest request(protocol + host + path);
QHttpNetworkReply *reply = connection.sendRequest(request);
+ connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)),
+ SLOT(sslErrors(const QList<QSslError>&)));
finishedWithErrorCalled = false;
@@ -769,8 +755,6 @@ void tst_QHttpNetworkConnection::nossl()
QHttpNetworkConnection connection(host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
- if (encrypt)
- connection.enableEncryption();
QHttpNetworkRequest request(protocol + host + path);
QHttpNetworkReply *reply = connection.sendRequest(request);
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 83a3388..639df36 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2739,6 +2739,31 @@ void tst_QScriptValue::construct()
QVERIFY(!QScriptValue(QScriptValue::NullValue).construct().isValid());
}
+void tst_QScriptValue::construct_constructorThrowsPrimitive()
+{
+ QScriptEngine eng;
+ QScriptValue fun = eng.evaluate("(function() { throw 123; })");
+ QVERIFY(fun.isFunction());
+ // construct(QScriptValueList)
+ {
+ QScriptValue ret = fun.construct();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), 123.0);
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
+ eng.clearExceptions();
+ }
+ // construct(QScriptValue)
+ {
+ QScriptValue ret = fun.construct(eng.newArray());
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), 123.0);
+ QVERIFY(eng.hasUncaughtException());
+ QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
+ eng.clearExceptions();
+ }
+}
+
void tst_QScriptValue::lessThan_old()
{
QScriptEngine eng;
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index 8bfaa6a..462749a 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -219,6 +219,7 @@ private slots:
void getSetScriptClass();
void call();
void construct();
+ void construct_constructorThrowsPrimitive();
void castToPointer();
void prettyPrinter_data();
void prettyPrinter();