tests/auto/qftp/tst_qftp.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
    49 #include <qmap.h>
    49 #include <qmap.h>
    50 #include <time.h>
    50 #include <time.h>
    51 #include <stdlib.h>
    51 #include <stdlib.h>
    52 #include <QNetworkProxy>
    52 #include <QNetworkProxy>
    53 
    53 
    54 #ifndef TEST_QNETWORK_PROXY
       
    55 #define TEST_QNETWORK_PROXY
       
    56 #endif
       
    57 #include "../network-settings.h"
    54 #include "../network-settings.h"
    58 
    55 
    59 //TESTED_CLASS=
    56 //TESTED_CLASS=
    60 //TESTED_FILES=
    57 //TESTED_FILES=
    61 
    58 
   200 {
   197 {
   201     QTest::addColumn<bool>("setProxy");
   198     QTest::addColumn<bool>("setProxy");
   202     QTest::addColumn<int>("proxyType");
   199     QTest::addColumn<int>("proxyType");
   203 
   200 
   204     QTest::newRow("WithoutProxy") << false << 0;
   201     QTest::newRow("WithoutProxy") << false << 0;
   205 #ifdef TEST_QNETWORK_PROXY
       
   206     QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
   202     QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
   207     //### doesn't work well yet.
   203     //### doesn't work well yet.
   208     //QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
   204     //QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
   209 #endif
       
   210 }
   205 }
   211 
   206 
   212 void tst_QFtp::initTestCase()
   207 void tst_QFtp::initTestCase()
   213 {
   208 {
   214 }
   209 }
   311 {
   306 {
   312     QFETCH_GLOBAL(bool, setProxy);
   307     QFETCH_GLOBAL(bool, setProxy);
   313     if (setProxy)
   308     if (setProxy)
   314         QSKIP( "This test takes too long if we test with proxies too", SkipSingle );
   309         QSKIP( "This test takes too long if we test with proxies too", SkipSingle );
   315 
   310 
   316     QString host = "1.2.3.4";
   311     QString host = "192.0.2.42"; // IP out of TEST-NET, should be unreachable
   317     uint port = 21;
   312     uint port = 21;
   318 
   313 
   319     ftp = newFtp();
   314     ftp = newFtp();
   320     addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) );
   315     addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) );
   321 
   316