|
1 // Copyright (c) 2007-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 // T_AUTOCP.CPP |
|
15 // |
|
16 // |
|
17 |
|
18 #include <s32file.h> |
|
19 #include <e32test.h> |
|
20 |
|
21 |
|
22 #include "wappushmsggen.h" |
|
23 |
|
24 |
|
25 |
|
26 class RWapPushMsgGenTest : public RTest |
|
27 { |
|
28 public: |
|
29 RWapPushMsgGenTest(); |
|
30 void TestL(); |
|
31 void Close(); |
|
32 private: |
|
33 void Test(TInt aResult); |
|
34 private: |
|
35 }; |
|
36 |
|
37 RWapPushMsgGenTest::RWapPushMsgGenTest(): |
|
38 RTest(_L("WapPushMsgGen Test Harness")) |
|
39 {} |
|
40 |
|
41 |
|
42 void RWapPushMsgGenTest::Test(TInt aResult) |
|
43 { |
|
44 operator()(aResult,__LINE__); |
|
45 } |
|
46 |
|
47 void RWapPushMsgGenTest::TestL() |
|
48 { |
|
49 Start(_L("@SYMTestCaseID IWS-WAPBROWSER-WAPPUSH-TPUSHSCRIPTBASED-T_PUSHMSGGEN-0001 Testing Wap Push Message Generation")); |
|
50 |
|
51 CWapPushMsgGen* msgGen = CWapPushMsgGen::NewL(); |
|
52 CleanupStack::PushL(msgGen); |
|
53 |
|
54 msgGen->StartNewMsgL(CWapPushMsgGen::EServiceIndication); |
|
55 msgGen->AppendFieldL(CWapPushMsgGen::EHRef, _L8("http://www.xyz.com/email/123/abc.wml")); |
|
56 msgGen->AppendFieldL(CWapPushMsgGen::EServiceIndicationCreated, _L8("1999-06-25T15.23.15Z")); |
|
57 msgGen->AppendFieldL(CWapPushMsgGen::EServiceIndicationExpires, _L8("1999-06-30t00.00Z")); |
|
58 msgGen->AppendFieldL(CWapPushMsgGen::EServiceIndicationText, _L8("You have 4 new e-mails")); |
|
59 |
|
60 HBufC8* msg = msgGen->CreateMsgLC(); |
|
61 TPtrC8 msgptr(*msg); |
|
62 CleanupStack::PopAndDestroy(); //msg |
|
63 |
|
64 |
|
65 msgGen->StartNewMsgL(CWapPushMsgGen::EServiceLoad); |
|
66 msgGen->AppendFieldL(CWapPushMsgGen::EHRef, _L8("http://www.xyz.com/ppaidl/123/abc.wml")); |
|
67 msgGen->AppendFieldL(CWapPushMsgGen::EAction, _L8("execute-high")); |
|
68 |
|
69 HBufC8* loadmsg = msgGen->CreateMsgLC(); |
|
70 |
|
71 CleanupStack::PopAndDestroy(2); // loadMsg, msgGen; |
|
72 End(); |
|
73 } |
|
74 |
|
75 void RWapPushMsgGenTest::Close() |
|
76 { |
|
77 //Do any deleting here |
|
78 RTest::Close(); |
|
79 } |
|
80 |
|
81 |
|
82 |
|
83 GLDEF_C TInt E32Main() |
|
84 { |
|
85 CTrapCleanup* tc=CTrapCleanup::New(); |
|
86 RWapPushMsgGenTest tester; |
|
87 __UHEAP_MARK; |
|
88 TRAPD(err,tester.TestL()); |
|
89 if (err!=KErrNone) |
|
90 User::Panic(_L("Failed to complete test"),err); |
|
91 tester.Close(); |
|
92 delete tc; |
|
93 User::Heap().Check(); |
|
94 __UHEAP_MARKEND; |
|
95 return KErrNone; |
|
96 } |
|
97 |