locationrequestmgmt/networkrequesthandler/LBSPrivacyNotification/LbsPrivacyExtNotifiers/test/lbsprivacyextnotifierstest.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 // This test exercises the data types used to pass data to/from
       
    15 // the Lbs privacy notification dialogs via the RNotifier API.
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <e32debug.h>
       
    20 #include <e32test.h>
       
    21 #include <lbs/lbsprivacyextnotifiers.h>
       
    22 
       
    23 _LIT(KTestName, "Exercising the data types in LbsPrivacyExtNotifiers.h");
       
    24 LOCAL_D RTest test(KTestName);
       
    25 
       
    26 
       
    27 LOCAL_C void TestTLbsPrivacyNotifierParams()
       
    28 	{
       
    29 	// First test setting the parameter data.
       
    30 	TLbsPrivacyNotifierParams params;
       
    31 	TLbsExternalRequestInfo info;
       
    32 	
       
    33 	_LIT8(KRequesterId, "ExtRequest_1");
       
    34 	_LIT8(KClientName, "ExtClient_1");
       
    35 	_LIT8(KClientExternalId, "+4401484341822");
       
    36 	
       
    37 	info.SetRequesterId(KRequesterId());
       
    38 	info.SetClientName(KClientName());
       
    39 	info.SetClientExternalId(KClientExternalId());
       
    40 	
       
    41 	params.SetRequesterInfo(info);
       
    42 	
       
    43 	// Second test that getting the parameter data works.
       
    44 	TLbsExternalRequestInfo info2;
       
    45 	
       
    46 	params.GetRequesterInfo(info2);
       
    47 
       
    48 	TLbsRequesterId requesterId;
       
    49 	TLbsClientName clientName;
       
    50 	TLbsClientExternalId clientExternalId;
       
    51 	
       
    52 	info2.GetRequesterId(requesterId);
       
    53 	info2.GetClientName(clientName);
       
    54 	info2.GetClientExternalId(clientExternalId);
       
    55 	
       
    56 	test(requesterId == KRequesterId());
       
    57 	test(clientName == KClientName());
       
    58 	test(clientExternalId == KClientExternalId());
       
    59 	}
       
    60 	
       
    61 LOCAL_C void TestTLbsPrivacyResponseParams()
       
    62 	{
       
    63 	// First test setting the parameter data.
       
    64 	TLbsPrivacyResponseParams params;
       
    65 	TLbsPrivacyNotifierResponse response(EResponseAccepted);
       
    66 	
       
    67 	params.SetResponseType(response);
       
    68 	
       
    69 	// Second test that getting the parameter data works.
       
    70 	TLbsPrivacyNotifierResponse response2;
       
    71 	
       
    72 	params.GetResponseType(response2);
       
    73 	
       
    74 	test(response == response2);
       
    75 	}
       
    76 	
       
    77 void doMainL()
       
    78 	{
       
    79 	test.Next(_L("Exercising TLbsPrivacyNotifierParams"));
       
    80 	TestTLbsPrivacyNotifierParams();
       
    81 	
       
    82 	test.Next(_L("Exercising TLbsPrivacyNotifierParams"));
       
    83 	TestTLbsPrivacyResponseParams();
       
    84 	}
       
    85 
       
    86 /*
       
    87 Program entry point.
       
    88 */
       
    89 GLDEF_C int E32Main()
       
    90 	{
       
    91 	__UHEAP_MARK;
       
    92 	
       
    93 	test.Title();
       
    94 	test.Start(KTestName);
       
    95 		
       
    96 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    97 	if (!cleanup)
       
    98 		{
       
    99 		return KErrNoMemory;
       
   100 		}
       
   101 		
       
   102 	CActiveScheduler * scheduler = new (ELeave) CActiveScheduler;
       
   103 	CActiveScheduler::Install(scheduler);
       
   104 
       
   105 	TRAPD(err, doMainL());
       
   106 	test.Printf(_L("Test finished with code %d\n"), err);
       
   107 	test(err == KErrNone);
       
   108 
       
   109 	delete scheduler;
       
   110 	delete cleanup;
       
   111 	
       
   112 	test.End();
       
   113 	test.Close();
       
   114 	
       
   115 	__UHEAP_MARKEND;
       
   116 	return 0;	
       
   117 	}