|
1 // Copyright (c) 2003-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 #include <e32test.h> |
|
17 |
|
18 #include "stabilitytestclass.h" |
|
19 #include "testdocuments.h" |
|
20 |
|
21 static RTest test(_L("t_wbxmlsyncmlparserstabilitytests")); |
|
22 |
|
23 |
|
24 static void DeleteTestDirL() |
|
25 { |
|
26 RFs fsSession; |
|
27 TInt err = fsSession.Connect(); |
|
28 if(err == KErrNone) |
|
29 { |
|
30 CleanupClosePushL(fsSession); |
|
31 RDebug::Print(_L("Deleting \"%S\" directory.\n"), &KOpaqueDirectory); |
|
32 CFileMan* fileMan = CFileMan::NewL(fsSession); |
|
33 CleanupStack::PushL(fileMan); |
|
34 TInt err = fileMan->RmDir(KOpaqueDirectory); |
|
35 if(err == KErrPathNotFound) |
|
36 { |
|
37 err = KErrNone; |
|
38 } |
|
39 User::LeaveIfError(err); |
|
40 CleanupStack::PopAndDestroy(fileMan); |
|
41 CleanupStack::PopAndDestroy(&fsSession); |
|
42 } |
|
43 else |
|
44 { |
|
45 RDebug::Print(_L("Error %d connecting file session. Directory: %S.\n"), err, &KOpaqueDirectory); |
|
46 } |
|
47 } |
|
48 |
|
49 |
|
50 /** |
|
51 @SYMTestCaseID SYSLIB-XML-CT-3723 |
|
52 @SYMTestCaseDesc Parsing SyncML documents. |
|
53 @SYMTestPriority Medium |
|
54 @SYMTestActions Parsing syncml documents in the specified directory. |
|
55 @SYMTestExpectedResults Parser should be able to cope with parsing the documents. |
|
56 @SYMREQ REQ0000 |
|
57 */ |
|
58 static void SyncmlTestsL() |
|
59 { |
|
60 test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3723 SyncmlTestsL tests... ")); |
|
61 |
|
62 __UHEAP_MARK; |
|
63 |
|
64 CStabilityTestClass* syncml1_1TestWithOpaque = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); |
|
65 CleanupStack::PushL(syncml1_1TestWithOpaque); |
|
66 syncml1_1TestWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); |
|
67 syncml1_1TestWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); |
|
68 CleanupStack::PopAndDestroy(syncml1_1TestWithOpaque); |
|
69 |
|
70 CStabilityTestClass* syncml1_1TestMax = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); |
|
71 CleanupStack::PushL(syncml1_1TestMax); |
|
72 syncml1_1TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); |
|
73 syncml1_1TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); |
|
74 CleanupStack::PopAndDestroy(syncml1_1TestMax); |
|
75 |
|
76 ::DeleteTestDirL(); |
|
77 |
|
78 CStabilityTestClass* syncml1_2TestWithOpaque = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); |
|
79 CleanupStack::PushL(syncml1_2TestWithOpaque); |
|
80 syncml1_2TestWithOpaque->StabilityTestL(KSyncML1_2Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); |
|
81 syncml1_2TestWithOpaque->StabilityTestL(KSyncML1_2Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); |
|
82 CleanupStack::PopAndDestroy(syncml1_2TestWithOpaque); |
|
83 |
|
84 CStabilityTestClass* syncml1_2TestMax = CStabilityTestClass::NewL(test, EFalse, KMaxChunkSize); |
|
85 CleanupStack::PushL(syncml1_2TestMax); |
|
86 syncml1_2TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL); |
|
87 syncml1_2TestMax->StabilityTestL(KOpaqueDirectory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL); |
|
88 CleanupStack::PopAndDestroy(syncml1_2TestMax); |
|
89 |
|
90 ::DeleteTestDirL(); |
|
91 |
|
92 __UHEAP_MARKEND; |
|
93 } |
|
94 |
|
95 |
|
96 static void MainL() |
|
97 { |
|
98 SyncmlTestsL(); |
|
99 |
|
100 } |
|
101 |
|
102 |
|
103 TInt E32Main() |
|
104 { |
|
105 __UHEAP_MARK; |
|
106 test.Title(); |
|
107 test.Start(_L("initialising")); |
|
108 |
|
109 CTrapCleanup* c=CTrapCleanup::New(); |
|
110 |
|
111 // start the loader |
|
112 RFs fs; |
|
113 test (fs.Connect()==KErrNone); |
|
114 fs.Close(); |
|
115 |
|
116 test (c!=0); |
|
117 TRAPD(r,MainL()); |
|
118 test (r==KErrNone); |
|
119 delete c; |
|
120 test.End(); |
|
121 test.Close(); |
|
122 __UHEAP_MARKEND; |
|
123 return KErrNone; |
|
124 } |