|
1 // Copyright (c) 2005-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 // Class implementation of CLbsPrivacyNotifierTest |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32debug.h> |
|
19 #include <e32test.h> |
|
20 #include <lbs/lbsloccommon.h> |
|
21 #include "LbsPrivacyNotifier.h" |
|
22 #include "lbsprivacynotifiertest.h" |
|
23 |
|
24 // Test |
|
25 _LIT(KTestName, "LBS Privacy Notifier Test"); |
|
26 LOCAL_D RTest test(KTestName); |
|
27 |
|
28 CLbsPrivacyNotifierTest* CLbsPrivacyNotifierTest::NewL() |
|
29 { |
|
30 CLbsPrivacyNotifierTest* self = new (ELeave) CLbsPrivacyNotifierTest; |
|
31 CleanupStack::PushL(self); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CLbsPrivacyNotifierTest::~CLbsPrivacyNotifierTest() |
|
38 { |
|
39 delete iNotifyNotifier; |
|
40 delete iVerifyNotifier; |
|
41 } |
|
42 |
|
43 void CLbsPrivacyNotifierTest::DoDialogTestL() |
|
44 { |
|
45 TInt error; |
|
46 TLbsExternalRequestInfo info; |
|
47 iNotifyNotifier->DisplayL(error, info); |
|
48 CActiveScheduler::Start(); |
|
49 |
|
50 iVerifyNotifier->DisplayL(error, info); |
|
51 CActiveScheduler::Start(); |
|
52 } |
|
53 |
|
54 void CLbsPrivacyNotifierTest::OnNotificationDialogResponse(TInt aErr, const TLbsPrivacyNotifierResponse& aResponse) |
|
55 { |
|
56 RDebug::Printf("Received dialog response; aErr = %d, aResponse = %d", aErr, aResponse); |
|
57 } |
|
58 |
|
59 CLbsPrivacyNotifierTest::CLbsPrivacyNotifierTest() |
|
60 { |
|
61 |
|
62 } |
|
63 |
|
64 void CLbsPrivacyNotifierTest::ConstructL() |
|
65 { |
|
66 iNotifyNotifier = CLbsPrivacyNotifier::NewL(EPrivacyDialogNotification, 20000000); |
|
67 iNotifyNotifier->SetObserver(this); |
|
68 iVerifyNotifier = CLbsPrivacyNotifier::NewL(EPrivacyDialogVerification, 20000000); |
|
69 iVerifyNotifier->SetObserver(this); |
|
70 } |
|
71 |
|
72 |
|
73 void doMainL() |
|
74 { |
|
75 CLbsPrivacyNotifierTest* test = CLbsPrivacyNotifierTest::NewL(); |
|
76 CleanupStack::PushL(test); |
|
77 test->DoDialogTestL(); |
|
78 CleanupStack::PopAndDestroy(test); |
|
79 } |
|
80 |
|
81 GLDEF_C int E32Main() |
|
82 { |
|
83 __UHEAP_MARK; |
|
84 test.Title(); |
|
85 test.Start(KTestName); |
|
86 |
|
87 CActiveScheduler* rootScheduler = new CActiveScheduler; |
|
88 CActiveScheduler::Install(rootScheduler); |
|
89 CTrapCleanup* theCleanup=CTrapCleanup::New(); |
|
90 |
|
91 TRAPD(ret,doMainL()); |
|
92 test.Printf(_L("\nTest Completion code: %d\n"), ret); |
|
93 test(ret==KErrNone); |
|
94 |
|
95 delete theCleanup; |
|
96 delete rootScheduler; |
|
97 |
|
98 test.End(); |
|
99 test.Close(); |
|
100 |
|
101 __UHEAP_MARKEND; |
|
102 return 0; |
|
103 } |