|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ss_glob.h> |
|
19 #include <comms-infras/ss_thread.h> |
|
20 #include <comms-infras/ss_nodemessages_factory.h> |
|
21 #include <comms-infras/ss_nodemessages_dataclient.h> |
|
22 #include "ptcpservertests.h" |
|
23 #include "upnp_cf_msgs.h" |
|
24 #include "upnpflowbase.h" |
|
25 #include "upnpflowfactory.h" |
|
26 #include "CTcpServerTestCase.h" |
|
27 |
|
28 #include <httperr.h> |
|
29 #include "CTcpServerTestUPnP28.h" |
|
30 |
|
31 using namespace Messages; |
|
32 |
|
33 //------------------------------------------------------------// |
|
34 /////////////////// CTcpServerTestUPnP28 ///////////////////////// |
|
35 ////// Testcase: Send the test data from the test client///////// |
|
36 //------------------------------------------------------------// |
|
37 |
|
38 _LIT8 ( KTestUPnPServiceUri,"http://127.0.0.1:80/testserviceuri1" ); |
|
39 _LIT8 ( KData, "GET /testserviceuri1 HTTP/1.1\r\nHOST: 128.0.0.1:\r\n\r\n"); |
|
40 _LIT8 ( KExpectedResponse, "HTTP/1.1 404 Not Found"); |
|
41 //_LIT8 ( KResponseData, "Test Server"); |
|
42 |
|
43 CTcpServerTestUPnP28* CTcpServerTestUPnP28::NewL ( CProxyProvd* aProvd ) |
|
44 { |
|
45 CTcpServerTestUPnP28* ret = new ( ELeave ) CTcpServerTestUPnP28 ( aProvd ); |
|
46 CleanupStack::PushL ( ret ); |
|
47 ret->ConstructL (); |
|
48 CleanupStack::Pop ( ret ); |
|
49 return ret; |
|
50 } |
|
51 |
|
52 CTcpServerTestUPnP28::CTcpServerTestUPnP28 ( CProxyProvd* aProvd ) : |
|
53 CTcpServerTestCase ( aProvd ) |
|
54 { |
|
55 } |
|
56 |
|
57 CTcpServerTestUPnP28::~CTcpServerTestUPnP28 () |
|
58 { |
|
59 |
|
60 } |
|
61 |
|
62 void CTcpServerTestUPnP28::ConstructL () |
|
63 { |
|
64 CTcpServerTestCase::ConstructL(KTestUPnPServiceUri); |
|
65 } |
|
66 |
|
67 TVerdict CTcpServerTestUPnP28::RunTestL () |
|
68 { |
|
69 switch ( iState ) |
|
70 { |
|
71 |
|
72 case ESendData: |
|
73 { |
|
74 iSendChain.CreateL ( KData ); |
|
75 iSocketHandler.Send ( iSendChain ); |
|
76 |
|
77 iState = ESendStopServer; |
|
78 iStatus = KRequestPending; |
|
79 Reschedule (); |
|
80 return EPass; |
|
81 } |
|
82 |
|
83 default: |
|
84 { |
|
85 return CTcpServerTestCase::RunTestL(); |
|
86 } |
|
87 } |
|
88 } |
|
89 |
|
90 |
|
91 void CTcpServerTestUPnP28::RecvComplete ( RMBufChain& aData ) |
|
92 { |
|
93 RBuf8 responseBuf; |
|
94 responseBuf.CreateMax ( aData.Length () ); |
|
95 aData.CopyOut ( responseBuf ); |
|
96 aData.Free (); |
|
97 |
|
98 if ( responseBuf.FindF ( KExpectedResponse ) == KErrNotFound ) |
|
99 { |
|
100 iResponse = EFail; // test case failed |
|
101 } |
|
102 else |
|
103 { |
|
104 iResponse = EPass; // test case passed |
|
105 } |
|
106 |
|
107 responseBuf.Close (); |
|
108 CompleteSelf ( KErrNone ); |
|
109 } |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |