--- a/contentmgmt/referencedrmagent/tcaf/source/Contentstep.cpp Thu Aug 19 11:38:48 2010 +0300
+++ b/contentmgmt/referencedrmagent/tcaf/source/Contentstep.cpp Tue Aug 31 17:00:08 2010 +0300
@@ -47,6 +47,17 @@
TVerdict CCAFContentAttributeStep::doTestStepL()
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ TBool wmdrmFlag = EFalse;
+ GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);
+
+ if(wmdrmFlag)
+ {
+ TVerdict verdict = doWmdrmTestStepL();
+ return verdict;
+ }
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
TInt attribute;
TInt value = KErrNone;
TInt expectedValue;
@@ -114,6 +125,17 @@
TVerdict CCAFContentAttributeSetStep::doTestStepL()
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ TBool wmdrmFlag = EFalse;
+ GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);
+
+ if(wmdrmFlag)
+ {
+ TVerdict verdict = doWmdrmTestStepL();
+ return verdict;
+ }
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
TInt value1;
TInt value2;
TInt expectedValue1;
@@ -218,6 +240,17 @@
TVerdict CCAFContentStringAttributeStep::doTestStepL()
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ TBool wmdrmFlag = EFalse;
+ GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);
+
+ if(wmdrmFlag)
+ {
+ TVerdict verdict = doWmdrmTestStepL();
+ return verdict;
+ }
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
TInt expectedResult;
TInt attribute;
TInt unresolvedUri = EFalse;
@@ -306,6 +339,17 @@
TVerdict CCAFContentStringAttributeSetStep::doTestStepL()
{
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+ TBool wmdrmFlag = EFalse;
+ GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);
+
+ if(wmdrmFlag)
+ {
+ TVerdict verdict = doWmdrmTestStepL();
+ return verdict;
+ }
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
TPtrC expectedValue1;
TPtrC expectedValue2;
TBuf <200> value1;
@@ -990,4 +1034,238 @@
return TestStepResult();
}
+#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
+
+// The following methods test the various content attribute APIs for WMDRM content.
+
+TVerdict CCAFContentAttributeStep::doWmdrmTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ TInt attribVal;
+ GetIntFromConfig(ConfigSection(),_L("attribute"), attribVal);
+
+ TInt expectedValue;
+ GetIntFromConfig(ConfigSection(),_L("value"), expectedValue);
+
+__UHEAP_MARK;
+ TPtrC header;
+ HBufC8* headerData = NULL;
+
+ if(GetStringFromConfig(ConfigSection(),_L("header"), header))
+ {
+ headerData = ConvertDes16toHBufC8LC(header);
+ }
+ else
+ {
+ headerData = CreateWmdrmHeaderLC();
+ }
+
+ CContent *content = CContent::NewLC(*headerData);
+ TInt value;
+ User::LeaveIfError(content->GetAttribute(attribVal, value));
+
+ if(expectedValue == value)
+ {
+ SetTestStepResult(EPass);
+ }
+ else
+ {
+ INFO_PRINTF3(_L("CContent::GetAttribute() Expected value: %d, actual value: %d"), expectedValue, value);
+ }
+
+ CleanupStack::PopAndDestroy(2, headerData);
+__UHEAP_MARKEND;
+
+ return TestStepResult();
+ }
+
+
+TVerdict CCAFContentAttributeSetStep::doWmdrmTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ TInt attribute1;
+ GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1);
+
+ TInt attribute2;
+ GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2);
+
+ TInt expectedValue1;
+ GetIntFromConfig(ConfigSection(),_L("value1"),expectedValue1);
+
+ TInt expectedValue2;
+ GetIntFromConfig(ConfigSection(),_L("value2"),expectedValue2);
+
+__UHEAP_MARK;
+
+ TPtrC header;
+ HBufC8* headerData = NULL;
+
+ if(GetStringFromConfig(ConfigSection(),_L("header"), header))
+ {
+ headerData = ConvertDes16toHBufC8LC(header);
+ }
+ else
+ {
+ headerData = CreateWmdrmHeaderLC();
+ }
+
+ CContent *content = CContent::NewLC(*headerData);
+
+ RAttributeSet attributeSet;
+ CleanupClosePushL(attributeSet);
+ attributeSet.AddL(attribute1);
+ attributeSet.AddL(attribute2);
+
+ TInt result = content->GetAttributeSet(attributeSet);
+ if(result == KErrNone)
+ {
+ TInt value1;
+ User::LeaveIfError(attributeSet.GetValue(attribute1, value1));
+
+ TInt value2;
+ User::LeaveIfError(attributeSet.GetValue(attribute2, value2));
+
+ if(expectedValue1 == value1 && expectedValue2 == value2 && attributeSet.Count() == 2)
+ {
+ SetTestStepResult(EPass);
+ }
+ else
+ {
+ INFO_PRINTF1(_L("CContent::GetAttributeSet() values don't match expected values"));
+ }
+ }
+
+ else
+ {
+ INFO_PRINTF1(_L("CContent::GetAttributeSet() failed"));
+ }
+
+ CleanupStack::PopAndDestroy(3, headerData);
+
+__UHEAP_MARKEND;
+
+ return TestStepResult();
+ }
+
+
+TVerdict CCAFContentStringAttributeStep::doWmdrmTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ TInt attribVal;
+ GetIntFromConfig(ConfigSection(),_L("attribute"),attribVal);
+
+ TPtrC expectedValue;
+ GetStringFromConfig(ConfigSection(),_L("value"),expectedValue);
+
+ TInt expectedResult;
+ GetIntFromConfig(ConfigSection(),_L("result"),expectedResult);
+
+__UHEAP_MARK;
+ TPtrC header;
+ HBufC8* headerData = NULL;
+
+ if(GetStringFromConfig(ConfigSection(),_L("header"), header))
+ {
+ headerData = ConvertDes16toHBufC8LC(header);
+ }
+ else
+ {
+ headerData = CreateWmdrmHeaderLC();
+ }
+
+ CContent *content = CContent::NewLC(*headerData);
+
+ TBuf <200> value;
+ TInt result = content->GetStringAttribute(attribVal, value);
+ if(result == expectedResult && value == expectedValue)
+ {
+ SetTestStepResult(EPass);
+ }
+ else
+ {
+ INFO_PRINTF3(_L("CContent::GetStringAttribute() Expected result: %d, actual result: %d"), expectedResult, result);
+ INFO_PRINTF3(_L("CContent::GetStringAttribute() Expected value: %S, actual value: %S"), &expectedValue, &value);
+ }
+
+ CleanupStack::PopAndDestroy(2, headerData);
+
+__UHEAP_MARKEND;
+
+ return TestStepResult();
+ }
+
+
+TVerdict CCAFContentStringAttributeSetStep::doWmdrmTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ TInt attribute1;
+ GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1);
+
+ TInt attribute2;
+ GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2);
+
+ TPtrC expectedValue1;
+ GetStringFromConfig(ConfigSection(),_L("value1"),expectedValue1);
+
+ TPtrC expectedValue2;
+ GetStringFromConfig(ConfigSection(),_L("value2"),expectedValue2);
+
+__UHEAP_MARK;
+ TPtrC header;
+ HBufC8* headerData = NULL;
+
+ if(GetStringFromConfig(ConfigSection(),_L("header"), header))
+ {
+ headerData = ConvertDes16toHBufC8LC(header);
+ }
+ else
+ {
+ headerData = CreateWmdrmHeaderLC();
+ }
+
+ CContent *content = CContent::NewLC(*headerData);
+
+ RStringAttributeSet attributeSet;
+ CleanupClosePushL(attributeSet);
+ attributeSet.AddL(attribute1);
+ attributeSet.AddL(attribute2);
+
+ TInt result = content->GetStringAttributeSet(attributeSet);
+ TBuf <200> value1;
+ TBuf <200> value2;
+ if(result == KErrNone)
+ {
+ TInt result3 = attributeSet.GetValue(attribute1, value1);
+ TInt result4 = attributeSet.GetValue(attribute2, value2);
+
+ if(value1 == expectedValue1 && value2 == expectedValue2 && attributeSet.Count() == 2
+ && result3 == KErrNone && result4 == KErrNone)
+ {
+ SetTestStepResult(EPass);
+ }
+ else
+ {
+ INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1.Expected value: %S, actual value: %S"), &expectedValue1, &value1);
+ INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2.Expected value: %S, actual value: %S"), &expectedValue2, &value2);
+ INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1. Expected result: %d, actual result: %d"), 0, result3);
+ INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2. Expected result: %d, actual result: %d"), 0, result4);
+ }
+ }
+ else
+ {
+ INFO_PRINTF1(_L("CContent::GetStringAttributeSet() failed"));
+ }
+
+ CleanupStack::PopAndDestroy(3, headerData);
+
+__UHEAP_MARKEND;
+
+ return TestStepResult();
+ }
+
+#endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT