kerneltest/e32test/mmu/t_asid_dummy.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-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 the License "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 // e32test\misc\t_asid.cpp
       
    15 // 
       
    16 //
       
    17 #define __E32TEST_EXTENSION__
       
    18 #include <e32test.h>
       
    19 #include "t_asid.h"
       
    20 #include "d_asid.h"
       
    21 
       
    22 RTest test(_L("T_ASID_DUMMY"));
       
    23 
       
    24 class RAsidSession : RSessionBase
       
    25 	{
       
    26 public:
       
    27 	TInt CreateSession(const TDesC& aServerName, TInt aMsgSlots) 
       
    28 		{ 
       
    29 		return RSessionBase::CreateSession(aServerName,User::Version(),aMsgSlots);
       
    30 		}
       
    31 	TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr)
       
    32 		{
       
    33 		return (SendReceive(aFunction, aPtr));
       
    34 		}
       
    35 	TInt PublicSend(TInt aFunction, const TIpcArgs &aPtr)
       
    36 		{
       
    37 		return (Send(aFunction, aPtr));
       
    38 		}
       
    39 	};
       
    40 
       
    41 GLDEF_C TInt E32Main()
       
    42 	{
       
    43 
       
    44 	TUint len = User::CommandLineLength();
       
    45 	if (len > 0)
       
    46 		{
       
    47 		HBufC* buf = HBufC::New(len);
       
    48 		test(buf != NULL);
       
    49 		TPtr ptr = buf->Des();
       
    50 		User::CommandLine(ptr);
       
    51 
       
    52 		if (ptr == KAsidIpcServerName)
       
    53 			{
       
    54 			TUint8 array[KAsidDesLen];
       
    55 			memset(array, KAsidValue, KAsidDesLen);
       
    56 			TPtr8 buf(array, KAsidDesLen, KAsidDesLen);
       
    57 
       
    58 			RAsidSession session;
       
    59 			test_KErrNone(session.CreateSession(KAsidIpcServerName, 1));
       
    60 
       
    61 			test_KErrNone(session.PublicSendReceive(EIpcData, TIpcArgs(&buf)));
       
    62 			test_KErrNone(session.PublicSend(EIpcData, TIpcArgs(&buf)));
       
    63 			// Just exit badly, i.e. without disconnecting...
       
    64 			}
       
    65 		else if (ptr == KAsidDesServerName)
       
    66 			{
       
    67 			TUint8 array[KAsidDesLen];
       
    68 			memset(array, KAsidValue, KAsidDesLen);
       
    69 			TPtr8 buf(array, KAsidDesLen, KAsidDesLen);
       
    70 
       
    71 			// Get the current thread pointer to pass to server.		
       
    72 			TAny* threadPtr;
       
    73 			RAsidLdd asidLdd;
       
    74 			test_KErrNone(asidLdd.Open());
       
    75 			test_KErrNone(asidLdd.GetCurrentThread(threadPtr));
       
    76 
       
    77 			RAsidSession session;
       
    78 			test_KErrNone(session.CreateSession(KAsidDesServerName, 1));
       
    79 
       
    80 			test_KErrNone(session.PublicSendReceive(EDesData, TIpcArgs((TAny*)&buf, threadPtr)));
       
    81 			test_KErrNone(session.PublicSend(EDesData, TIpcArgs((TAny*)&buf, threadPtr)));
       
    82 			// Just exit badly, i.e. without disconnecting...
       
    83 			}
       
    84 			
       
    85 		}
       
    86 
       
    87 	return KErrNone;
       
    88 	}