telephonyserverplugins/common_tsy/test/integration/inc/chttpdownload.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 #ifndef __CHTTP_DOWNLOAD___INCLUDE
       
    18 #define __CHTTP_DOWNLOAD___INCLUDE
       
    19 
       
    20 
       
    21 #include <test/testexecutestepbase.h>
       
    22 #include <in_sock.h>
       
    23 #include "cctsyintegrationtestsuitebase.h"
       
    24 
       
    25 class CHTTPDownload : public CBase
       
    26 /**
       
    27  * This is a class that can be used in order to download an HTTP page from the web, while working on 
       
    28  * other stuff. To use it, one should create an instance, and then call the StartDownloadL method. 
       
    29  */
       
    30     {
       
    31 public:
       
    32     CHTTPDownload(CCTSYIntegrationTestSuiteStepBase *aTestStep);
       
    33     virtual ~CHTTPDownload();
       
    34 
       
    35     TBool StartDownloadL();
       
    36     TBool StartDownloadL(const TDesC &aHost, const TDesC &aPage);
       
    37     TBool StartDownloadL(const TDesC &aHost, const TDesC &aPage, TInt aPort);
       
    38     TBool StartDownloadWithSecondaryContextL(const TDesC &aHost, const TDesC &aPage,TInt aPort);
       
    39     
       
    40     void StopDownload();
       
    41     TBool VerifyDownloading();
       
    42     TInt GetByteCount();
       
    43 
       
    44 private:
       
    45     
       
    46     TInt InitSocket();
       
    47     TInt Connect();
       
    48     TInt Get();
       
    49     TInt StartRead();
       
    50     void Close();
       
    51     
       
    52 private:
       
    53     static RSocketServ iSocketServer;
       
    54     static TInt iActiveDownload;
       
    55     TBool iOpenSocketServer;
       
    56     CCTSYIntegrationTestSuiteStepBase *iTestStep;
       
    57     RSocket iSocket;
       
    58     TBool iSocketOpen;
       
    59     RHostResolver iHostResolver;
       
    60     TBool iHostResolverOpen;
       
    61     RConnection iConnection;
       
    62     TBool iConnectionOpen;
       
    63     RSubConnection iSubConnection;
       
    64     TBool iSubConnectionOpen;
       
    65     TBool iUseSubConnection;
       
    66 	RBuf8 iWebPage;
       
    67     TBool iWebPageOpen;
       
    68     TRequestStatus iRecvStatus;
       
    69     TInt iByteCount;
       
    70 	TNameEntry iHostNameEntry;
       
    71     const TDesC *iHost;
       
    72     const TDesC *iPage;
       
    73     TInt iPort;
       
    74     TRequestStatus iStatus;
       
    75 	TSockXfrLength iHttpHeaderLen;
       
    76 	
       
    77     };
       
    78 
       
    79 
       
    80 #endif // __CHTTP_DOWNLOAD___INCLUDE