diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-12-20 15:46:17 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 15:48:52 +0100 |
commit | d0096381d2229db897dbd44f7ee476d4ed03a5f7 (patch) | |
tree | db46c8449d8814b61224c0b720ed5041fce5b2f7 | |
parent | 9697e2af142a2c7751cdda5c5807c9fe74dee994 (diff) |
qdeclarativexmlhttprequest: Stabilize, ensure deletion of server.
Introduce QScopedPointer to make sure the server is also deleted in
case the test fails thus suppressing follow-up errors caused by
the port still being in use by a leaked server.
Change-Id: I9fd8a96ea5aba42487df8f22bc9a79917b9d8c16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index da5431c50b..abefa30108 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -43,6 +43,7 @@ #include <QDeclarativeEngine> #include <QDeclarativeComponent> #include <QDebug> +#include <QScopedPointer> #include <QNetworkCookieJar> #include "testhttpserver.h" #include "../../shared/util.h" @@ -254,9 +255,9 @@ void tst_qdeclarativexmlhttprequest::open() QFETCH(QString, url); QFETCH(bool, remote); - TestHTTPServer *server = 0; + QScopedPointer<TestHTTPServer> server; // ensure deletion in case test fails if (remote) { - server = new TestHTTPServer(SERVER_PORT); + server.reset(new TestHTTPServer(SERVER_PORT)); QVERIFY(server->isValid()); QVERIFY(server->wait(TEST_FILE("open_network.expect"), TEST_FILE("open_network.reply"), @@ -278,7 +279,6 @@ void tst_qdeclarativexmlhttprequest::open() QTRY_VERIFY(object->property("dataOK").toBool() == true); - delete server; delete object; } |