// -----------------------------------------------------------------------------
// CTestDomCdl::TestCRImportL
// -----------------------------------------------------------------------------
//
TInt CTestDomCdl::TestCRImportL( CStifItemParser& /*aItem*/ ) 
    {
    CCdlRefs* cdlRefs = CCdlRefs::NewL();
    CleanupStack::PushL( cdlRefs );//push
    STIF_ASSERT_NOT_NULL( cdlRefs );
    HBufC8* buf8 = HBufC8::NewMaxLC( 32 );//push
    TPtr8 ptr = buf8->Des();
    TChar theChar = 0;
    ptr.Zero();
    ptr.AppendFill( theChar, 8 );
    cdlRefs->ImportL( *buf8 );
    CleanupStack::PopAndDestroy( 2 );
    return KErrNone;
    }
예제 #2
0
TVerdict CLoopbackTestStep7::doTestStepL()
/**
Test issuing write with too large of a buffer
*/
	{
	TestErrorCodeL( iCommPort1.Open(iCommServer, KPortName1, ECommExclusive, ECommRoleDCE), _L("Opening comm port 1") );
	TestErrorCodeL( iCommPort2.Open(iCommServer, KPortName2, ECommExclusive, ECommRoleDCE), _L("Opening comm port 2") );
	
	// Create the large buffer
	HBufC8 *hugeHeapDescriptor = HBufC8::NewLC(KHugeBufferSize);
	TPtr8 hugeDescriptor = hugeHeapDescriptor->Des();
	hugeDescriptor.AppendFill('a', KHugeBufferSize);
	
	// Issue the write with the buffer that is too large
	TRequestStatus writeStatus1, readStatus1;
	iCommPort2.Write(writeStatus1, hugeDescriptor);
	User::WaitForRequest(writeStatus1);
	TestErrorCodeL(writeStatus1.Int(), KErrArgument, _L("Writing to comm port 1"));

	// Make sure write still works with normal sized buffer
	iCommPort2.Write(writeStatus1, KWriteBuf1);
	User::WaitForRequest(writeStatus1);
	TestErrorCodeL(writeStatus1.Int(), _L("Writing to comm port 1"));
		
	TBuf8<KRegularBufferSize> readBuf;
	iCommPort1.ReadOneOrMore(readStatus1, readBuf);
	User::WaitForRequest(readStatus1);
	if (readStatus1 != KErrNone)
		{
		INFO_PRINTF1(_L("Failed read"));
		SetTestStepResult(EFail);
		}

	CleanupStack::PopAndDestroy(hugeHeapDescriptor);

	return TestStepResult();
	}