|
1 // Copyright (c) 2002-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 // Contain the implementation of the class for this null agent test |
|
15 // |
|
16 // |
|
17 |
|
18 #include "NullAgentTestSteps.h" |
|
19 #include "es_sock.h" |
|
20 #include "in_sock.h" |
|
21 |
|
22 CTestStepNullAgtCommDbIf::CTestStepNullAgtCommDbIf(TPtrC aName) |
|
23 { |
|
24 iTestStepName=aName; |
|
25 } |
|
26 |
|
27 enum TVerdict CTestStepNullAgtCommDbIf::doTestStepL(void) |
|
28 { |
|
29 __UHEAP_MARK; |
|
30 |
|
31 TInt r; // the result of various operations |
|
32 TRequestStatus status; // status of asynchronous ops |
|
33 |
|
34 RSocketServ server; |
|
35 RConnection connection; |
|
36 |
|
37 // as ever we need a socket server to create connections... |
|
38 r = server.Connect(); |
|
39 TESTEL(r == KErrNone, r); |
|
40 CleanupClosePushL(server); |
|
41 |
|
42 // open the connection |
|
43 // need a connection to get a null agent... the db reqs go to the agt |
|
44 r = connection.Open(server, KAfInet); |
|
45 TESTEL(r == KErrNone, r); |
|
46 CleanupClosePushL(connection); |
|
47 |
|
48 // read an integer value back from commdb (IAP\Id chosen) |
|
49 _LIT(KName1, "IAP\\id"); |
|
50 TBufC<7> name1(KName1); |
|
51 TUint32 intval; |
|
52 r = connection.GetIntSetting(name1, intval); |
|
53 TESTEL(KErrNotReady == r, r); |
|
54 |
|
55 // read a bool value back from commdb (DialOutISP\IfPromptForAuth chosen) |
|
56 _LIT(KName2, "DialOutISP\\IfPromptForAuth"); |
|
57 TBufC<27> name2(KName2); |
|
58 TBool boolval; |
|
59 r = connection.GetBoolSetting(name2, boolval); |
|
60 TESTEL(KErrNotReady == r, r); |
|
61 |
|
62 // TODO: read the equivalent of DialOutISP\\IfName that works these days |
|
63 |
|
64 // read a descriptor back from commdb (DialOutISP\IfName chosen) |
|
65 // this should fail as this field does not exist anymore |
|
66 _LIT(KName3, "DialOutISP\\IfName"); |
|
67 TBufC<18> name3(KName3); |
|
68 TBuf<128> desval; |
|
69 r = connection.GetDesSetting(name3, desval); |
|
70 TESTEL(KErrNotReady == r, r); |
|
71 |
|
72 // read a long descriptor back from commdb (DialOutISP\LoginScript chosen) |
|
73 _LIT(KName4, "DialOutISP\\LoginScript"); |
|
74 TBufC<23> name4(KName4); |
|
75 TBuf<128> longdesval; |
|
76 r = connection.GetLongDesSetting(name4, longdesval); |
|
77 TESTEL(KErrNotReady == r, r); |
|
78 |
|
79 // just use defaults, any connection will do for this test |
|
80 connection.Start(status); |
|
81 User::WaitForRequest(status); |
|
82 TESTEL(status.Int() == KErrNone, status.Int()); |
|
83 |
|
84 // read an integer value back from commdb (IAP\Id chosen) |
|
85 _LIT(KName5, "IAP\\id"); |
|
86 TBufC<7> name5(KName5); |
|
87 r = connection.GetIntSetting(name5, intval); |
|
88 TESTEL(KErrNone == r, r); |
|
89 |
|
90 // read a bool value back from commdb (DialOutISP\IfPromptForAuth chosen) |
|
91 _LIT(KName6, "DialOutISP\\IfPromptForAuth"); |
|
92 TBufC<27> name6(KName6); |
|
93 r = connection.GetBoolSetting(name6, boolval); |
|
94 TESTEL(KErrNone == r, r); |
|
95 |
|
96 // TODO: read the equivalent of DialOutISP\\IfName that works these days |
|
97 |
|
98 // read a descriptor back from commdb (DialOutISP\IfName chosen) |
|
99 // this should fail as this field does not exist anymore |
|
100 _LIT(KName7, "DialOutISP\\IfName"); |
|
101 TBufC<18> name7(KName7); |
|
102 r = connection.GetDesSetting(name7, desval); |
|
103 TESTEL(KErrNotFound == r, r); |
|
104 |
|
105 // read a long descriptor back from commdb (DialOutISP\LoginScript chosen) |
|
106 _LIT(KName8, "DialOutISP\\LoginScript"); |
|
107 TBufC<23> name8(KName8); |
|
108 r = connection.GetLongDesSetting(name8, longdesval); |
|
109 TESTEL(KErrNone == r, r); |
|
110 |
|
111 // destroy the connection |
|
112 r = connection.Stop(); |
|
113 TESTEL(r == KErrNone, r); |
|
114 CleanupStack::Pop(); |
|
115 |
|
116 // close the socket server |
|
117 server.Close(); |
|
118 CleanupStack::Pop(); |
|
119 |
|
120 __UHEAP_MARKEND; |
|
121 |
|
122 return iTestStepResult; |
|
123 } |