|
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 <xml/parserfeature.h> |
|
19 #include <xml/xmlframeworkerrors.h> |
|
20 |
|
21 #include "stabilitytestclass.h" |
|
22 #include "testdocuments.h" |
|
23 |
|
24 using namespace Xml; |
|
25 |
|
26 _LIT8 (KStringDictionaryUri, "4~0"); |
|
27 _LIT8 (KStringDictionaryFD1, "FD1~0"); |
|
28 _LIT8 (KStringDictionaryFD3, "FD3~0"); |
|
29 _LIT8 (KStringDictionarySML10, "SYNCML:SYNCML1.0"); |
|
30 _LIT8 (KStringDictionarySML11, "SYNCML:SYNCML1.1"); |
|
31 _LIT8 (KStringDictionaryDTDSML10, "-//SYNCML//DTD SyncML 1.0//EN~0"); |
|
32 _LIT8 (KStringDictionaryDTDSML11, "-//SYNCML//DTD SyncML 1.1//EN~0"); |
|
33 |
|
34 _LIT (KTestDocument, "z:\\system\\XmlTest\\Wml\\Unknown\\UnknownPubId_AllElements.wmlc"); |
|
35 _LIT (KTestDocument1, "z:\\system\\XmlTest\\SyncML\\Unknown\\DEF078987_3.wbxml"); |
|
36 |
|
37 static RTest test(_L("t_wbxmlunknownparsertests")); |
|
38 |
|
39 |
|
40 /** |
|
41 @SYMTestCaseID SYSLIB-XML-CT-3721 |
|
42 @SYMTestCaseDesc Testing wbxml parser |
|
43 @SYMTestPriority Medium |
|
44 @SYMTestActions Parses a doucment and behaviour should be as expected. |
|
45 @SYMTestExpectedResults Test should not fail. |
|
46 @SYMREQ REQ0000 |
|
47 */ |
|
48 static void BehaviourTestsL() |
|
49 { |
|
50 test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3721 BehaviourTestsL tests... ")); |
|
51 |
|
52 __UHEAP_MARK; |
|
53 |
|
54 TPassOrFailureSettings aPassOrFailureSettings; |
|
55 |
|
56 aPassOrFailureSettings.iDoParseDocument = ETrue; |
|
57 aPassOrFailureSettings.iFilenameProvided = ETrue; |
|
58 aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| |
|
59 ERawContent; |
|
60 |
|
61 |
|
62 CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); |
|
63 CleanupStack::PushL(behaviourTest); |
|
64 |
|
65 |
|
66 |
|
67 // Test 1 |
|
68 |
|
69 aPassOrFailureSettings.iStringDictionaryUri = &KBlankStringDictionaryUri; |
|
70 aPassOrFailureSettings.iExpectedCode = KErrXmlMissingStringDictionary; |
|
71 |
|
72 behaviourTest->TestBehaviour(KTestDocument, aPassOrFailureSettings); |
|
73 |
|
74 |
|
75 // Test 2 |
|
76 |
|
77 // Preload Dictionary |
|
78 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryUri; |
|
79 aPassOrFailureSettings.iExpectedCode = KErrNone; |
|
80 |
|
81 behaviourTest->TestBehaviour(KTestDocument, aPassOrFailureSettings); |
|
82 |
|
83 |
|
84 |
|
85 CleanupStack::PopAndDestroy(behaviourTest); |
|
86 |
|
87 __UHEAP_MARKEND; |
|
88 } |
|
89 |
|
90 |
|
91 /** |
|
92 @SYMTestCaseID SYSLIB-XML-CT-3722 |
|
93 @SYMTestCaseDesc Testing : Convergence: KErrXmlStringDictionaryPluginNotFound when |
|
94 syncing with DM server |
|
95 @SYMTestPriority High |
|
96 @SYMTestActions It parse the files DEF078987_3.wbxml a which contain the updated |
|
97 unknown publicID |
|
98 @SYMTestExpectedResults Test should not fail |
|
99 @SYMDEF DEF083044 |
|
100 */ |
|
101 void Defect_DEF083044_TestsL() |
|
102 { |
|
103 test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3722 SyncML unknown publicID tests... ")); |
|
104 |
|
105 __UHEAP_MARK; |
|
106 |
|
107 TPassOrFailureSettings aPassOrFailureSettings; |
|
108 aPassOrFailureSettings.iDoParseDocument = ETrue; |
|
109 aPassOrFailureSettings.iFilenameProvided = ETrue; |
|
110 |
|
111 CStabilityTestClass* behaviourTest = CStabilityTestClass::NewL(test); |
|
112 CleanupStack::PushL(behaviourTest); |
|
113 |
|
114 aPassOrFailureSettings.iParseMode = EErrorOnUnrecognisedTags| |
|
115 ERawContent; |
|
116 aPassOrFailureSettings.iExpectedCode = KErrNone; |
|
117 |
|
118 // Preload Dictionary |
|
119 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryFD1; |
|
120 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
121 |
|
122 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryFD3; |
|
123 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
124 |
|
125 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionarySML10; |
|
126 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
127 |
|
128 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionarySML11; |
|
129 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
130 |
|
131 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryDTDSML10; |
|
132 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
133 |
|
134 aPassOrFailureSettings.iStringDictionaryUri = &KStringDictionaryDTDSML11; |
|
135 behaviourTest->TestBehaviour(KTestDocument1, aPassOrFailureSettings); |
|
136 |
|
137 CleanupStack::PopAndDestroy(behaviourTest); |
|
138 |
|
139 __UHEAP_MARKEND; |
|
140 } |
|
141 |
|
142 |
|
143 static void MainL() |
|
144 { |
|
145 Defect_DEF083044_TestsL(); |
|
146 BehaviourTestsL(); |
|
147 } |
|
148 |
|
149 |
|
150 TInt E32Main() |
|
151 { |
|
152 __UHEAP_MARK; |
|
153 test.Title(); |
|
154 test.Start(_L("initialising")); |
|
155 |
|
156 CTrapCleanup* c=CTrapCleanup::New(); |
|
157 |
|
158 // start the loader |
|
159 RFs fs; |
|
160 test (fs.Connect()==KErrNone); |
|
161 fs.Close(); |
|
162 |
|
163 test (c!=0); |
|
164 TRAPD(r,MainL()); |
|
165 test (r==KErrNone); |
|
166 delete c; |
|
167 test.End(); |
|
168 test.Close(); |
|
169 __UHEAP_MARKEND; |
|
170 return KErrNone; |
|
171 } |
|
172 |