本文整理汇总了C++中CMsvSession::InstallMtmGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsvSession::InstallMtmGroup方法的具体用法?C++ CMsvSession::InstallMtmGroup怎么用?C++ CMsvSession::InstallMtmGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsvSession
的用法示例。
在下文中一共展示了CMsvSession::InstallMtmGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteActionL
/**
Function : ExecuteActionL
Description : Installs a new group of MTMs
@internalTechnology
@param : none
@return : void
@pre :
@post : none
*/
void CMtfTestActionInstallMtmGroup::ExecuteActionL()
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionInstallMtmGroup);
// Obtain input parameters
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),
ActionParameters().Parameter(0));
HBufC* paramFileName = ObtainParameterReferenceL<HBufC>(TestCase(),
ActionParameters().Parameter(1));
// If valid parameters received, call install MTM group
if( (paramFileName != NULL) && (paramSession != NULL) )
{
TInt result = paramSession->InstallMtmGroup(*paramFileName);
// Print the result
if(result == KErrAlreadyExists)
{
TestCase().INFO_PRINTF1(_L("MTM already installed"));
}
else if(result == KErrNone)
{
TestCase().INFO_PRINTF1(_L("MTM installed successfully"));
}
else
{
TestCase().ERR_PRINTF2(_L("MTM installation Failed with error %d"), result);
User::Leave(result);
}
}
else
{
// Invaid parameters received, leave the Test Action
User::Leave(KErrArgument);
}
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionInstallMtmGroup);
TestCase().ActionCompletedL(*this);
}
示例2: TestUiMtmLoadPanicL
LOCAL_C void TestUiMtmLoadPanicL()
{
// Make sure the server is closed
CMsgsTestUtils::WaitForServerClose();
User::After(500000);
TChar driveChar= theUtils->FileSession().GetSystemDriveChar();
TBuf<2> systemDrive;
systemDrive.Append(driveChar);
systemDrive.Append(KDriveDelimiter);
TPath pathName(systemDrive);
pathName.Append(KDefaultRegistryFileStoreName);
theUtils->FileSession().Delete(pathName);
CMtmDllInfoArray* mtmdllinfoarray=new(ELeave) CMtmDllInfoArray();
CleanupStack::PushL(mtmdllinfoarray);
// Create library info with silly imports
CMtmDllInfo* mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmServerComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,1,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmClientComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,1,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmUiComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,345,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
mtmdllinfo=CMtmDllInfo::NewL(KMtmName, TUidType(KDynamicLibraryUid, KUidMtmUiDataComponent, TUid::Uid(KUidMtmDefaultSpecificVal)),KMtmDllName,456,TVersion(2,0,0));
mtmdllinfoarray->AddMtmDllInfoL(mtmdllinfo);
TCapabilitySet capSet;
capSet.SetEmpty();
CleanupStack::Pop(mtmdllinfoarray); // next line takes ownership
CMtmGroupData* mtmgroupdata=CMtmGroupData::NewL(KUidTestMtm, KUidTestMtm, mtmdllinfoarray, capSet);
CleanupStack::PushL(mtmgroupdata);
CFileStore* filestore = CPermanentFileStore::ReplaceLC(theUtils->FileSession(), KMtmDataFile, EFileShareExclusive|EFileStream|EFileWrite);
TUidType uidtype(KPermanentFileStoreLayoutUid,KUidMsvDataComponent, KUidTestMtm);
filestore->SetTypeL(uidtype);
RStoreWriteStream out;
TStreamId streamid=out.CreateLC(*filestore); // Push to stack
mtmgroupdata->ExternalizeL(out);
out.CommitL();
CleanupStack::PopAndDestroy(); // out
filestore->SetRootL(streamid);
filestore->CommitL();
CleanupStack::PopAndDestroy(2, mtmgroupdata); // filestore, mtmgroupdata
CDummyObserver* ob = new(ELeave)CDummyObserver;
CleanupStack::PushL(ob);
CMsvSession* session = CMsvSession::OpenSyncL(*ob);
CleanupStack::PushL(session);
TInt err = session->InstallMtmGroup(KMtmDataFile);
test(err == KErrNone || err == KErrAlreadyExists);
CClientMtmRegistry* clientReg = CClientMtmRegistry::NewL(*session);
CleanupStack::PushL(clientReg);
CBaseMtm* client = NULL;
client = clientReg->NewMtmL(KUidTestMtm);
CleanupStack::PushL(client);
CMtmUiRegistry* uiReg = CMtmUiRegistry::NewL(*session);
CleanupStack::PushL(uiReg);
if (client !=NULL)
{
TRAPD(error, uiReg->NewMtmUiL(*client));
test(error == KErrBadLibraryEntryPoint);
}
CleanupStack::PopAndDestroy(5); // uiReg, client, clientReg, session, ob
}