commonuisupport/uikon/test/tmultiplealarm/TMultipleAlarmStep.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent - Internal Symbian test code
       
    19 */
       
    20 
       
    21 #ifndef __TMULTIPLEALARMSTEP_H
       
    22 #define __TMULTIPLEALARMSTEP_H
       
    23 
       
    24 /**
       
    25 includes
       
    26 */
       
    27 #include <e32msgqueue.h>
       
    28 #include <asshddefs.h>
       
    29 
       
    30 #include <test/testexecutestepbase.h>
       
    31 #include "TRemoteControl.h"
       
    32 #include "TAlarm.h"
       
    33 #include "appfwk_tmsteststep.h"
       
    34 
       
    35 /**
       
    36 needed classes
       
    37 */
       
    38 class RASAltClientSession;
       
    39 
       
    40 /**
       
    41 constants and definitions
       
    42 */
       
    43 const TInt KInvalidAlarmId = -1;
       
    44 
       
    45 
       
    46 /**
       
    47 Test step utility class, contains test methods.
       
    48 */
       
    49 class TAlarmData
       
    50 	{
       
    51 public:
       
    52 	TAlarmData(TAlarmId aId, TPtrC aData) :	iAlarmId(aId), iData(aData)
       
    53 			{	
       
    54 			}
       
    55 	TAlarmData(TAlarmId aId) : iAlarmId(aId)
       
    56 			{	
       
    57 			}
       
    58 	static TInt Compare(const TAlarmData& aD1, const TAlarmData& aD2)
       
    59 		{
       
    60 		return (aD1.iAlarmId - aD2.iAlarmId);
       
    61 		}
       
    62 		
       
    63 	TAlarmId iAlarmId;
       
    64 	TBuf<256> iData;
       
    65 	};
       
    66 
       
    67 /**
       
    68 Test step utility class, contains test methods.
       
    69 */
       
    70 
       
    71 
       
    72 /**
       
    73 Test step base class, contains test methods.
       
    74 */
       
    75 class CTMultipleAlarmStep : public CTmsTestStep
       
    76 	{
       
    77 public:
       
    78 	CTMultipleAlarmStep();
       
    79 	~CTMultipleAlarmStep();
       
    80 	
       
    81 	virtual TVerdict doTestStepPreambleL();
       
    82 	virtual TVerdict doTestStepPostambleL();
       
    83 	virtual TVerdict doTestStepL();
       
    84 
       
    85 private:
       
    86 	void LaunchServerL(const TInt aMaxAlarms, const TBool aReplies, const TAlarmId aId, const TInt aResponse, const TTime& aTime, TInt aSnoozeTime, TBool aUpdateSnooze,TInt aInitialState);
       
    87 
       
    88 	void StartAlertServerL(const TInt aMaxAlarms);
       
    89 	void StartAlertServerL(const TInt aMaxAlarms, const TAlarmId aId, const TInt aResponse);
       
    90 	void StartAlertServerL(const TInt aMaxAlarms, const TAlarmId aId, const TInt aResponse, const TTime& aTime);
       
    91 	void StartAlertServerL(const TInt aMaxAlarms, const TAlarmId aId, const TInt aResponse, const TTime& aTime, TInt aSnoozeTime, TBool aUpdateSnooze, TInt aInitialState);
       
    92 	void StopAlertServer();
       
    93 	
       
    94 	void SendInt(const TInt aValue);
       
    95 	void SendBool(const TBool aValue);
       
    96 	TInt ReadInt();
       
    97 	TInt ReadIntL();
       
    98 	void ReadData(TDes8& aBuffer);
       
    99 	
       
   100 	void ResetConfigValues();
       
   101 	
       
   102 private:
       
   103 	void MaxAlarmTestL();
       
   104 	void AddAlarmTestL();
       
   105 	TInt AddAlarmsL(RASAltClientSession& aSession);
       
   106 	TInt AddAlarmL(RASAltClientSession& aSession, const TAlarmId aId, const TDesC8& aData);
       
   107 	void DelAlarmTestL(const TInt aDeleteAll = 0);
       
   108 	void SoundTestL();
       
   109 	void VisibleTestL();
       
   110 	void StateTestL();
       
   111 	void QuietTestL();
       
   112 	void NotifyTestL();
       
   113 	void ServerDeathTestL();
       
   114 	void SwitchEventTestL();
       
   115 	void SessionTestL();
       
   116 
       
   117 private:
       
   118 	void DoMaxAlarmTestL();
       
   119 	void DoAddAlarmTestL();
       
   120 	void DoDelAlarmTestL();
       
   121 	void DoSoundTestL();
       
   122 	void DoVisibleTestL();
       
   123 	void DoStateTestL();
       
   124 	void DoQuietTestL();
       
   125 	void DoNotifyTest1L();
       
   126 	void DoNotifyTest2L();
       
   127 	void DoNotifyTest3L();
       
   128 	void DoNotifyTest4L();
       
   129 	void DoServerDeathTestL();
       
   130 	void DoSwitchEventTestL();
       
   131 	void DoSessionTestL();
       
   132 
       
   133 private:
       
   134 	RMsgQueue<TRemoteMsg> iMsgQ;
       
   135 	RProcess iServer;
       
   136 
       
   137 	TInt iMaxAlarms;
       
   138 	TInt iAlarmCount;
       
   139 	TInt iInitialState;
       
   140 	TAlarmId iId;
       
   141 	TInt iState;
       
   142 	TInt iQuietTime;
       
   143 
       
   144 	RArray<TAlarmData> iDataArray;
       
   145 
       
   146 	// Notify tests	
       
   147 	TInt iResponse;
       
   148 	TInt iSnoozeTime;
       
   149 	TBool iQueueResponse;
       
   150 	TBool iCancelNotify;
       
   151 	TBool iNoResponse;
       
   152 	TBool iWaitForUpdate;
       
   153 	TTime iTime;
       
   154 	
       
   155 	TInt iPauseTime;
       
   156 	TInt iExpectedSnoozeTime;
       
   157 	TInt iAction;
       
   158 
       
   159 private:
       
   160 	class RTestSession : public RSessionBase
       
   161 		{
       
   162 		public:
       
   163 		TInt Connect(TInt aVersion);
       
   164 		TInt SendOpCode(TInt aOpCode);
       
   165 		};
       
   166 
       
   167 	TInt iSessionCount;
       
   168 	TInt iSessionVersion;
       
   169 	TBool iInvalidOpCode;	
       
   170 	};
       
   171 
       
   172 
       
   173 _LIT(KTMultipleAlarm, "TMultipleAlarm");
       
   174 
       
   175 #endif // __TMULTIPLEALARMSTEP_H