当前位置: 首页>>代码示例>>C++>>正文


C++ CMsvSession::InstallMtmGroup方法代码示例

本文整理汇总了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);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:47,代码来源:CMtfTestActionInstallMtmGroup.cpp

示例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
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:72,代码来源:t_defect.cpp


注:本文中的CMsvSession::InstallMtmGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。