|
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 "CTcpServerTestUPnP33.h" |
|
30 |
|
31 using namespace Messages; |
|
32 |
|
33 //------------------------------------------------------------// |
|
34 /////////////////// CTcpServerTestUPnP33 ///////////////////////// |
|
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, "SUBSCRIBE /testserviceuri1 HTTP/1.1\r\nHOST: 127.0.0.1:80\r\nSID: testserviceuri1\r\nNT: upnp:event\r\n\r\n\r\n"); |
|
40 _LIT8 ( KExpectedResponse, "HTTP/1.1 400 Bad Request"); |
|
41 |
|
42 CTcpServerTestUPnP33* CTcpServerTestUPnP33::NewL ( CProxyProvd* aProvd ) |
|
43 { |
|
44 CTcpServerTestUPnP33* ret = new ( ELeave ) CTcpServerTestUPnP33 ( aProvd ); |
|
45 CleanupStack::PushL ( ret ); |
|
46 ret->ConstructL (); |
|
47 CleanupStack::Pop ( ret ); |
|
48 return ret; |
|
49 } |
|
50 |
|
51 CTcpServerTestUPnP33::CTcpServerTestUPnP33 ( CProxyProvd* aProvd ) : |
|
52 CTcpServerTestCase ( aProvd ) |
|
53 { |
|
54 } |
|
55 |
|
56 CTcpServerTestUPnP33::~CTcpServerTestUPnP33 () |
|
57 { |
|
58 |
|
59 } |
|
60 |
|
61 void CTcpServerTestUPnP33::ConstructL () |
|
62 { |
|
63 CTcpServerTestCase::ConstructL(KTestUPnPServiceUri); |
|
64 } |
|
65 |
|
66 TVerdict CTcpServerTestUPnP33::RunTestL () |
|
67 { |
|
68 switch ( iState ) |
|
69 { |
|
70 |
|
71 case ESendData: |
|
72 { |
|
73 iSendChain.CreateL ( KData ); |
|
74 iSocketHandler.Send ( iSendChain ); |
|
75 |
|
76 iState = ESendStopServer; |
|
77 iStatus = KRequestPending; |
|
78 Reschedule (); |
|
79 return EPass; |
|
80 } |
|
81 |
|
82 default: |
|
83 { |
|
84 return CTcpServerTestCase::RunTestL(); |
|
85 } |
|
86 } |
|
87 } |
|
88 |
|
89 |
|
90 void CTcpServerTestUPnP33::RecvComplete ( RMBufChain& aData ) |
|
91 { |
|
92 RBuf8 responseBuf; |
|
93 responseBuf.CreateMax ( aData.Length () ); |
|
94 aData.CopyOut ( responseBuf ); |
|
95 aData.Free (); |
|
96 |
|
97 if ( responseBuf.FindF ( KExpectedResponse ) == KErrNotFound ) |
|
98 { |
|
99 iResponse = EFail; // test case failed |
|
100 } |
|
101 else |
|
102 { |
|
103 iResponse = EPass; // test case passed |
|
104 } |
|
105 |
|
106 responseBuf.Close (); |
|
107 CompleteSelf ( KErrNone ); |
|
108 } |
|
109 |
|
110 |
|
111 |