1 // Copyright (c) 2008-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "te_ipups_ups_step.h" |
|
23 #include "te_ipups_notify_count.h" |
|
24 #include "upstestnotifierproperties.h" |
|
25 |
|
26 CIpUpsNotifyCount::CIpUpsNotifyCount() |
|
27 /** |
|
28 * Constructor |
|
29 */ |
|
30 { |
|
31 SetTestStepName(KIpUpsNotifyCount); |
|
32 } |
|
33 |
|
34 CIpUpsNotifyCount::~CIpUpsNotifyCount() |
|
35 /** |
|
36 * Destructor |
|
37 */ |
|
38 { |
|
39 } |
|
40 |
|
41 TVerdict CIpUpsNotifyCount::doTestStepPreambleL() |
|
42 /** |
|
43 * @return - TVerdict code |
|
44 */ |
|
45 { |
|
46 TSecurityPolicy nullPolicy(ECapability_None); |
|
47 TInt err; |
|
48 |
|
49 //Properties modified to be returned to test harness from test notifier |
|
50 err = RProperty::Define(KUidPSUPSTestNotifCategory, KUnStart, KUnCountKeyType, nullPolicy, nullPolicy); |
|
51 if (err != KErrAlreadyExists && err != KErrNone) |
|
52 { |
|
53 User::LeaveIfError(err); |
|
54 } |
|
55 |
|
56 //Define a new Property which would be used to store the count to retreive later for comparison |
|
57 err = RProperty::Define(KUidPSUPSTestNotifCategory, KUnStoredNotifyCount, KUnStoredCountKeyType, nullPolicy, nullPolicy); |
|
58 if (err != KErrAlreadyExists && err != KErrNone) |
|
59 { |
|
60 User::LeaveIfError(err); |
|
61 } |
|
62 |
|
63 SetTestStepResult(EPass); |
|
64 return TestStepResult(); |
|
65 } |
|
66 |
|
67 TVerdict CIpUpsNotifyCount::doTestStepL() |
|
68 /** |
|
69 * NotifyCount test step either stores the count retireved and store it in separate property defined or |
|
70 * it compares the retireved notify count with the stored value + count increment expected relative to stored. |
|
71 * @return - TVerdict code |
|
72 */ |
|
73 { |
|
74 TBool storePromptTriggerCount = EFalse; |
|
75 |
|
76 GetBoolFromConfig(ConfigSection(),KIpUpsStorePromptTriggerCount, storePromptTriggerCount); |
|
77 |
|
78 if (storePromptTriggerCount) |
|
79 { |
|
80 TInt notifyCountReturned = 0; |
|
81 User::LeaveIfError(RProperty::Get(KUidPSUPSTestNotifCategory, KUnNotifyCount, notifyCountReturned)); |
|
82 |
|
83 User::LeaveIfError(RProperty::Set(KUidPSUPSTestNotifCategory, KUnStoredNotifyCount, notifyCountReturned)); |
|
84 |
|
85 INFO_PRINTF2(_L("NotifyCount Stored ( %d )"), notifyCountReturned); |
|
86 } |
|
87 else |
|
88 { |
|
89 TInt promptTriggerCount = 0; |
|
90 |
|
91 GetIntFromConfig(ConfigSection(),KIpUpsPromptTriggerCount, promptTriggerCount); |
|
92 |
|
93 TInt notifyCountReturned = 0; |
|
94 User::LeaveIfError(RProperty::Get(KUidPSUPSTestNotifCategory, KUnNotifyCount, notifyCountReturned)); |
|
95 |
|
96 TInt sotredPromptTriggerCount = 0; |
|
97 User::LeaveIfError(RProperty::Get(KUidPSUPSTestNotifCategory, KUnStart+2, sotredPromptTriggerCount)); |
|
98 |
|
99 INFO_PRINTF3(_L("NotifyCount Expected ( %d ) <> NotifyCount Returned ( %d )"), promptTriggerCount+sotredPromptTriggerCount, notifyCountReturned); |
|
100 |
|
101 TEST ( (promptTriggerCount + sotredPromptTriggerCount) == notifyCountReturned); |
|
102 } |
|
103 |
|
104 return TestStepResult(); |
|
105 } |
|
106 |
|
107 TVerdict CIpUpsNotifyCount::doTestStepPostambleL() |
|
108 /** |
|
109 * @return - TVerdict code |
|
110 */ |
|
111 { |
|
112 return TestStepResult(); |
|
113 } |
|