|
1 /* |
|
2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Unit tests for CMusManagerServerSession class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef UT_CMUSMANAGERSERVERSESSION_H |
|
20 #define UT_CMUSMANAGERSERVERSESSION_H |
|
21 |
|
22 #include "musmanagerserversessionobserver.h" |
|
23 #include <digia/eunit/ceunittestsuiteclass.h> |
|
24 |
|
25 class CMusManagerServerSession; |
|
26 class CMusManagerServer; |
|
27 class CSession2; |
|
28 class MMusMonitorAvailabilityObserver; |
|
29 |
|
30 #include <e32def.h> |
|
31 #ifndef NONSHARABLE_CLASS |
|
32 #define NONSHARABLE_CLASS(x) class x |
|
33 #endif |
|
34 |
|
35 /** |
|
36 * Unit test class for CMusManagerServerSession. |
|
37 * Implements unit tests for CMusManagerServerSession. |
|
38 * |
|
39 * @since S60 v3.2 |
|
40 */ |
|
41 NONSHARABLE_CLASS( UT_CMusManagerServerSession ) : public CEUnitTestSuiteClass, |
|
42 MMusManagerServerSessionObserver |
|
43 { |
|
44 public: |
|
45 |
|
46 enum TObserved |
|
47 { |
|
48 |
|
49 EAvailabilityQueryL = 1, |
|
50 ECommandL, |
|
51 EInvestigateAvailabilityL, |
|
52 EInvitationReceivedL, |
|
53 EOptionsReceivedL, |
|
54 EStartMultimediaSharingL, |
|
55 EStopMultimediaSharingL, |
|
56 ERegisterObserverL, |
|
57 ERemoveObserver, |
|
58 ECancelMonitoring |
|
59 }; |
|
60 |
|
61 static UT_CMusManagerServerSession* NewL(); |
|
62 |
|
63 static UT_CMusManagerServerSession* NewLC(); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~UT_CMusManagerServerSession(); |
|
69 |
|
70 |
|
71 // from baseclass MMusManagerServerSessionObserver. |
|
72 |
|
73 MultimediaSharing::TMusAvailabilityStatus AvailabilityQueryL() |
|
74 { iObserved = EAvailabilityQueryL; |
|
75 return MultimediaSharing::EMultimediaSharingAvailable; } |
|
76 |
|
77 void CommandL( MultimediaSharing::TCommandType /*aCommandType*/ ) |
|
78 { iObserved = ECommandL; } |
|
79 |
|
80 void InvestigateAvailabilityL() |
|
81 { iObserved = EInvestigateAvailabilityL; } |
|
82 |
|
83 void InvitationReceivedL( TUid /*aChannelId*/ ) |
|
84 { iObserved = EInvitationReceivedL; } |
|
85 |
|
86 void OptionsReceivedL( TUid /*aChannelId*/ ) |
|
87 { iObserved = EOptionsReceivedL; } |
|
88 |
|
89 void StartMultimediaSharingL( MultimediaSharing::TMusUseCase /*aUseCase*/ ) |
|
90 { iObserved = EStartMultimediaSharingL; } |
|
91 |
|
92 void StopMultimediaSharingL() |
|
93 { iObserved = EStopMultimediaSharingL; } |
|
94 |
|
95 void RegisterObserverL( MMusMonitorAvailabilityObserver* /*aObserver*/ ) |
|
96 { iObserved = ERegisterObserverL; } |
|
97 |
|
98 void RemoveObserver( MMusMonitorAvailabilityObserver* /*aObserver*/ ) |
|
99 { iObserved = ERemoveObserver; } |
|
100 |
|
101 void CancelMonitoring( MMusMonitorAvailabilityObserver* /*aObserver*/) |
|
102 { iObserved = ECancelMonitoring; } |
|
103 |
|
104 |
|
105 TObserved iObserved; |
|
106 |
|
107 private: |
|
108 |
|
109 UT_CMusManagerServerSession(); |
|
110 |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Sets up a test case. |
|
115 */ |
|
116 void SetupL(); |
|
117 |
|
118 /** |
|
119 * Tears down a test case. |
|
120 */ |
|
121 void Teardown(); |
|
122 |
|
123 /** |
|
124 * Invidual unit test methods. |
|
125 */ |
|
126 void UT_CMusManagerServerSession_NewLL(); |
|
127 void UT_CMusManagerServerSession_NewLCL(); |
|
128 void UT_CMusManagerServerSession_ServiceLL(); |
|
129 void UT_CMusManagerServerSession_AvailabilityChangedLL(); |
|
130 |
|
131 private: // data |
|
132 |
|
133 /** |
|
134 * Tested class. |
|
135 * Own. |
|
136 */ |
|
137 CMusManagerServerSession* iSession; |
|
138 CSession2* iSession2; |
|
139 |
|
140 CMusManagerServer* iServer; |
|
141 |
|
142 EUNIT_DECLARE_TEST_TABLE; |
|
143 }; |
|
144 |
|
145 #endif // UT_CMUSMANAGERSERVERSESSION_H |