tests/auto/qhttp/tst_qhttp.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
   112     void caseInsensitiveKeys();
   112     void caseInsensitiveKeys();
   113     void emptyBodyInReply();
   113     void emptyBodyInReply();
   114     void abortInReadyRead();
   114     void abortInReadyRead();
   115     void abortInResponseHeaderReceived();
   115     void abortInResponseHeaderReceived();
   116     void nestedEventLoop();
   116     void nestedEventLoop();
   117 
       
   118 
       
   119     // manual tests
       
   120     void connectionClose();
   117     void connectionClose();
   121 
   118 
   122 protected slots:
   119 protected slots:
   123     void stateChanged( int );
   120     void stateChanged( int );
   124     void responseHeaderReceived( const QHttpResponseHeader & );
   121     void responseHeaderReceived( const QHttpResponseHeader & );
   171 
   168 
   172     int reconnect_state_connect_count;
   169     int reconnect_state_connect_count;
   173 
   170 
   174     bool connectionWithAuth;
   171     bool connectionWithAuth;
   175     bool proxyAuthCalled;
   172     bool proxyAuthCalled;
       
   173 };
       
   174 
       
   175 class ClosingServer: public QTcpServer
       
   176 {
       
   177     Q_OBJECT
       
   178 public:
       
   179     ClosingServer()
       
   180     {
       
   181         connect(this, SIGNAL(newConnection()), SLOT(handleConnection()));
       
   182         listen();
       
   183     }
       
   184 
       
   185 public slots:
       
   186     void handleConnection()
       
   187     {
       
   188         delete nextPendingConnection();
       
   189     }
   176 };
   190 };
   177 
   191 
   178 //#define DUMP_SIGNALS
   192 //#define DUMP_SIGNALS
   179 
   193 
   180 const int bytesTotal_init = -10;
   194 const int bytesTotal_init = -10;
  1489     QCOMPARE(spy.count(), 0);
  1503     QCOMPARE(spy.count(), 0);
  1490 }
  1504 }
  1491 
  1505 
  1492 void tst_QHttp::connectionClose()
  1506 void tst_QHttp::connectionClose()
  1493 {
  1507 {
  1494     // This test tries to connect to a client's server, so it is disabled.
       
  1495     // Every now and then, someone please run it to make sure it's not broken.
       
  1496     // Note: the servers might change too...
       
  1497     //
       
  1498     // This was added in response to bug 176822
  1508     // This was added in response to bug 176822
  1499 #ifndef Q_OS_SYMBIAN
       
  1500     QSKIP("This test is manual - read comments in the source code", SkipAll);
       
  1501 #endif
       
  1502     QFETCH_GLOBAL(bool, setProxy);
  1509     QFETCH_GLOBAL(bool, setProxy);
  1503     if (setProxy)
  1510     if (setProxy)
  1504         return;
  1511         return;
  1505 
  1512 
  1506     QHttp http;
  1513     QHttp http;
  1507     http.setHost("www.fon.com", QHttp::ConnectionModeHttps);
  1514     ClosingServer server;
       
  1515     http.setHost("localhost", QHttp::ConnectionModeHttps, server.serverPort());
  1508     http.get("/login/gateway/processLogin");
  1516     http.get("/login/gateway/processLogin");
  1509 
  1517 
  1510     // another possibility:
  1518     // another possibility:
  1511     //http.setHost("nexus.passport.com", QHttp::ConnectionModeHttps, 443);
  1519     //http.setHost("nexus.passport.com", QHttp::ConnectionModeHttps, 443);
  1512     //http.get("/rdr/pprdr.asp");
  1520     //http.get("/rdr/pprdr.asp");