|
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 // |
|
15 |
|
16 #include "tbroadcastmessagingtsytesthelper.h" |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 * Constructor |
|
22 */ |
|
23 TBroadcastMessagingTsyTestHelper::TBroadcastMessagingTsyTestHelper(CCTSYIntegrationTestSuiteStepBase& aTestStep) |
|
24 : TTsyTestHelperBase( aTestStep ) |
|
25 { |
|
26 } |
|
27 /** |
|
28 * Notify reset for RMobileBroadcastMessaging::NotifyBroadcastIdListChange |
|
29 */ |
|
30 void TBroadcastMessagingTsyTestHelper::WaitForMobileBroadcastMessagingNotifyBroadcastIdListChange( |
|
31 TEtelRequestBase& aRequestStatus, |
|
32 TInt aWantedStatus ) |
|
33 |
|
34 { |
|
35 // Wait for the request to complete |
|
36 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
37 ASSERT_EQUALS(err, KErrNone, _L("RMobileBroadcastMessaging::NotifyBroadcastIdListChange did not complete")) |
|
38 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileBroadcastMessaging::NotifyBroadcastIdListChange Wrong completion status")) |
|
39 // Cancel request if it is still pending |
|
40 if (aRequestStatus.Int() == KRequestPending) |
|
41 { |
|
42 aRequestStatus.Cancel(); |
|
43 } |
|
44 } |
|
45 |
|
46 |
|
47 /** |
|
48 * Notify reset for RMobileBroadcastMessaging::NotifyFilterSettingChange |
|
49 */ |
|
50 void TBroadcastMessagingTsyTestHelper::WaitForMobileBroadcastMessagingNotifyFilterSettingChange( |
|
51 RMobileBroadcastMessaging& aMobileBroadcastMessaging, |
|
52 TEtelRequestBase& aRequestStatus, |
|
53 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter& aSetting, |
|
54 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter aExpectedSetting, |
|
55 TInt aWantedStatus ) |
|
56 |
|
57 { |
|
58 // Wait for the request to complete |
|
59 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
60 ASSERT_EQUALS(err, KErrNone, _L("RMobileBroadcastMessaging::NotifyFilterSettingChange did not complete")) |
|
61 |
|
62 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
63 && aSetting != aExpectedSetting ) |
|
64 { |
|
65 // Request has completed with incorrect result. Consume any outstanding |
|
66 // Repost notification until timeout or we get the right result. |
|
67 |
|
68 aMobileBroadcastMessaging.NotifyFilterSettingChange(aRequestStatus, aSetting); |
|
69 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
70 } |
|
71 |
|
72 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileBroadcastMessaging::NotifyFilterSettingChange Wrong completion status")) |
|
73 ASSERT_EQUALS(aSetting, aExpectedSetting, |
|
74 _L("RMobileBroadcastMessaging::NotifyFilterSettingChange Wrong result")) |
|
75 |
|
76 // Cancel request if it is still pending |
|
77 if (aRequestStatus.Int() == KRequestPending) |
|
78 { |
|
79 aRequestStatus.Cancel(); |
|
80 } |
|
81 } |
|
82 |
|
83 |
|
84 /** |
|
85 * Notify reset for RMobileBroadcastMessaging::NotifyLanguageFilterChange |
|
86 */ |
|
87 void TBroadcastMessagingTsyTestHelper::WaitForMobileBroadcastMessagingNotifyLanguageFilterChange( |
|
88 RMobileBroadcastMessaging& aMobileBroadcastMessaging, |
|
89 TEtelRequestBase& aRequestStatus, |
|
90 TDes16& aLangFilter, |
|
91 TDes16 aExpectedLangFilter, |
|
92 TInt aWantedStatus ) |
|
93 |
|
94 { |
|
95 // Wait for the request to complete |
|
96 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
97 ASSERT_EQUALS(err, KErrNone, _L("RMobileBroadcastMessaging::NotifyLanguageFilterChange did not complete")) |
|
98 |
|
99 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
100 && aLangFilter != aExpectedLangFilter ) |
|
101 { |
|
102 // Request has completed with incorrect result. Consume any outstanding |
|
103 // Repost notification until timeout or we get the right result. |
|
104 |
|
105 aMobileBroadcastMessaging.NotifyLanguageFilterChange(aRequestStatus, aLangFilter); |
|
106 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
107 } |
|
108 |
|
109 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileBroadcastMessaging::NotifyLanguageFilterChange Wrong completion status")) |
|
110 ASSERT_EQUALS_DES16(aLangFilter, aExpectedLangFilter, |
|
111 _L("RMobileBroadcastMessaging::NotifyLanguageFilterChange Wrong result")) |
|
112 |
|
113 // Cancel request if it is still pending |
|
114 if (aRequestStatus.Int() == KRequestPending) |
|
115 { |
|
116 aRequestStatus.Cancel(); |
|
117 } |
|
118 } |
|
119 |
|
120 |