1032 |
988 |
1033 __UHEAP_MARKEND; |
989 __UHEAP_MARKEND; |
1034 return TestStepResult(); |
990 return TestStepResult(); |
1035 } |
991 } |
1036 |
992 |
1037 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
993 |
1038 |
|
1039 // The following methods test the various content attribute APIs for WMDRM content. |
|
1040 |
|
1041 TVerdict CCAFContentAttributeStep::doWmdrmTestStepL() |
|
1042 { |
|
1043 SetTestStepResult(EFail); |
|
1044 |
|
1045 TInt attribVal; |
|
1046 GetIntFromConfig(ConfigSection(),_L("attribute"), attribVal); |
|
1047 |
|
1048 TInt expectedValue; |
|
1049 GetIntFromConfig(ConfigSection(),_L("value"), expectedValue); |
|
1050 |
|
1051 __UHEAP_MARK; |
|
1052 TPtrC header; |
|
1053 HBufC8* headerData = NULL; |
|
1054 |
|
1055 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1056 { |
|
1057 headerData = ConvertDes16toHBufC8LC(header); |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 headerData = CreateWmdrmHeaderLC(); |
|
1062 } |
|
1063 |
|
1064 CContent *content = CContent::NewLC(*headerData); |
|
1065 TInt value; |
|
1066 User::LeaveIfError(content->GetAttribute(attribVal, value)); |
|
1067 |
|
1068 if(expectedValue == value) |
|
1069 { |
|
1070 SetTestStepResult(EPass); |
|
1071 } |
|
1072 else |
|
1073 { |
|
1074 INFO_PRINTF3(_L("CContent::GetAttribute() Expected value: %d, actual value: %d"), expectedValue, value); |
|
1075 } |
|
1076 |
|
1077 CleanupStack::PopAndDestroy(2, headerData); |
|
1078 __UHEAP_MARKEND; |
|
1079 |
|
1080 return TestStepResult(); |
|
1081 } |
|
1082 |
|
1083 |
|
1084 TVerdict CCAFContentAttributeSetStep::doWmdrmTestStepL() |
|
1085 { |
|
1086 SetTestStepResult(EFail); |
|
1087 |
|
1088 TInt attribute1; |
|
1089 GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1); |
|
1090 |
|
1091 TInt attribute2; |
|
1092 GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2); |
|
1093 |
|
1094 TInt expectedValue1; |
|
1095 GetIntFromConfig(ConfigSection(),_L("value1"),expectedValue1); |
|
1096 |
|
1097 TInt expectedValue2; |
|
1098 GetIntFromConfig(ConfigSection(),_L("value2"),expectedValue2); |
|
1099 |
|
1100 __UHEAP_MARK; |
|
1101 |
|
1102 TPtrC header; |
|
1103 HBufC8* headerData = NULL; |
|
1104 |
|
1105 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1106 { |
|
1107 headerData = ConvertDes16toHBufC8LC(header); |
|
1108 } |
|
1109 else |
|
1110 { |
|
1111 headerData = CreateWmdrmHeaderLC(); |
|
1112 } |
|
1113 |
|
1114 CContent *content = CContent::NewLC(*headerData); |
|
1115 |
|
1116 RAttributeSet attributeSet; |
|
1117 CleanupClosePushL(attributeSet); |
|
1118 attributeSet.AddL(attribute1); |
|
1119 attributeSet.AddL(attribute2); |
|
1120 |
|
1121 TInt result = content->GetAttributeSet(attributeSet); |
|
1122 if(result == KErrNone) |
|
1123 { |
|
1124 TInt value1; |
|
1125 User::LeaveIfError(attributeSet.GetValue(attribute1, value1)); |
|
1126 |
|
1127 TInt value2; |
|
1128 User::LeaveIfError(attributeSet.GetValue(attribute2, value2)); |
|
1129 |
|
1130 if(expectedValue1 == value1 && expectedValue2 == value2 && attributeSet.Count() == 2) |
|
1131 { |
|
1132 SetTestStepResult(EPass); |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 INFO_PRINTF1(_L("CContent::GetAttributeSet() values don't match expected values")); |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 else |
|
1141 { |
|
1142 INFO_PRINTF1(_L("CContent::GetAttributeSet() failed")); |
|
1143 } |
|
1144 |
|
1145 CleanupStack::PopAndDestroy(3, headerData); |
|
1146 |
|
1147 __UHEAP_MARKEND; |
|
1148 |
|
1149 return TestStepResult(); |
|
1150 } |
|
1151 |
|
1152 |
|
1153 TVerdict CCAFContentStringAttributeStep::doWmdrmTestStepL() |
|
1154 { |
|
1155 SetTestStepResult(EFail); |
|
1156 |
|
1157 TInt attribVal; |
|
1158 GetIntFromConfig(ConfigSection(),_L("attribute"),attribVal); |
|
1159 |
|
1160 TPtrC expectedValue; |
|
1161 GetStringFromConfig(ConfigSection(),_L("value"),expectedValue); |
|
1162 |
|
1163 TInt expectedResult; |
|
1164 GetIntFromConfig(ConfigSection(),_L("result"),expectedResult); |
|
1165 |
|
1166 __UHEAP_MARK; |
|
1167 TPtrC header; |
|
1168 HBufC8* headerData = NULL; |
|
1169 |
|
1170 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1171 { |
|
1172 headerData = ConvertDes16toHBufC8LC(header); |
|
1173 } |
|
1174 else |
|
1175 { |
|
1176 headerData = CreateWmdrmHeaderLC(); |
|
1177 } |
|
1178 |
|
1179 CContent *content = CContent::NewLC(*headerData); |
|
1180 |
|
1181 TBuf <200> value; |
|
1182 TInt result = content->GetStringAttribute(attribVal, value); |
|
1183 if(result == expectedResult && value == expectedValue) |
|
1184 { |
|
1185 SetTestStepResult(EPass); |
|
1186 } |
|
1187 else |
|
1188 { |
|
1189 INFO_PRINTF3(_L("CContent::GetStringAttribute() Expected result: %d, actual result: %d"), expectedResult, result); |
|
1190 INFO_PRINTF3(_L("CContent::GetStringAttribute() Expected value: %S, actual value: %S"), &expectedValue, &value); |
|
1191 } |
|
1192 |
|
1193 CleanupStack::PopAndDestroy(2, headerData); |
|
1194 |
|
1195 __UHEAP_MARKEND; |
|
1196 |
|
1197 return TestStepResult(); |
|
1198 } |
|
1199 |
|
1200 |
|
1201 TVerdict CCAFContentStringAttributeSetStep::doWmdrmTestStepL() |
|
1202 { |
|
1203 SetTestStepResult(EFail); |
|
1204 |
|
1205 TInt attribute1; |
|
1206 GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1); |
|
1207 |
|
1208 TInt attribute2; |
|
1209 GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2); |
|
1210 |
|
1211 TPtrC expectedValue1; |
|
1212 GetStringFromConfig(ConfigSection(),_L("value1"),expectedValue1); |
|
1213 |
|
1214 TPtrC expectedValue2; |
|
1215 GetStringFromConfig(ConfigSection(),_L("value2"),expectedValue2); |
|
1216 |
|
1217 __UHEAP_MARK; |
|
1218 TPtrC header; |
|
1219 HBufC8* headerData = NULL; |
|
1220 |
|
1221 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1222 { |
|
1223 headerData = ConvertDes16toHBufC8LC(header); |
|
1224 } |
|
1225 else |
|
1226 { |
|
1227 headerData = CreateWmdrmHeaderLC(); |
|
1228 } |
|
1229 |
|
1230 CContent *content = CContent::NewLC(*headerData); |
|
1231 |
|
1232 RStringAttributeSet attributeSet; |
|
1233 CleanupClosePushL(attributeSet); |
|
1234 attributeSet.AddL(attribute1); |
|
1235 attributeSet.AddL(attribute2); |
|
1236 |
|
1237 TInt result = content->GetStringAttributeSet(attributeSet); |
|
1238 TBuf <200> value1; |
|
1239 TBuf <200> value2; |
|
1240 if(result == KErrNone) |
|
1241 { |
|
1242 TInt result3 = attributeSet.GetValue(attribute1, value1); |
|
1243 TInt result4 = attributeSet.GetValue(attribute2, value2); |
|
1244 |
|
1245 if(value1 == expectedValue1 && value2 == expectedValue2 && attributeSet.Count() == 2 |
|
1246 && result3 == KErrNone && result4 == KErrNone) |
|
1247 { |
|
1248 SetTestStepResult(EPass); |
|
1249 } |
|
1250 else |
|
1251 { |
|
1252 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1.Expected value: %S, actual value: %S"), &expectedValue1, &value1); |
|
1253 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2.Expected value: %S, actual value: %S"), &expectedValue2, &value2); |
|
1254 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1. Expected result: %d, actual result: %d"), 0, result3); |
|
1255 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2. Expected result: %d, actual result: %d"), 0, result4); |
|
1256 } |
|
1257 } |
|
1258 else |
|
1259 { |
|
1260 INFO_PRINTF1(_L("CContent::GetStringAttributeSet() failed")); |
|
1261 } |
|
1262 |
|
1263 CleanupStack::PopAndDestroy(3, headerData); |
|
1264 |
|
1265 __UHEAP_MARKEND; |
|
1266 |
|
1267 return TestStepResult(); |
|
1268 } |
|
1269 |
|
1270 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
1271 |
|