|
1 // Copyright (c) 2006-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 #ifndef CFAKEOUTPUTSTREAM_H |
|
17 #define CFAKEOUTPUTSTREAM_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <test/tefunit.h> |
|
21 #include "moutputstream.h" |
|
22 |
|
23 class MOutputStreamObserver; |
|
24 class MOutputStreamSecureObserver; |
|
25 |
|
26 /** |
|
27 A dummy output stream object. |
|
28 This object records data that is "sent" via SendDataReq() |
|
29 The owner of this object can access this data via PtrOutput() in order |
|
30 to test that expected data has been sent. |
|
31 @internalTechnology |
|
32 @prototype |
|
33 */ |
|
34 class CFakeOutputStream : public CBase |
|
35 , public MOutputStream |
|
36 { |
|
37 public: |
|
38 static CFakeOutputStream* NewL(CTestExecuteLogger& aLogger); |
|
39 ~CFakeOutputStream(); |
|
40 |
|
41 // Implement MOutputStream |
|
42 void Bind(MOutputStreamObserver& aObserver, TInt aLogId); |
|
43 void BindSecure(MOutputStreamSecureObserver& aObserver); |
|
44 void SendDataReq(const TDesC8& aBuffer, TInt aIdleTime = 0); |
|
45 void SecureClientReq(const TDesC8& aHostName); |
|
46 void Close(); |
|
47 |
|
48 // Access to recorded output data |
|
49 TPtrC8 PtrOutput(); |
|
50 void ResetOutput(); |
|
51 |
|
52 // Logging |
|
53 inline CTestExecuteLogger& Logger() { return iLogger; } |
|
54 |
|
55 private: |
|
56 CFakeOutputStream(CTestExecuteLogger& aLogger); |
|
57 void ConstructL(); |
|
58 |
|
59 /** |
|
60 Records data that has been sent via SendDataReq() |
|
61 */ |
|
62 CBufFlat* iOutputBuffer; |
|
63 |
|
64 CTestExecuteLogger& iLogger; |
|
65 |
|
66 MOutputStreamObserver* iOutputStreamObserver; |
|
67 }; |
|
68 |
|
69 #endif // CFAKEOUTPUTSTREAM_H |