diff -r a117e284a2c6 -r b09186059647 drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/src/DRM_CAFBlocks.cpp --- a/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/src/DRM_CAFBlocks.cpp Tue Sep 28 14:08:58 2010 +0300 +++ b/drm_pub/oma_drm_caf_agent_api/tsrc/bc/DRM_CAF/src/DRM_CAFBlocks.cpp Thu Oct 14 13:45:23 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -15,25 +15,22 @@ * */ - - - - - - - - // [INCLUDE FILES] - do not remove #include #include #include -#include "DRM_CAF.h" #include #include #include #include #include #include +#include "DRM_CAF.h" +#include "drmrightsparser.h" +#include "drmpointerarray.h" +#include "drmrights.h" +#include "drmrightsclient.h" + using namespace ContentAccess; // LOCAL CONSTANTS AND MACROS @@ -215,17 +212,66 @@ \r\n\ --random78o6bP%[GB6b/8&/45&%*^'?vS--"); +_LIT8(KROHeadOMA1, "\ +\ +\ + \ + 1.0\ + \ + \ + \ + \ + "); + +_LIT8(KROTailFullOMA1, "\ + \ + qtyAvglXxJNuAJVM2yxHQA==\ + \ + \ +\ +\ + \ + \ + \ +\ +\ + \ + \ + \ +\ +\ + \ + \ + \ +\ +\ + \ + \ + \ + \ + \ +"); + _LIT(KOma1Content, "c:\\content.dcf"); +_LIT(KOma1Content2, "c:\\content2.dcf"); _LIT(KOma2Content, "c:\\content.odf"); _LIT(KOma2ContentNoEnc, "c:\\content-noenc.odf"); _LIT(KOma2ContentNoEncTruncated, "c:\\content-noenc-trunc.odf"); +_LIT8(KOma1ContentID, "cid:testcontent20090526095637-2657230746@testcontent.com"); _LIT(KEncryptedDir, "c:\\"); _LIT(KTempDcfName, "test.dcf"); _LIT(KTempDcfPathName, "c:\\test.dcf"); _LIT(KFVariantFile,"c:\\DrmCAFVarFile.txt"); - +// LOCAL FUNCTION PROTOTYPES +LOCAL_C void AddROL(const TDesC8& aHead, const TDesC8& aCID, const TDesC8& aTail); +LOCAL_C void DeleteRODBL(); // ============================= LOCAL FUNCTIONS =============================== @@ -350,6 +396,47 @@ return rm; } +// ----------------------------------------------------------------------------- +// AddROL +// Helper function with which test cases can add ROs +// ----------------------------------------------------------------------------- +// +LOCAL_C void AddROL(const TDesC8& aHead, const TDesC8& aCID, + const TDesC8& aTail) + { + TInt roSize(aHead.Size() + aCID.Size() + aTail.Size()); + HBufC8* buf(HBufC8::NewLC(roSize)); + TPtr8 tmp(buf->Des()); + + tmp.Append(aHead); + tmp.Append(aCID); + tmp.Append(aTail); + + CDRMPointerArray* rights(CDRMPointerArray::NewLC()); + rights->SetAutoCleanup(ETrue); + + CDrmRightsParser* rp(CDrmRightsParser::NewL()); + CleanupStack::PushL(rp); + + rp->ParseAndStoreL(*buf, *rights); + + CleanupStack::PopAndDestroy(3, buf); // rp, rights, buf + } + +// ----------------------------------------------------------------------------- +// DeleteRODBL +// Helper function with which test cases can delete RO DB. +// ----------------------------------------------------------------------------- +// +LOCAL_C void DeleteRODBL() + { + RDRMRightsClient client; + User::LeaveIfError(client.Connect()); + client.DeleteAll(); + client.Close(); + } + + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -1708,36 +1795,21 @@ } TInt CDRM_CAF::CContent_NotifyStatusChangeL() { - _LIT(KSdkVersion31,"Z:\\System\\install\\Series60v3.1.sis"); - _LIT(KSdkVersion50,"Z:\\System\\install\\Series60v5.0.sis"); - RFs fs; - TBool found = EFalse; - User::LeaveIfError(fs.Connect ()); - CleanupClosePushL (fs); - if(BaflUtils::FileExists (fs, KSdkVersion31)) - { - found = ETrue; - } - else if(BaflUtils::FileExists (fs, KSdkVersion50)) - { - found = ETrue; - } CContent* content = NULL; TRequestStatus status = KRequestPending; - content = CContent::NewLC(KOma2Content); + content = CContent::NewLC(KOma1Content2); STIF_ASSERT_NOT_NULL(content); - content->NotifyStatusChange(ERightsAvailable, status);//ERightsAvailable - if(found) - { - User::After(10000); - content->CancelNotifyStatusChange(status); - User::WaitForRequest(status); - } - else - { - User::WaitForRequest(status); - } - CleanupStack::PopAndDestroy(2); + content->NotifyStatusChange(ERightsAvailable, status); //ERightsAvailable + + AddROL(KROHeadOMA1, KOma1ContentID, KROTailFullOMA1); + + User::After(10000); + content->CancelNotifyStatusChange(status); + User::WaitForRequest(status); + + DeleteRODBL(); + + CleanupStack::PopAndDestroy(content); return KErrNone; }