contentmgmt/referencedrmagent/tcaf/source/Consumerstep.cpp
branchRCL_3
changeset 95 641f389e9157
parent 53 030c4fbc13d7
child 96 a71299154b21
equal deleted inserted replaced
92:f18401adf8e1 95:641f389e9157
  1816 	{
  1816 	{
  1817 	SetTestStepName(KCAFDataAttributeStep);
  1817 	SetTestStepName(KCAFDataAttributeStep);
  1818 	}
  1818 	}
  1819 
  1819 
  1820 TVerdict CCAFDataAttributeStep::doTestStepL()
  1820 TVerdict CCAFDataAttributeStep::doTestStepL()
  1821 	{  
  1821 	{
       
  1822 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  1823     TBool wmdrmFlag = EFalse;     
       
  1824     GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);     
       
  1825          
       
  1826     if(wmdrmFlag)     
       
  1827         {     
       
  1828         TVerdict verdict = doWmdrmTestStepL();     
       
  1829         return verdict;     
       
  1830         }     
       
  1831 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  1832   
  1822 	TInt attribute;
  1833 	TInt attribute;
  1823 	TInt value = KErrNone;
  1834 	TInt value = KErrNone;
  1824 	TInt expectedValue = KErrNone;
  1835 	TInt expectedValue = KErrNone;
  1825 	TPtrC uri;
  1836 	TPtrC uri;
  1826 	TPtrC uniqueId;
  1837 	TPtrC uniqueId;
  1862 	SetTestStepName(KCAFDataAttributeSetStep);
  1873 	SetTestStepName(KCAFDataAttributeSetStep);
  1863 	}
  1874 	}
  1864 
  1875 
  1865 TVerdict CCAFDataAttributeSetStep::doTestStepL()
  1876 TVerdict CCAFDataAttributeSetStep::doTestStepL()
  1866 	{
  1877 	{
       
  1878 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  1879     TBool wmdrmFlag = EFalse;     
       
  1880     GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);     
       
  1881          
       
  1882     if(wmdrmFlag)     
       
  1883         {     
       
  1884         TVerdict verdict = doWmdrmTestStepL();     
       
  1885         return verdict;     
       
  1886         }     
       
  1887 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
       
  1888 
  1867 	TInt expectedValue1;
  1889 	TInt expectedValue1;
  1868 	TInt expectedValue2;
  1890 	TInt expectedValue2;
  1869 	TInt value1;
  1891 	TInt value1;
  1870 	TInt value2;
  1892 	TInt value2;
  1871 	TInt attribute1;
  1893 	TInt attribute1;
  1927 	SetTestStepName(KCAFDataStringAttributeStep);
  1949 	SetTestStepName(KCAFDataStringAttributeStep);
  1928 	}
  1950 	}
  1929 
  1951 
  1930 TVerdict CCAFDataStringAttributeStep::doTestStepL()
  1952 TVerdict CCAFDataStringAttributeStep::doTestStepL()
  1931 	{
  1953 	{
       
  1954 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  1955     TBool wmdrmFlag = EFalse;     
       
  1956     GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);     
       
  1957          
       
  1958     if(wmdrmFlag)     
       
  1959         {     
       
  1960         TVerdict verdict = doWmdrmTestStepL();     
       
  1961         return verdict;     
       
  1962         }     
       
  1963 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT 
       
  1964 
  1932 	TInt expectedResult;
  1965 	TInt expectedResult;
  1933 	TInt attribute;
  1966 	TInt attribute;
  1934 	TPtrC expectedValue;
  1967 	TPtrC expectedValue;
  1935 	TBuf <200> value;
  1968 	TBuf <200> value;
  1936 	TInt result = KErrNone;
  1969 	TInt result = KErrNone;
  1981 	SetTestStepName(KCAFDataStringAttributeSetStep);
  2014 	SetTestStepName(KCAFDataStringAttributeSetStep);
  1982 	}
  2015 	}
  1983 
  2016 
  1984 TVerdict CCAFDataStringAttributeSetStep::doTestStepL()
  2017 TVerdict CCAFDataStringAttributeSetStep::doTestStepL()
  1985 	{
  2018 	{
       
  2019 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  2020     TBool wmdrmFlag = EFalse;     
       
  2021     GetBoolFromConfig(ConfigSection(),_L("wmdrmEnabled"), wmdrmFlag);     
       
  2022          
       
  2023     if(wmdrmFlag)     
       
  2024         {     
       
  2025         TVerdict verdict = doWmdrmTestStepL();     
       
  2026         return verdict;     
       
  2027         }     
       
  2028 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  2029   
  1986 	TPtrC expectedValue1;
  2030 	TPtrC expectedValue1;
  1987 	TPtrC expectedValue2;
  2031 	TPtrC expectedValue2;
  1988 	TBuf <200> value1;
  2032 	TBuf <200> value1;
  1989 	TBuf <200> value2;
  2033 	TBuf <200> value2;
  1990 	TInt attribute1;
  2034 	TInt attribute1;
  2196 	// finished with Data object
  2240 	// finished with Data object
  2197 	CleanupStack::PopAndDestroy(content);	
  2241 	CleanupStack::PopAndDestroy(content);	
  2198 	iIterationSum += tickCounterValAfterFileOpen - tickCounterValBeforeFileOpen;
  2242 	iIterationSum += tickCounterValAfterFileOpen - tickCounterValBeforeFileOpen;
  2199 	}
  2243 	}
  2200 	
  2244 	
  2201 
  2245 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT     
       
  2246       
       
  2247 CWmdrmCAFContentStep::~CWmdrmCAFContentStep()     
       
  2248     {     
       
  2249     }     
       
  2250       
       
  2251 CWmdrmCAFContentStep::CWmdrmCAFContentStep()     
       
  2252     {     
       
  2253     SetTestStepName(KWmdrmCAFContentStep);     
       
  2254     }     
       
  2255       
       
  2256       
       
  2257 TVerdict CWmdrmCAFContentStep::doTestStepL()     
       
  2258     {     
       
  2259     SetTestStepResult(EFail);     
       
  2260     
       
  2261     TBool protectedVal;
       
  2262     GetBoolFromConfig(ConfigSection(),_L("attribValue1"), protectedVal);     
       
  2263     TBool forwardable;     
       
  2264     GetBoolFromConfig(ConfigSection(),_L("attribValue2"), forwardable);     
       
  2265          
       
  2266     TBool headerDataPresent = ETrue;     
       
  2267     GetBoolFromConfig(ConfigSection(),_L("headerDataFlag"), headerDataPresent);     
       
  2268          
       
  2269     INFO_PRINTF1(_L("Verify CContent APIs for WMDRM content"));      
       
  2270          
       
  2271     __UHEAP_MARK;     
       
  2272          
       
  2273     CContent* content = NULL;     
       
  2274          
       
  2275     // this condition verifies that CContent construction leaves with KErrMissingWmdrmHeaderData,     
       
  2276     // when no header data is provided.     
       
  2277     if(!headerDataPresent)     
       
  2278         {     
       
  2279         content = CContent::NewL(KNullDesC8());     
       
  2280         return EPass;     
       
  2281         }     
       
  2282          
       
  2283     // create a dummy header data.     
       
  2284     HBufC8* headerData = CreateWmdrmHeaderLC();     
       
  2285          
       
  2286     // Open a file and retrieve the attributes.     
       
  2287     // If headerDataPresent is false, the code will never reach here.s     
       
  2288     content = CContent::NewL(*headerData);     
       
  2289     CleanupStack::PushL(content);     
       
  2290     CAttribute* attrs = content->NewAttributeL(ETrue);     
       
  2291     CleanupStack::PushL(attrs);     
       
  2292       
       
  2293     TBool value1 = attrs->ResponseSet().IsSet(EIsProtected);     
       
  2294     TBool value2 = attrs->ResponseSet().IsSet(EIsForwardable);     
       
  2295     if(value1 == protectedVal && value2 == forwardable)     
       
  2296         {     
       
  2297         SetTestStepResult(EPass);     
       
  2298         }     
       
  2299       
       
  2300     CleanupStack::PopAndDestroy(3, headerData);      
       
  2301       
       
  2302     __UHEAP_MARKEND;     
       
  2303     return TestStepResult();     
       
  2304     }     
       
  2305       
       
  2306       
       
  2307 CWmdrmCAFDataStep::~CWmdrmCAFDataStep()     
       
  2308     {     
       
  2309     }     
       
  2310       
       
  2311 CWmdrmCAFDataStep::CWmdrmCAFDataStep()     
       
  2312     {     
       
  2313     SetTestStepName(KWmdrmCAFDataStep);     
       
  2314     }     
       
  2315       
       
  2316 TVerdict CWmdrmCAFDataStep::doTestStepL()     
       
  2317     {     
       
  2318     SetTestStepResult(EFail);     
       
  2319          
       
  2320     TInt attribute;     
       
  2321     TInt expectedValue = KErrNone;     
       
  2322       
       
  2323     GetIntFromConfig(ConfigSection(),_L("attribute"), attribute);     
       
  2324     GetIntFromConfig(ConfigSection(),_L("value"), expectedValue);     
       
  2325          
       
  2326 __UHEAP_MARK;     
       
  2327       
       
  2328     HBufC8* headerData = CreateWmdrmHeaderLC();     
       
  2329          
       
  2330     CContent *content = CContent::NewLC(*headerData);     
       
  2331     CData *data = content->OpenContentL(EPeek);     
       
  2332     TInt value = KErrNone;     
       
  2333     User::LeaveIfError(data->GetAttribute(attribute, value));     
       
  2334     delete data;     
       
  2335          
       
  2336     if(expectedValue == value)     
       
  2337         {     
       
  2338         SetTestStepResult(EPass);     
       
  2339         }     
       
  2340     else     
       
  2341         {     
       
  2342         INFO_PRINTF3(_L("CData::GetAttribute() Expected value: %d, actual value: %d"), expectedValue, value);        
       
  2343         }     
       
  2344          
       
  2345     CleanupStack::PopAndDestroy(2, headerData);                      
       
  2346 __UHEAP_MARKEND;     
       
  2347          
       
  2348     return TestStepResult();     
       
  2349     }     
       
  2350       
       
  2351       
       
  2352 CWmdrmCAFReadStep::~CWmdrmCAFReadStep()     
       
  2353     {     
       
  2354     }     
       
  2355       
       
  2356 CWmdrmCAFReadStep::CWmdrmCAFReadStep()     
       
  2357     {     
       
  2358     SetTestStepName(KWmdrmCAFReadStep);     
       
  2359     }     
       
  2360       
       
  2361       
       
  2362 TVerdict CWmdrmCAFReadStep::doTestStepL()     
       
  2363     {     
       
  2364     SetTestStepResult(EFail);     
       
  2365          
       
  2366     TBool synchronous = EFalse;     
       
  2367     GetBoolFromConfig(ConfigSection(),_L("synchronous"), synchronous);     
       
  2368     TBool intent = EFalse;     
       
  2369     GetBoolFromConfig(ConfigSection(),_L("intent"), intent);     
       
  2370     TPtrC inputPacket;     
       
  2371     GetStringFromConfig(ConfigSection(),_L("inputPacket"), inputPacket);     
       
  2372     TPtrC expectedOutput;     
       
  2373     GetStringFromConfig(ConfigSection(),_L("outputPacket"), expectedOutput);     
       
  2374          
       
  2375 __UHEAP_MARK;     
       
  2376     TPtrC header;     
       
  2377     HBufC8* headerData = NULL;     
       
  2378          
       
  2379     if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
       
  2380         {     
       
  2381         headerData = ConvertDes16toHBufC8LC(header);     
       
  2382         }     
       
  2383     else     
       
  2384         {     
       
  2385         headerData = CreateWmdrmHeaderLC();      
       
  2386         }     
       
  2387          
       
  2388     TInt result = 0;     
       
  2389     if(!synchronous)     
       
  2390         {     
       
  2391         result = TestAsynchronousReadL(*headerData, intent, inputPacket, expectedOutput);     
       
  2392         }     
       
  2393     else     
       
  2394         {     
       
  2395         result = TestSynchronousReadL(*headerData, intent, inputPacket, expectedOutput);     
       
  2396         }     
       
  2397       
       
  2398     if(result == KErrNone)     
       
  2399         {     
       
  2400         SetTestStepResult(EPass);     
       
  2401         }     
       
  2402              
       
  2403     CleanupStack::PopAndDestroy(headerData);     
       
  2404 __UHEAP_MARKEND;     
       
  2405       
       
  2406     return TestStepResult();     
       
  2407     }     
       
  2408          
       
  2409 TInt CWmdrmCAFReadStep::TestSynchronousReadL(const TDesC8& aHeaderData, TBool aIntent, TDesC& aInputPacket, TDesC& aExpectedOutput)     
       
  2410     {     
       
  2411 __UHEAP_MARK;     
       
  2412     CData* data = NULL;     
       
  2413     TInt returnVal = KErrGeneral;     
       
  2414          
       
  2415     if(aIntent)     
       
  2416         {     
       
  2417         data = CData::NewL(aHeaderData, EPeek);     
       
  2418         }     
       
  2419     else     
       
  2420         {     
       
  2421         data = CData::NewL(aHeaderData);     
       
  2422         }     
       
  2423          
       
  2424     CleanupStack::PushL(data);     
       
  2425          
       
  2426     if(aInputPacket.Length() <= 0)     
       
  2427         {     
       
  2428         // dummy output buffer.This loop essentially tests the error condition KErrInsufficientDataPacketLength.     
       
  2429         TBuf8<2> outputBuffer;     
       
  2430         User::LeaveIfError(data->Read(KNullDesC8(), outputBuffer));     
       
  2431         }     
       
  2432              
       
  2433     else     
       
  2434         {     
       
  2435         HBufC8* inputPacket = ConvertDes16toHBufC8LC(aInputPacket);     
       
  2436         HBufC8* outputPacket = HBufC8::NewLC(aInputPacket.Length());     
       
  2437         TPtr8 outputPacketPtr = outputPacket->Des();     
       
  2438          
       
  2439         User::LeaveIfError(data->Read(*inputPacket, outputPacketPtr));     
       
  2440         HBufC8* expectedOutput = ConvertDes16toHBufC8LC(aExpectedOutput);     
       
  2441         if(expectedOutput->Compare(*outputPacket) == KErrNone)     
       
  2442             {     
       
  2443             returnVal = KErrNone;        
       
  2444             }     
       
  2445          
       
  2446         CleanupStack::PopAndDestroy(3, inputPacket);         
       
  2447         }     
       
  2448          
       
  2449     CleanupStack::PopAndDestroy(data);     
       
  2450 __UHEAP_MARKEND;     
       
  2451          
       
  2452     return returnVal;     
       
  2453     }     
       
  2454          
       
  2455 TInt CWmdrmCAFReadStep::TestAsynchronousReadL(const TDesC8& aHeaderData, TBool aIntent, TDesC& aInputPacket, TDesC& aExpectedOutput)     
       
  2456     {     
       
  2457 __UHEAP_MARK;     
       
  2458     CData* data = NULL;     
       
  2459     TInt returnVal = KErrGeneral;     
       
  2460          
       
  2461     if(aIntent)     
       
  2462         {     
       
  2463         data = CData::NewL(aHeaderData, EPeek);     
       
  2464         }     
       
  2465     else     
       
  2466         {     
       
  2467         data = CData::NewL(aHeaderData);     
       
  2468         }     
       
  2469          
       
  2470     CleanupStack::PushL(data);     
       
  2471          
       
  2472     if(aInputPacket.Length() <= 0)     
       
  2473         {     
       
  2474         TBuf8<2> outputBuffer;     
       
  2475         User::LeaveIfError(data->Read(KNullDesC8(), outputBuffer));     
       
  2476         }     
       
  2477              
       
  2478     else     
       
  2479         {     
       
  2480         HBufC8* inputPacket = ConvertDes16toHBufC8LC(aInputPacket);     
       
  2481         HBufC8* outputPacket = HBufC8::NewLC(aInputPacket.Length());     
       
  2482         TPtr8 outputPacketPtr = outputPacket->Des();     
       
  2483          
       
  2484         TRequestStatus status;     
       
  2485         data->Read(*inputPacket, outputPacketPtr, status);     
       
  2486         User::WaitForRequest(status);     
       
  2487          
       
  2488         if(status.Int() != KErrNone)     
       
  2489             {     
       
  2490             CleanupStack::PopAndDestroy(3, data);     
       
  2491             return status.Int();     
       
  2492             }     
       
  2493              
       
  2494         HBufC8* expectedOutput = ConvertDes16toHBufC8LC(aExpectedOutput);     
       
  2495         if(expectedOutput->Compare(*outputPacket) == KErrNone)     
       
  2496             {     
       
  2497             returnVal = KErrNone;     
       
  2498             }     
       
  2499          
       
  2500         CleanupStack::PopAndDestroy(3, inputPacket);     
       
  2501         }     
       
  2502          
       
  2503     CleanupStack::PopAndDestroy(data);     
       
  2504 __UHEAP_MARKEND;     
       
  2505          
       
  2506     return returnVal;     
       
  2507     }     
       
  2508          
       
  2509 TVerdict CCAFDataAttributeStep::doWmdrmTestStepL()     
       
  2510     {     
       
  2511     SetTestStepResult(EFail);     
       
  2512          
       
  2513     TInt attribVal;     
       
  2514     GetIntFromConfig(ConfigSection(),_L("attribute"), attribVal);     
       
  2515          
       
  2516     TInt expectedValue;     
       
  2517     GetIntFromConfig(ConfigSection(),_L("value"), expectedValue);     
       
  2518       
       
  2519 __UHEAP_MARK;     
       
  2520     TPtrC header;     
       
  2521     HBufC8* headerData = NULL;     
       
  2522          
       
  2523     if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
       
  2524         {     
       
  2525         headerData = ConvertDes16toHBufC8LC(header);     
       
  2526         }     
       
  2527     else     
       
  2528         {     
       
  2529         headerData = CreateWmdrmHeaderLC();      
       
  2530         }     
       
  2531              
       
  2532     CContent *content = CContent::NewLC(*headerData);     
       
  2533     CData *data = content->OpenContentL(EPeek);     
       
  2534     TInt value;     
       
  2535     User::LeaveIfError(data->GetAttribute(attribVal, value));     
       
  2536     delete data;     
       
  2537          
       
  2538     if(expectedValue == value)     
       
  2539         {     
       
  2540         SetTestStepResult(EPass);     
       
  2541         }     
       
  2542     else     
       
  2543         {     
       
  2544         INFO_PRINTF3(_L("CData::GetAttribute() Expected value: %d, actual value: %d"), expectedValue, value);        
       
  2545         }     
       
  2546          
       
  2547     CleanupStack::PopAndDestroy(2, headerData);                      
       
  2548 __UHEAP_MARKEND;     
       
  2549       
       
  2550     return TestStepResult();     
       
  2551     }     
       
  2552          
       
  2553       
       
  2554 TVerdict CCAFDataAttributeSetStep::doWmdrmTestStepL()     
       
  2555     {     
       
  2556     SetTestStepResult(EFail);     
       
  2557          
       
  2558     TInt attribute1;     
       
  2559     GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1);     
       
  2560          
       
  2561     TInt attribute2;     
       
  2562     GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2);     
       
  2563          
       
  2564     TInt expectedValue1;     
       
  2565     GetIntFromConfig(ConfigSection(),_L("value1"),expectedValue1);     
       
  2566          
       
  2567     TInt expectedValue2;     
       
  2568     GetIntFromConfig(ConfigSection(),_L("value2"),expectedValue2);     
       
  2569       
       
  2570 __UHEAP_MARK;     
       
  2571       
       
  2572     TPtrC header;     
       
  2573     HBufC8* headerData = NULL;     
       
  2574          
       
  2575     if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
       
  2576         {     
       
  2577         headerData = ConvertDes16toHBufC8LC(header);     
       
  2578         }     
       
  2579     else     
       
  2580         {     
       
  2581         headerData = CreateWmdrmHeaderLC();      
       
  2582         }     
       
  2583          
       
  2584     CContent *content = CContent::NewLC(*headerData);     
       
  2585     CData *data = content->OpenContentL(EPeek);     
       
  2586                      
       
  2587     RAttributeSet attributeSet;     
       
  2588     CleanupClosePushL(attributeSet);     
       
  2589     attributeSet.AddL(attribute1);     
       
  2590     attributeSet.AddL(attribute2);     
       
  2591              
       
  2592     TInt result = data->GetAttributeSet(attributeSet);     
       
  2593     delete data;     
       
  2594          
       
  2595     if(result == KErrNone)     
       
  2596         {     
       
  2597         TInt value1;         
       
  2598         User::LeaveIfError(attributeSet.GetValue(attribute1, value1));     
       
  2599              
       
  2600         TInt value2;     
       
  2601         User::LeaveIfError(attributeSet.GetValue(attribute2, value2));     
       
  2602              
       
  2603         if(expectedValue1 == value1 && expectedValue2 == value2 && attributeSet.Count() == 2)     
       
  2604             {     
       
  2605             SetTestStepResult(EPass);     
       
  2606             }     
       
  2607         else     
       
  2608             {     
       
  2609             INFO_PRINTF1(_L("CData::GetAttributeSet() values don't match expected values"));     
       
  2610             }     
       
  2611         }     
       
  2612          
       
  2613     else     
       
  2614         {     
       
  2615         INFO_PRINTF1(_L("CData::GetAttributeSet() failed"));     
       
  2616         }     
       
  2617              
       
  2618     CleanupStack::PopAndDestroy(3, headerData);          
       
  2619          
       
  2620 __UHEAP_MARKEND;     
       
  2621       
       
  2622     return TestStepResult();     
       
  2623     }     
       
  2624       
       
  2625       
       
  2626 TVerdict CCAFDataStringAttributeStep::doWmdrmTestStepL()     
       
  2627     {     
       
  2628     SetTestStepResult(EFail);     
       
  2629          
       
  2630     TInt attribVal;     
       
  2631     GetIntFromConfig(ConfigSection(),_L("attribute"),attribVal);     
       
  2632          
       
  2633     TPtrC expectedValue;     
       
  2634     GetStringFromConfig(ConfigSection(),_L("value"),expectedValue);     
       
  2635          
       
  2636     TInt expectedResult;     
       
  2637     GetIntFromConfig(ConfigSection(),_L("result"),expectedResult);     
       
  2638          
       
  2639 __UHEAP_MARK;     
       
  2640     TPtrC header;     
       
  2641     HBufC8* headerData = NULL;     
       
  2642          
       
  2643     if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
       
  2644         {     
       
  2645         headerData = ConvertDes16toHBufC8LC(header);     
       
  2646         }     
       
  2647     else     
       
  2648         {     
       
  2649         headerData = CreateWmdrmHeaderLC();      
       
  2650         }     
       
  2651          
       
  2652     CContent *content = CContent::NewLC(*headerData);     
       
  2653     CData *data = content->OpenContentL(EPeek);     
       
  2654                  
       
  2655     TBuf <200> value;     
       
  2656     TInt result = data->GetStringAttribute(attribVal, value);     
       
  2657     delete data;     
       
  2658          
       
  2659     if(result == expectedResult && value == expectedValue)     
       
  2660         {     
       
  2661         SetTestStepResult(EPass);     
       
  2662         }     
       
  2663     else     
       
  2664         {     
       
  2665         INFO_PRINTF3(_L("CData::GetStringAttribute() Expected result: %d, actual result: %d"), expectedResult, result);     
       
  2666         INFO_PRINTF3(_L("CData::GetStringAttribute() Expected value: %S, actual value: %S"), &expectedValue, &value);     
       
  2667         }     
       
  2668              
       
  2669     CleanupStack::PopAndDestroy(2, headerData);          
       
  2670              
       
  2671 __UHEAP_MARKEND;     
       
  2672       
       
  2673     return TestStepResult();     
       
  2674     }     
       
  2675       
       
  2676       
       
  2677 TVerdict CCAFDataStringAttributeSetStep::doWmdrmTestStepL()     
       
  2678     {     
       
  2679     SetTestStepResult(EFail);     
       
  2680       
       
  2681     TInt attribute1;         
       
  2682     GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1);     
       
  2683          
       
  2684     TInt attribute2;     
       
  2685     GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2);     
       
  2686          
       
  2687     TPtrC expectedValue1;     
       
  2688     GetStringFromConfig(ConfigSection(),_L("value1"),expectedValue1);     
       
  2689          
       
  2690     TPtrC expectedValue2;     
       
  2691     GetStringFromConfig(ConfigSection(),_L("value2"),expectedValue2);     
       
  2692          
       
  2693 __UHEAP_MARK;     
       
  2694     TPtrC header;     
       
  2695     HBufC8* headerData = NULL;     
       
  2696          
       
  2697     if(GetStringFromConfig(ConfigSection(),_L("header"), header))     
       
  2698         {     
       
  2699         headerData = ConvertDes16toHBufC8LC(header);     
       
  2700         }     
       
  2701     else     
       
  2702         {     
       
  2703         headerData = CreateWmdrmHeaderLC();      
       
  2704         }     
       
  2705          
       
  2706     CContent *content = CContent::NewLC(*headerData);     
       
  2707     CData *data = content->OpenContentL(EPeek);     
       
  2708          
       
  2709     RStringAttributeSet attributeSet;     
       
  2710     CleanupClosePushL(attributeSet);     
       
  2711     attributeSet.AddL(attribute1);     
       
  2712     attributeSet.AddL(attribute2);     
       
  2713              
       
  2714     TInt result = data->GetStringAttributeSet(attributeSet);     
       
  2715     delete data;     
       
  2716              
       
  2717     TBuf <200> value1;     
       
  2718     TBuf <200> value2;     
       
  2719     if(result == KErrNone)     
       
  2720         {     
       
  2721         TInt result3 = attributeSet.GetValue(attribute1, value1);     
       
  2722         TInt result4 = attributeSet.GetValue(attribute2, value2);     
       
  2723                  
       
  2724         if(value1 == expectedValue1 && value2 == expectedValue2 && attributeSet.Count() == 2     
       
  2725          && result3 == KErrNone && result4 == KErrNone)     
       
  2726             {     
       
  2727             SetTestStepResult(EPass);     
       
  2728             }     
       
  2729         else     
       
  2730             {     
       
  2731             INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1.Expected value: %S, actual value: %S"), &expectedValue1, &value1);     
       
  2732             INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2.Expected value: %S, actual value: %S"), &expectedValue2, &value2);     
       
  2733             INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1. Expected result: %d, actual result: %d"), 0, result3);     
       
  2734             INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2. Expected result: %d, actual result: %d"), 0, result4);      
       
  2735             }     
       
  2736         }     
       
  2737     else     
       
  2738         {     
       
  2739         INFO_PRINTF1(_L("CData::GetStringAttributeSet() failed"));     
       
  2740         }        
       
  2741          
       
  2742     CleanupStack::PopAndDestroy(3, headerData);          
       
  2743       
       
  2744 __UHEAP_MARKEND;     
       
  2745       
       
  2746     return TestStepResult();     
       
  2747     }     
       
  2748       
       
  2749 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT