sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\pipe\t_pipe3.cpp sl@0: // This is supporting program for testing pipes. sl@0: // This is used by main test file ( t_pipe.cpp) for testing sl@0: // pipes in multiprocess environment. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "rpipe.h" sl@0: sl@0: sl@0: LOCAL_D RTest test(_L("t_pipe3")); sl@0: sl@0: _LIT(KPipeName2, "PipeWithNoCap"); sl@0: _LIT(KPipeName3, "PipeWithNoCapVID"); sl@0: _LIT(KPipeName4, "PipeWithRWCap"); sl@0: sl@0: sl@0: sl@0: sl@0: LOCAL_C void RunTests(void) sl@0: { sl@0: sl@0: test.Start(_L("Testing In Pipe Process 3 : Process with No Capabilities")); sl@0: RPipe aReader, aWriter; sl@0: sl@0: TInt ret,aSize; sl@0: sl@0: /////// Part 1 sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-1: Open Read handle to Pipe with No capability.\n")); sl@0: ret = aReader.Open(KPipeName2,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-2: Open Write handle to Pipe with No capability.\n")); sl@0: ret = aWriter.Open(KPipeName2,RPipe::EOpenToWrite); sl@0: test ( ret == KErrNone); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-3: Open Write handle to Pipe with No capability.\n")); sl@0: ret = aReader.Open(KPipeName2,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: ret = aWriter.Open(KPipeName2,RPipe::EOpenToWriteNamedPipeButFailOnNoReaders); sl@0: test ( ret == KErrNone); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-4: Destroy Pipe with No capability.\n")); sl@0: ret = RPipe::Destroy (KPipeName2); sl@0: test ( ret == KErrNone); sl@0: sl@0: /////// Part 2 sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-5: Open Read handle to Pipe with Read-Write capability.\n")); sl@0: ret = aReader.Open(KPipeName4,RPipe::EOpenToRead); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-6: Open Write handle to Pipe with Read-Write capability.\n")); sl@0: ret = aWriter.Open(KPipeName4,RPipe::EOpenToWrite); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: /////// Part 3 sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-7: Open Read handle to Pipe with No capability.\n")); sl@0: ret = aReader.Open(KPipeName3,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-8: Open Write handle to Pipe with No capability.\n")); sl@0: ret = aWriter.Open(KPipeName3,RPipe::EOpenToWrite); sl@0: test ( ret == KErrNone); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-9: Destroy Pipe with No capability.\n")); sl@0: ret = RPipe::Destroy (KPipeName3); sl@0: test ( ret == KErrNone); sl@0: sl@0: /////// Part 4 sl@0: aSize = 10; sl@0: ret = RPipe::Create( aSize, sl@0: aReader, sl@0: aWriter, sl@0: EOwnerProcess,//TOwnerType aTypeW sl@0: EOwnerProcess//TOwnerType aTypeW sl@0: ); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 3-10: Create UnNamed Pipe. It shall be allow.\n")); sl@0: test ( ret == KErrNone); sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.End(); sl@0: test.Close(); sl@0: sl@0: /////// Test End sl@0: sl@0: return; sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: sl@0: test.Title(); sl@0: sl@0: RunTests(); sl@0: sl@0: return KErrNone; sl@0: } sl@0: