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_pipe5.cpp sl@0: // This process has ReadDeviceData capability 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_pipe5")); sl@0: sl@0: _LIT(KPipeName2, "PipeWithNoCap"); sl@0: _LIT(KPipeName4, "PipeWithRWCap"); sl@0: _LIT(KPipeName5, "PipeWithComDDCap"); sl@0: _LIT(KPipeName6, "PipeWithRWComDDCap"); sl@0: _LIT(KPipeName7, "PipeWithRWComDDCapVID"); sl@0: _LIT(KPipeName8, "PipeWithRWRUCap"); 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 5 : Process with ReadDeviceData 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 5-1\n")); sl@0: ret = aReader.Open(KPipeName2,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-2\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 5-3\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 5-4\n")); sl@0: ret = RPipe::Destroy (KPipeName2); sl@0: test ( ret == KErrNone); sl@0: sl@0: sl@0: /////Part 2 sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-5\n")); sl@0: ret = aReader.Open(KPipeName4,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-6\n")); sl@0: ret = aWriter.Open(KPipeName4,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 5-7\n")); sl@0: ret = RPipe::Destroy (KPipeName4); sl@0: test ( ret == KErrNone); sl@0: sl@0: /////Part 3 sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-8\n")); sl@0: ret = aReader.Open(KPipeName5,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-9\n")); sl@0: ret = aWriter.Open(KPipeName5,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 5-10\n")); sl@0: ret = RPipe::Destroy (KPipeName5); sl@0: test ( ret == KErrNone); sl@0: sl@0: /////Part 4 sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-11\n")); sl@0: ret = aReader.Open(KPipeName6,RPipe::EOpenToRead); sl@0: test ( ret == KErrNone); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-12\n")); sl@0: ret = aWriter.Open(KPipeName6,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 5-13\n")); sl@0: ret = RPipe::Destroy (KPipeName6); sl@0: test ( ret == KErrNone); sl@0: sl@0: /////Part 5 sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-14\n")); sl@0: ret = aReader.Open(KPipeName7,RPipe::EOpenToRead); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-15\n")); sl@0: ret = aWriter.Open(KPipeName7,RPipe::EOpenToWrite); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-16\n")); sl@0: ret = RPipe::Destroy (KPipeName7); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: /////Part 6 sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-17\n")); sl@0: ret = aReader.Open(KPipeName8,RPipe::EOpenToRead); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-18\n")); sl@0: ret = aWriter.Open(KPipeName8,RPipe::EOpenToWrite); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: aReader.Close(); sl@0: aWriter.Close(); sl@0: sl@0: test.Next(_L("PIPE TEST: PipeProcess 5-19\n")); sl@0: ret = RPipe::Destroy (KPipeName8); sl@0: test ( ret == KErrPermissionDenied); sl@0: sl@0: /////Part 7 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 5-20\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: 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: