xml/wbxmlparser/test/rtest/tsrc/t_wbxmloomsyncmlparserstabilitytests.cpp
changeset 0 e35f40988205
child 24 74f0b3eb154c
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32test.h>
       
    17 
       
    18 #include "stabilitytestclass.h"
       
    19 #include "testdocuments.h"
       
    20 
       
    21 static RTest test(_L("t_wbxmloomsyncmlparserstabilitytests"));
       
    22 
       
    23 static void DeleteTestDirL()
       
    24 	{
       
    25 	RFs fsSession;
       
    26 	TInt err = fsSession.Connect();
       
    27 	if(err == KErrNone)
       
    28 		{
       
    29 		CleanupClosePushL(fsSession);
       
    30 		RDebug::Print(_L("Deleting \"%S\" directory.\n"), &KOpaqueDirectory);
       
    31 		CFileMan* fileMan = CFileMan::NewL(fsSession);
       
    32 		CleanupStack::PushL(fileMan);
       
    33 		TInt err = fileMan->RmDir(KOpaqueDirectory);
       
    34 		if(err == KErrPathNotFound)
       
    35 			{
       
    36 			err = KErrNone;
       
    37 			}
       
    38 		User::LeaveIfError(err);
       
    39 		CleanupStack::PopAndDestroy(fileMan);
       
    40 		CleanupStack::PopAndDestroy(&fsSession);
       
    41 		}
       
    42 	else
       
    43 		{
       
    44 		RDebug::Print(_L("Error %d connecting file session. Directory: %S.\n"), err, &KOpaqueDirectory);
       
    45 		}
       
    46 	}
       
    47 
       
    48 
       
    49 
       
    50 /**
       
    51 @SYMTestCaseID 		 		SYSLIB-XML-CT-3728
       
    52 @SYMTestCaseDesc		    OOM Testing.
       
    53 @SYMTestPriority 		    Medium
       
    54 @SYMTestActions  		    Parse some SyncML documents.
       
    55 @SYMTestExpectedResults 	Tests should pass.
       
    56 @SYMREQ			 		 	REQ0000
       
    57 */
       
    58 static void SyncmlOomTestsL()
       
    59 	{
       
    60 	test.Next(_L(" @SYMTestCaseID:SYSLIB-XML-CT-3728 SyncmlTestsL tests... "));
       
    61 
       
    62 	__UHEAP_MARK;
       
    63 
       
    64 	CStabilityTestClass* syncmlTestMaxWithOpaque = CStabilityTestClass::NewL(test, ETrue, KMaxChunkSize);
       
    65 	CleanupStack::PushL(syncmlTestMaxWithOpaque);
       
    66 	syncmlTestMaxWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestWholeL);
       
    67 	syncmlTestMaxWithOpaque->StabilityTestL(KSyncML1_1Directory(), KWbxmlExt(), &CStabilityTestClass::TestChunkL);
       
    68 	CleanupStack::PopAndDestroy(syncmlTestMaxWithOpaque);
       
    69 
       
    70 	CStabilityTestClass* syncmlTestMax = CStabilityTestClass::NewL(test, ETrue, KMaxChunkSize);
       
    71 	CleanupStack::PushL(syncmlTestMax);
       
    72 	syncmlTestMax->StabilityTestL(KOpaqueDirectory(), 	 KWbxmlExt(), &CStabilityTestClass::TestWholeL);
       
    73 	syncmlTestMax->StabilityTestL(KOpaqueDirectory(), 	 KWbxmlExt(), &CStabilityTestClass::TestChunkL);
       
    74 	CleanupStack::PopAndDestroy(syncmlTestMax);
       
    75 
       
    76 	::DeleteTestDirL();
       
    77 
       
    78 	__UHEAP_MARKEND;
       
    79 	}
       
    80 
       
    81 
       
    82 static void MainL()
       
    83 	{
       
    84 	SyncmlOomTestsL();
       
    85 	}
       
    86 
       
    87 
       
    88 TInt E32Main()
       
    89 	{
       
    90 	__UHEAP_MARK;
       
    91 	test.Title();
       
    92 	test.Start(_L("initialising"));
       
    93 
       
    94 	CTrapCleanup* c=CTrapCleanup::New();
       
    95 
       
    96 	// start the loader
       
    97 	RFs fs;
       
    98 	test (fs.Connect()==KErrNone);
       
    99 	fs.Close();
       
   100 
       
   101 	test (c!=0);
       
   102 	TRAPD(r,MainL());
       
   103 	test (r==KErrNone);
       
   104 	delete c;
       
   105 	test.End();
       
   106 	test.Close();
       
   107 	__UHEAP_MARKEND;
       
   108 	return KErrNone;
       
   109 	}