|
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 // |
|
15 |
|
16 /** |
|
17 @file multipleopenrsubconnectionStep.cpp |
|
18 */ |
|
19 |
|
20 #include "SubConnections.TestSteps.h" |
|
21 #include "SocketServer.TestSteps.h" |
|
22 #include "Connections.TestSteps.h" |
|
23 |
|
24 CMultipleOpenRSubConnectionStep::CMultipleOpenRSubConnectionStep(CCEsockTestBase*& aEsockTest) |
|
25 : CTe_EsockStepBase(aEsockTest) |
|
26 { |
|
27 SetTestStepName(KMultipleOpenRSubConnectionStep); |
|
28 } |
|
29 |
|
30 TInt CMultipleOpenRSubConnectionStep::ConfigureFromIni() |
|
31 { |
|
32 //clean parameters from previous runs |
|
33 iParams.Reset(); |
|
34 |
|
35 //try reading the next socket's name |
|
36 if (GetStringFromConfig(iSection,KTe_SubConnectionName,iParams.iSubConnectionName)!=1 |
|
37 || iParams.iSubConnectionName.Length()==0) |
|
38 return KErrNotFound; |
|
39 |
|
40 if (GetStringFromConfig(iSection,KTe_SocketServName,iParams.iSockServName)!=1) |
|
41 { |
|
42 INFO_PRINTF2(_L("%S: Socket server name missing."),&iParams.iSubConnectionName); |
|
43 return KErrNotFound; |
|
44 } |
|
45 |
|
46 if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1) |
|
47 { |
|
48 INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iSubConnectionName); |
|
49 return KErrNotFound; |
|
50 } |
|
51 |
|
52 TPtrC subConnTypeName; |
|
53 if (GetStringFromConfig(iSection,KTe_SubConnectionTypeName,subConnTypeName)!=1) |
|
54 { |
|
55 INFO_PRINTF2(_L("%S: SubConnection type missing."),&iParams.iSubConnectionName); |
|
56 return KErrNotFound; |
|
57 } |
|
58 |
|
59 if (subConnTypeName.Compare(KTe_SubConnectionTypeAttach)==0) |
|
60 { iParams.iSubConnType = RSubConnection::EAttachToDefault; } |
|
61 else if (subConnTypeName.Compare(KTe_SubConnectionTypeNew)==0) |
|
62 { iParams.iSubConnType = RSubConnection::ECreateNew; } |
|
63 else |
|
64 { |
|
65 INFO_PRINTF3(_L("%S: SubConnection type (%S) not recognised."),&iParams.iSubConnectionName,&subConnTypeName); |
|
66 return KErrNotFound; |
|
67 } |
|
68 |
|
69 return KErrNone; |
|
70 } |
|
71 |
|
72 TVerdict CMultipleOpenRSubConnectionStep::doSingleTestStep() |
|
73 { |
|
74 TInt error = iEsockTest->OpenSubConnection(iParams); |
|
75 if (error!=KErrNone) |
|
76 { |
|
77 INFO_PRINTF2(_L("Could not open subconnection (%S)."),&iParams.iSubConnectionName); |
|
78 INFO_PRINTF2(_L("Error: %d."),error); |
|
79 return EFail; |
|
80 } |
|
81 |
|
82 error = iEsockTest->OpenSubConnection(iParams); |
|
83 if (error==KErrNone) |
|
84 { |
|
85 INFO_PRINTF1(_L("KErrNone returned on multiple RSubConnection::Open().")); |
|
86 return EFail; |
|
87 } |
|
88 |
|
89 return EPass; |
|
90 } |
|
91 |