748
|
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 the License "Symbian Foundation License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// @file ctlbsstepsetprivhandler.cpp
|
|
15 |
// This is the class implementation for the Set Privacy Controller Test Step
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file
|
|
23 |
@internalTechnology
|
|
24 |
@test
|
|
25 |
*/
|
|
26 |
|
|
27 |
#include "ctlbsstepsetprivhandler.h"
|
|
28 |
|
|
29 |
//Literals Used
|
|
30 |
_LIT(KHandlerType, "privhandler_type");
|
|
31 |
|
|
32 |
CT_LbsStep_SetPrivacyHandler::CT_LbsStep_SetPrivacyHandler(CT_LbsServer& aParent) : CT_LbsStep(aParent)
|
|
33 |
{
|
|
34 |
SetTestStepName(KLbsStep_SetPrivacyHandler);
|
|
35 |
}
|
|
36 |
|
|
37 |
/**
|
|
38 |
Static Constructor
|
|
39 |
*/
|
|
40 |
CT_LbsStep_SetPrivacyHandler* CT_LbsStep_SetPrivacyHandler::New(CT_LbsServer& aParent)
|
|
41 |
{
|
|
42 |
return new CT_LbsStep_SetPrivacyHandler(aParent);
|
|
43 |
// Note the lack of ELeave.
|
|
44 |
// This means that having insufficient memory will return NULL;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
/** Let LBS know whether we're using privacy controller or notifier:
|
|
49 |
*/
|
|
50 |
TBool CT_LbsStep_SetPrivacyHandler::SetAndVerifyPrivacyHandlerL(CLbsAdmin::TPrivacyHandler aPrivacyHandlerType)
|
|
51 |
{
|
|
52 |
TBool ret = TRUE;
|
|
53 |
CLbsAdmin* adminApi = CLbsAdmin::NewL();
|
|
54 |
CleanupStack::PushL(adminApi);
|
|
55 |
TInt err;
|
|
56 |
|
|
57 |
//CLbsAdmin::TPrivacyHandler privacyHandler = CLbsAdmin::EPrivacyHandleByController;
|
|
58 |
err = adminApi->Set(KLbsSettingPrivacyHandler, aPrivacyHandlerType);
|
|
59 |
|
|
60 |
User::LeaveIfError(err);
|
|
61 |
err = adminApi->Get(KLbsSettingPrivacyHandler, aPrivacyHandlerType);
|
|
62 |
User::LeaveIfError(err);
|
|
63 |
|
|
64 |
//Now we support 3 Privacy Handlers so need to comment out below check
|
|
65 |
//if(aPrivacyHandlerType != CLbsAdmin::EPrivacyHandleByController)
|
|
66 |
// {
|
|
67 |
// INFO_PRINTF1(_L("Admin setting didn't work"));
|
|
68 |
// ret = FALSE;
|
|
69 |
// }
|
|
70 |
|
|
71 |
CleanupStack::PopAndDestroy(adminApi);
|
|
72 |
|
|
73 |
// Allow he setting to be propagated
|
|
74 |
User::After(4 * 1000000);
|
|
75 |
|
|
76 |
return ret;
|
|
77 |
}
|
|
78 |
|
|
79 |
/**
|
|
80 |
@pre
|
|
81 |
@return Test verdict
|
|
82 |
@post GPSMode set to autonomous
|
|
83 |
*/
|
|
84 |
TVerdict CT_LbsStep_SetPrivacyHandler::doTestStepL()
|
|
85 |
{
|
|
86 |
INFO_PRINTF1(_L(">>CT_LbsStep_SetPrivacyHandler::doTestStepL()"));
|
|
87 |
|
|
88 |
CLbsAdmin::TPrivacyHandler privacyHandlerType = CLbsAdmin::EPrivacyHandleByController;
|
|
89 |
TInt privhandlerconfig;
|
|
90 |
|
|
91 |
if (GetIntFromConfig(ConfigSection(), KHandlerType, privhandlerconfig))
|
|
92 |
{
|
|
93 |
if(1 == privhandlerconfig)
|
|
94 |
{
|
|
95 |
privacyHandlerType = CLbsAdmin::EPrivacyHandleByController;
|
|
96 |
}
|
|
97 |
else if (2 == privhandlerconfig)
|
|
98 |
{
|
|
99 |
privacyHandlerType = CLbsAdmin::EPrivacyHandleByNotifier;
|
|
100 |
}
|
|
101 |
else if (3 == privhandlerconfig)
|
|
102 |
{
|
|
103 |
privacyHandlerType = CLbsAdmin::EPrivacyHandleByAdvancedNotifier;
|
|
104 |
}
|
|
105 |
else
|
|
106 |
{
|
|
107 |
INFO_PRINTF2(_L(">>Unrecognised privacyHandlerType: %d"), privacyHandlerType);
|
|
108 |
User::Invariant();
|
|
109 |
}
|
|
110 |
|
|
111 |
if(!SetAndVerifyPrivacyHandlerL(privacyHandlerType))
|
|
112 |
{
|
|
113 |
SetTestStepResult(EFail);
|
|
114 |
}
|
|
115 |
}
|
|
116 |
INFO_PRINTF1(_L("<<CT_LbsStep_SetPrivacyHandler::doTestStepL()"));
|
|
117 |
|
|
118 |
return TestStepResult();
|
|
119 |
}
|