|
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 #ifdef EMPTY_HEADERS_TEST |
|
17 |
|
18 #pragma message("Building with additional test code to allow the checking of the acceptance of OBEX requests that contain empty headers.") |
|
19 #include <e32base.h> |
|
20 #include <obexheaders.h> |
|
21 #include "emptyheaderstest.h" |
|
22 |
|
23 |
|
24 CObexEmptyHeaderTest* CObexEmptyHeaderTest::NewL(TPtrC aName, TPtrC8 aType, TPtrC aDesc, TPtrC8 aTarget, TPtrC8 aAppParam) |
|
25 { |
|
26 CObexEmptyHeaderTest* ret = new (ELeave) CObexEmptyHeaderTest(); |
|
27 CleanupStack::PushL(ret); |
|
28 ret->ConstructL( aName, aType, aDesc, aTarget, aAppParam ); |
|
29 CleanupStack::Pop(); |
|
30 return ret; |
|
31 } |
|
32 |
|
33 |
|
34 CObexEmptyHeaderTest* CObexEmptyHeaderTest::NewL() |
|
35 { |
|
36 CObexEmptyHeaderTest* ret = new (ELeave) CObexEmptyHeaderTest(); |
|
37 CleanupStack::PushL(ret); |
|
38 ret->ConstructL( _L(""), _L8(""), _L(""), _L8(""), _L8("") ); |
|
39 CleanupStack::Pop(); |
|
40 return ret; |
|
41 } |
|
42 |
|
43 CObexEmptyHeaderTest::CObexEmptyHeaderTest() |
|
44 { |
|
45 |
|
46 } |
|
47 |
|
48 void CObexEmptyHeaderTest::ConstructL(TPtrC aName, TPtrC8 aType, TPtrC aDesc, TPtrC8 aTarget, TPtrC8 aAppParam) |
|
49 { |
|
50 iBuffer = CBufFlat::NewL(10); |
|
51 iBuffer->InsertL(0, _L8("CObexEmptyHeaderTest constructed, which allows the checking of the acceptance of OBEX requests that contain empty headers.")); |
|
52 |
|
53 iObexBufObject = CObexBufObject::NewL(iBuffer); |
|
54 |
|
55 iNameHeader = CObexHeader::NewL(); |
|
56 iTypeHeader = CObexHeader::NewL(); |
|
57 iDescriptionHeader = CObexHeader::NewL(); |
|
58 iTargetHeader = CObexHeader::NewL(); |
|
59 iAppParamHeader = CObexHeader::NewL(); |
|
60 |
|
61 SetHeaders(aName, aType, aDesc, aTarget, aAppParam); |
|
62 |
|
63 iObexBufObject->AddHeaderL( *iNameHeader ); |
|
64 iObexBufObject->AddHeaderL( *iTypeHeader ); |
|
65 iObexBufObject->AddHeaderL( *iDescriptionHeader ); |
|
66 iObexBufObject->AddHeaderL( *iTargetHeader ); |
|
67 iObexBufObject->AddHeaderL( *iAppParamHeader ); |
|
68 } |
|
69 |
|
70 void CObexEmptyHeaderTest::SetHeadersL(TPtrC aName, TPtrC8 aType, TPtrC aDesc, TPtrC8 aTarget, TPtrC8 aAppParam) |
|
71 { |
|
72 iNameHeader->SetUnicodeL( 0x01, aName ); |
|
73 iTypeHeader->SetByteSeqL(0x42, aType); |
|
74 iDescriptionHeader ->SetUnicodeL(0x05, aDesc); |
|
75 iTargetHeader->SetByteSeqL(0x46, aTarget); |
|
76 iAppParamHeader->SetByteSeqL(0x4C, aAppParam); |
|
77 } |
|
78 |
|
79 CObexEmptyHeaderTest::~CObexEmptyHeaderTest() |
|
80 { |
|
81 delete iObexBufObject; |
|
82 delete iBuffer; |
|
83 } |
|
84 |
|
85 CObexBufObject* CObexEmptyHeaderTest::ObexObject() const |
|
86 { |
|
87 return iObexBufObject; |
|
88 } |
|
89 #endif //EMPTY_HEADERS_TEST |