2011-05-04 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2011 19:00:43 +0000 (19:00 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2011 19:00:43 +0000 (19:00 +0000)
        Reviewed by Benjamin Poulain.

        [Qt] Fix signals emitted in FakeReply used in autotests
        https://bugs.webkit.org/show_bug.cgi?id=60049

        The signals emitted for each case of FakeReply were swapped (error case
        emitting metaDataChanged() and redirect case emitting error()). Emitting
        readyRead() is not necessary.

        * tests/qwebframe/tst_qwebframe.cpp:
        (FakeReply::FakeReply):
        Choose the different continue function for each case of FakeReply. This removes
        the need of the if-statement in timeout() and let us replace timeout() with two
        simpler functions.

        (FakeReply::continueRedirect):
        (FakeReply::continueError):
        Continuation cases, emitting the minimal set of signals needed for each case.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85772 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/qt/ChangeLog
Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp

index 1933ea3..4faa223 100644 (file)
@@ -1,3 +1,24 @@
+2011-05-04  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Reviewed by Benjamin Poulain.
+
+        [Qt] Fix signals emitted in FakeReply used in autotests
+        https://bugs.webkit.org/show_bug.cgi?id=60049
+
+        The signals emitted for each case of FakeReply were swapped (error case
+        emitting metaDataChanged() and redirect case emitting error()). Emitting
+        readyRead() is not necessary.
+
+        * tests/qwebframe/tst_qwebframe.cpp:
+        (FakeReply::FakeReply):
+        Choose the different continue function for each case of FakeReply. This removes
+        the need of the if-statement in timeout() and let us replace timeout() with two
+        simpler functions.
+
+        (FakeReply::continueRedirect):
+        (FakeReply::continueError):
+        Continuation cases, emitting the minimal set of signals needed for each case.
+
 2011-05-03  Julien Chaffraix  <jchaffraix@codeaurora.org>
 
         Reviewed by Dimitri Glazkov.
index 3b9324d..6bfb50f 100644 (file)
@@ -2309,16 +2309,20 @@ public:
         if (request.url() == QUrl("qrc:/test1.html")) {
             setHeader(QNetworkRequest::LocationHeader, QString("qrc:/test2.html"));
             setAttribute(QNetworkRequest::RedirectionTargetAttribute, QUrl("qrc:/test2.html"));
+            QTimer::singleShot(0, this, SLOT(continueRedirect()));
         }
 #ifndef QT_NO_OPENSSL
-        else if (request.url() == QUrl("qrc:/fake-ssl-error.html"))
-            setError(QNetworkReply::SslHandshakeFailedError, tr("Fake error !")); // force a ssl error
+        else if (request.url() == QUrl("qrc:/fake-ssl-error.html")) {
+            setError(QNetworkReply::SslHandshakeFailedError, tr("Fake error!"));
+            QTimer::singleShot(0, this, SLOT(continueError()));
+        }
 #endif
-        else if (request.url().host() == QLatin1String("abcdef.abcdef"))
+        else if (request.url().host() == QLatin1String("abcdef.abcdef")) {
             setError(QNetworkReply::HostNotFoundError, tr("Invalid URL"));
+            QTimer::singleShot(0, this, SLOT(continueError()));
+        }
 
         open(QIODevice::ReadOnly);
-        QTimer::singleShot(0, this, SLOT(timeout()));
     }
     ~FakeReply()
     {
@@ -2334,18 +2338,15 @@ protected:
     }
 
 private slots:
-    void timeout()
+    void continueRedirect()
     {
-        if (request().url() == QUrl("qrc://test1.html"))
-            emit error(this->error());
-        else if (request().url() == QUrl("http://abcdef.abcdef/"))
-            emit metaDataChanged();
-#ifndef QT_NO_OPENSSL
-        else if (request().url() == QUrl("qrc:/fake-ssl-error.html"))
-            return;
-#endif
+        emit metaDataChanged();
+        emit finished();
+    }
 
-        emit readyRead();
+    void continueError()
+    {
+        emit error(this->error());
         emit finished();
     }
 };