sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\pipe\t_pipe3.cpp
|
sl@0
|
15 |
// This is supporting program for testing pipes.
|
sl@0
|
16 |
// This is used by main test file ( t_pipe.cpp) for testing
|
sl@0
|
17 |
// pipes in multiprocess environment.
|
sl@0
|
18 |
//
|
sl@0
|
19 |
//
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <e32test.h>
|
sl@0
|
22 |
#include <e32svr.h>
|
sl@0
|
23 |
#include "rpipe.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
LOCAL_D RTest test(_L("t_pipe3"));
|
sl@0
|
27 |
|
sl@0
|
28 |
_LIT(KPipeName2, "PipeWithNoCap");
|
sl@0
|
29 |
_LIT(KPipeName3, "PipeWithNoCapVID");
|
sl@0
|
30 |
_LIT(KPipeName4, "PipeWithRWCap");
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
LOCAL_C void RunTests(void)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
|
sl@0
|
38 |
test.Start(_L("Testing In Pipe Process 3 : Process with No Capabilities"));
|
sl@0
|
39 |
RPipe aReader, aWriter;
|
sl@0
|
40 |
|
sl@0
|
41 |
TInt ret,aSize;
|
sl@0
|
42 |
|
sl@0
|
43 |
/////// Part 1
|
sl@0
|
44 |
test.Next(_L("PIPE TEST: PipeProcess 3-1: Open Read handle to Pipe with No capability.\n"));
|
sl@0
|
45 |
ret = aReader.Open(KPipeName2,RPipe::EOpenToRead);
|
sl@0
|
46 |
test ( ret == KErrNone);
|
sl@0
|
47 |
|
sl@0
|
48 |
test.Next(_L("PIPE TEST: PipeProcess 3-2: Open Write handle to Pipe with No capability.\n"));
|
sl@0
|
49 |
ret = aWriter.Open(KPipeName2,RPipe::EOpenToWrite);
|
sl@0
|
50 |
test ( ret == KErrNone);
|
sl@0
|
51 |
|
sl@0
|
52 |
aReader.Close();
|
sl@0
|
53 |
aWriter.Close();
|
sl@0
|
54 |
|
sl@0
|
55 |
test.Next(_L("PIPE TEST: PipeProcess 3-3: Open Write handle to Pipe with No capability.\n"));
|
sl@0
|
56 |
ret = aReader.Open(KPipeName2,RPipe::EOpenToRead);
|
sl@0
|
57 |
test ( ret == KErrNone);
|
sl@0
|
58 |
ret = aWriter.Open(KPipeName2,RPipe::EOpenToWriteNamedPipeButFailOnNoReaders);
|
sl@0
|
59 |
test ( ret == KErrNone);
|
sl@0
|
60 |
|
sl@0
|
61 |
aReader.Close();
|
sl@0
|
62 |
aWriter.Close();
|
sl@0
|
63 |
|
sl@0
|
64 |
test.Next(_L("PIPE TEST: PipeProcess 3-4: Destroy Pipe with No capability.\n"));
|
sl@0
|
65 |
ret = RPipe::Destroy (KPipeName2);
|
sl@0
|
66 |
test ( ret == KErrNone);
|
sl@0
|
67 |
|
sl@0
|
68 |
/////// Part 2
|
sl@0
|
69 |
test.Next(_L("PIPE TEST: PipeProcess 3-5: Open Read handle to Pipe with Read-Write capability.\n"));
|
sl@0
|
70 |
ret = aReader.Open(KPipeName4,RPipe::EOpenToRead);
|
sl@0
|
71 |
test ( ret == KErrPermissionDenied);
|
sl@0
|
72 |
|
sl@0
|
73 |
test.Next(_L("PIPE TEST: PipeProcess 3-6: Open Write handle to Pipe with Read-Write capability.\n"));
|
sl@0
|
74 |
ret = aWriter.Open(KPipeName4,RPipe::EOpenToWrite);
|
sl@0
|
75 |
test ( ret == KErrPermissionDenied);
|
sl@0
|
76 |
|
sl@0
|
77 |
aReader.Close();
|
sl@0
|
78 |
aWriter.Close();
|
sl@0
|
79 |
|
sl@0
|
80 |
/////// Part 3
|
sl@0
|
81 |
test.Next(_L("PIPE TEST: PipeProcess 3-7: Open Read handle to Pipe with No capability.\n"));
|
sl@0
|
82 |
ret = aReader.Open(KPipeName3,RPipe::EOpenToRead);
|
sl@0
|
83 |
test ( ret == KErrNone);
|
sl@0
|
84 |
|
sl@0
|
85 |
test.Next(_L("PIPE TEST: PipeProcess 3-8: Open Write handle to Pipe with No capability.\n"));
|
sl@0
|
86 |
ret = aWriter.Open(KPipeName3,RPipe::EOpenToWrite);
|
sl@0
|
87 |
test ( ret == KErrNone);
|
sl@0
|
88 |
|
sl@0
|
89 |
aReader.Close();
|
sl@0
|
90 |
aWriter.Close();
|
sl@0
|
91 |
|
sl@0
|
92 |
test.Next(_L("PIPE TEST: PipeProcess 3-9: Destroy Pipe with No capability.\n"));
|
sl@0
|
93 |
ret = RPipe::Destroy (KPipeName3);
|
sl@0
|
94 |
test ( ret == KErrNone);
|
sl@0
|
95 |
|
sl@0
|
96 |
/////// Part 4
|
sl@0
|
97 |
aSize = 10;
|
sl@0
|
98 |
ret = RPipe::Create( aSize,
|
sl@0
|
99 |
aReader,
|
sl@0
|
100 |
aWriter,
|
sl@0
|
101 |
EOwnerProcess,//TOwnerType aTypeW
|
sl@0
|
102 |
EOwnerProcess//TOwnerType aTypeW
|
sl@0
|
103 |
);
|
sl@0
|
104 |
|
sl@0
|
105 |
test.Next(_L("PIPE TEST: PipeProcess 3-10: Create UnNamed Pipe. It shall be allow.\n"));
|
sl@0
|
106 |
test ( ret == KErrNone);
|
sl@0
|
107 |
aReader.Close();
|
sl@0
|
108 |
aWriter.Close();
|
sl@0
|
109 |
|
sl@0
|
110 |
test.End();
|
sl@0
|
111 |
test.Close();
|
sl@0
|
112 |
|
sl@0
|
113 |
/////// Test End
|
sl@0
|
114 |
|
sl@0
|
115 |
return;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
GLDEF_C TInt E32Main()
|
sl@0
|
119 |
{
|
sl@0
|
120 |
|
sl@0
|
121 |
test.Title();
|
sl@0
|
122 |
|
sl@0
|
123 |
RunTests();
|
sl@0
|
124 |
|
sl@0
|
125 |
return KErrNone;
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|