|
1 // Copyright (c) 2005-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 // te_spudNetworkSideSteps.h |
|
15 // Defines the Network-side events & error conditions tests for SPUD. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef TE_SPUD_RSUBCON_STEPS |
|
25 #define TE_SPUD_RSUBCON_STEPS |
|
26 |
|
27 |
|
28 #include <test/testexecutestepbase.h> |
|
29 |
|
30 #include <es_sock.h> |
|
31 #include <in_sock.h> |
|
32 #include <commdbconnpref.h> |
|
33 |
|
34 /** |
|
35 A driver for running an arbitrary interface (over the loopback), |
|
36 to be used when connected tests cannot be run; i.e. in lieu of WinTunnel */ |
|
37 |
|
38 |
|
39 /** |
|
40 Base class for all Spud - RSubConnection Tests. */ |
|
41 class CSpudRSubConnTestStepBase : |
|
42 public CTestStep |
|
43 { |
|
44 public: |
|
45 TVerdict doTestStepPreambleL(); |
|
46 enum TVerdict doTestStepL(); |
|
47 |
|
48 // Utility |
|
49 void TestBooleanTrueL(TBool aBool, const TDesC& aMsg); |
|
50 void TestL(TInt aErrCode, const TDesC& aMsg); |
|
51 void TestL(TInt aErrCode, TInt aExpErrCode, const TDesC& aMsg); |
|
52 |
|
53 |
|
54 |
|
55 protected: |
|
56 /** |
|
57 Executes the Test Step |
|
58 |
|
59 @return Verdict of the test step: EPass / EFail; |
|
60 EAborted if the test case could not be executed properly; |
|
61 EInconclusive if it could not be determined with certainty that the test case has succeeded. |
|
62 @leave if the test fails |
|
63 */ |
|
64 virtual TVerdict RunTestStepL() = 0; |
|
65 |
|
66 |
|
67 void OpenAndStartInterfaceL(RConnection& aConn, TCommDbConnPref& aPref, TRequestStatus& aSt, const TDesC& aLogMsg); |
|
68 void WaitForCompletionL(TRequestStatus& aSt, TInt aExpErr, const TDesC& aLogMsg); |
|
69 |
|
70 void ReceiveOnSocketL(RSocket& aSocket, const TDesC& aLogMsg); |
|
71 void RecvSendOnSocketL(RSocket& aSocket, const TDesC& aLogMsg); |
|
72 void OpenAndBindSocketL(RSocket& aSock, RConnection& aIface, TUint aLocalPort, const TDesC& aLogMsg); |
|
73 |
|
74 TBool ApplyQoSParametersL(RSubConnection& aPdpContext); |
|
75 void ApplyQoSParametersSet2L(RSubConnection& aPdpContext); |
|
76 |
|
77 void WriteReadOnSocketL(RSocket& aSocket, const TDesC& aLogMsg); |
|
78 void SendRecvOnSocketL(RSocket& aSocket, TInetAddr& aDstAddr, const TDesC& aLogMsg); |
|
79 |
|
80 void VerifyBuffersEqualL(const TDesC8& aBuf1, const TDesC8& aBuf2); |
|
81 |
|
82 /** Our connection to ESock */ |
|
83 RSocketServ iESock; |
|
84 |
|
85 /** |
|
86 The SPUD interface with 1 primary & 1 secondary pdp contexts */ |
|
87 RConnection iSpud; |
|
88 |
|
89 /** |
|
90 Secondary PDP context */ |
|
91 RSubConnection iSpudScndCtx1; |
|
92 |
|
93 /** SPUD primary PDP context SAP */ |
|
94 RSocket iPrimCtxSock1; |
|
95 |
|
96 /** SPUD secondary PDP context SAP */ |
|
97 RSocket iScndCtxSock1; |
|
98 }; |
|
99 |
|
100 |
|
101 |
|
102 /** Used to define a literal variable. */ |
|
103 #define SYMBIAN_TEST_LIT(name) _LIT(K##name, #name) |
|
104 |
|
105 /** Define a literal from a classname and can be as the keyword class. */ |
|
106 #define SYMBIAN_TEST_CLASS(className) SYMBIAN_TEST_LIT(className); class className |
|
107 |
|
108 /** Define a basic declaration for testClass as a subclass of CSpudNetSideTestBase |
|
109 and define a literal from testClass */ |
|
110 #define SYMBIAN_SPUD_TEST_CLASS(testClass) SYMBIAN_TEST_CLASS(testClass) : public CSpudRSubConnTestStepBase \ |
|
111 { \ |
|
112 public: \ |
|
113 inline testClass() {SetTestStepName(K##testClass);}; \ |
|
114 virtual TVerdict RunTestStepL(); \ |
|
115 }; |
|
116 |
|
117 |
|
118 // Test Steps |
|
119 SYMBIAN_SPUD_TEST_CLASS(CUdp1) |
|
120 SYMBIAN_SPUD_TEST_CLASS(CUdp2) |
|
121 SYMBIAN_SPUD_TEST_CLASS(CLoopbackPpp1) |
|
122 SYMBIAN_SPUD_TEST_CLASS(CUpperFlowOnLowerNifDown) |
|
123 SYMBIAN_SPUD_TEST_CLASS(CSpudPppPrimaryStop) |
|
124 #endif |