|
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 #include <push/sislpushmsgutils.h> |
|
17 |
|
18 #include "pushtests.h" |
|
19 #include "dummywapstack.h" |
|
20 #include "wappushmsggen.h" |
|
21 |
|
22 |
|
23 //Hard coded SLC Text Msg elements |
|
24 //for 1st SL test Msg |
|
25 _LIT8(KSLCHref, "rtsp://media.example.com/123"); |
|
26 |
|
27 /** set the test name for this test case |
|
28 @param void |
|
29 @return string |
|
30 returns test name |
|
31 */ |
|
32 const TDesC& CWapPushSLCMessageTest::TestName() |
|
33 { |
|
34 _LIT(KTextSLCMessageTest,"Service Loading Content"); |
|
35 return KTextSLCMessageTest; |
|
36 } |
|
37 |
|
38 |
|
39 /** specify the number of test messages to use */ |
|
40 void CWapPushSLCMessageTest::NumberTestCasesToRun() |
|
41 { |
|
42 iNumberOfTestCases = 1; |
|
43 } |
|
44 |
|
45 |
|
46 /** create test messages to use where aTestCase represents the |
|
47 message index for multiple messages. |
|
48 Tests: 0- Complete SL Push Msg |
|
49 1- SL Push Msg with attribute 'action' not specified. |
|
50 2- SL Push Msg with attribute 'href' not specified. |
|
51 |
|
52 @param aTestCase message index value for selecting a test message |
|
53 @return void |
|
54 */ |
|
55 void CWapPushSLCMessageTest::PrepareTestMessageL(TInt aTestCase) |
|
56 { |
|
57 // create hardcoded SLC test message |
|
58 const TUint8 KMessageHeader[] = |
|
59 { |
|
60 0xB0 //Content type "application/vnd.wap.slc" |
|
61 }; |
|
62 |
|
63 iHeadersBuf.Append(KMessageHeader, sizeof(KMessageHeader)); |
|
64 |
|
65 HBufC8* msg = NULL; |
|
66 switch ( aTestCase ) |
|
67 { |
|
68 case 0 : |
|
69 _LIT8 ( KMessage1, "\x02\x06\x6A\x00\x85\x08\x03\x72\x74\x73\x70\x3A\x2F\x2F\x6D\x65\x64\x69\x61\x2E\x65\x78\x61\x6D\x70\x6C\x65\x2E\x63\x6F\x6D\x2F\x31\x32\x33\x00\x06\x01" ); |
|
70 msg = KMessage1().AllocLC (); |
|
71 break; |
|
72 } |
|
73 |
|
74 // copy data to iBodyBuf |
|
75 iBodyBuf.Delete(0,KBufferSize); |
|
76 iBodyBuf = msg->Des(); |
|
77 |
|
78 CleanupStack::PopAndDestroy(1); // msg |
|
79 } |
|
80 |
|
81 /** confirm the message has been stored in the message store. |
|
82 Writes confirmation of number of found messages to log file |
|
83 if present. |
|
84 @param void |
|
85 @return TBool |
|
86 ETrue = message(s) found |
|
87 EFalse = no message(s) found |
|
88 */ |
|
89 TBool CWapPushSLCMessageTest::ConfirmMessagesSavedL() |
|
90 { |
|
91 CSISLPushMsgUtils* wapPushUtils = CSISLPushMsgUtils::NewL(); |
|
92 CleanupStack::PushL(wapPushUtils); |
|
93 TMsvId slMsgEntryId; |
|
94 // convert KSLHref from 8 to 16 bit for FindUrlL |
|
95 HBufC* tempHref = HBufC::NewLC(KSLCHref().Length()); |
|
96 tempHref->Des().Copy(KSLCHref()); |
|
97 |
|
98 slMsgEntryId = wapPushUtils->FindUrlL(*tempHref, KUidWapPushMsgSL); |
|
99 if (slMsgEntryId) |
|
100 { |
|
101 TBuf<KPushLogBuffer> buf; |
|
102 _LIT(KLogSLId,"SLC messages stored:\t%d"); |
|
103 buf.Format(KLogSLId,slMsgEntryId); |
|
104 WPLPrintf(buf); |
|
105 } |
|
106 CleanupStack::PopAndDestroy(2); // wapPushUtils, tempHref |
|
107 return slMsgEntryId; |
|
108 } |