|
1 /* |
|
2 * Copyright (c) 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: Implementation of the MT_MProEngAlertToneSeeker test class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //////////////////////////////////////////////////////////////////////// |
|
20 // MT_MProEngAlertToneSeeker.cpp |
|
21 // |
|
22 |
|
23 // CLASS HEADER |
|
24 #include "MT_MProEngAlertToneSeeker.h" |
|
25 |
|
26 // EXTERNAL INCLUDES |
|
27 #include <MProEngAlertToneSeeker.h> |
|
28 #include <ProEngFactory.h> |
|
29 #include <EUnitMacros.h> |
|
30 |
|
31 MT_MProEngAlertToneSeeker* MT_MProEngAlertToneSeeker::NewL() |
|
32 { |
|
33 MT_MProEngAlertToneSeeker* self = MT_MProEngAlertToneSeeker::NewLC(); |
|
34 CleanupStack::Pop(); |
|
35 |
|
36 return self; |
|
37 } |
|
38 |
|
39 MT_MProEngAlertToneSeeker* MT_MProEngAlertToneSeeker::NewLC() |
|
40 { |
|
41 MT_MProEngAlertToneSeeker* self = new( ELeave ) MT_MProEngAlertToneSeeker(); |
|
42 CleanupStack::PushL( self ); |
|
43 |
|
44 self->ConstructL(); |
|
45 |
|
46 return self; |
|
47 } |
|
48 |
|
49 MT_MProEngAlertToneSeeker::~MT_MProEngAlertToneSeeker() |
|
50 { |
|
51 delete iObserver; |
|
52 } |
|
53 |
|
54 MT_MProEngAlertToneSeeker::MT_MProEngAlertToneSeeker() |
|
55 { |
|
56 } |
|
57 |
|
58 void MT_MProEngAlertToneSeeker::ConstructL() |
|
59 { |
|
60 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
61 // It generates the test case table. |
|
62 CEUnitTestSuiteClass::ConstructL(); |
|
63 iObserver = MT_CProEngAlertToneSeekerObserver::NewL(); |
|
64 } |
|
65 |
|
66 void MT_MProEngAlertToneSeeker::SetupL() |
|
67 { |
|
68 iSeeker = ProEngFactory::NewAlertToneSeekerL(); |
|
69 } |
|
70 |
|
71 void MT_MProEngAlertToneSeeker::SetupCancelFetchTestL() |
|
72 { |
|
73 SetupL(); |
|
74 iObserver->iNotified = EFalse; |
|
75 iSeeker->FetchAlertToneListL( *iObserver ); |
|
76 } |
|
77 |
|
78 void MT_MProEngAlertToneSeeker::Teardown() |
|
79 { |
|
80 delete iObserver->iToneList; |
|
81 iObserver->iToneList = NULL; |
|
82 delete iSeeker; |
|
83 } |
|
84 |
|
85 void MT_MProEngAlertToneSeeker::FetchAlertToneListTestL() |
|
86 { |
|
87 iSeeker->FetchAlertToneListL( *iObserver ); |
|
88 MT_CSchedulerUtility::InstanceL()->Start(); |
|
89 EUNIT_ASSERT( iObserver->iNotified ); |
|
90 EUNIT_ASSERT( iObserver->iToneList ); |
|
91 TInt count( iObserver->iToneList->MdcaCount() ); |
|
92 EUNIT_PRINT( _L( "*** Tones: ***" ) ); |
|
93 for( TInt i(0); i<count; ++i ) |
|
94 { |
|
95 TPtrC tone( iObserver->iToneList->MdcaPoint( i ) ); |
|
96 EUNIT_PRINT( _L( "%S" ), &tone ); |
|
97 } |
|
98 } |
|
99 |
|
100 void MT_MProEngAlertToneSeeker::CancelFetchTestL() |
|
101 { |
|
102 EUNIT_PRINT( _L( "CancelFetchTestL begin" ) ); |
|
103 if( !iObserver->iNotified ) |
|
104 { |
|
105 EUNIT_PRINT( _L( "CancelFetchTestL before seeker->Cancel" ) ); |
|
106 iSeeker->CancelFetch(); |
|
107 EUNIT_PRINT( _L( "CancelFetchTestL after seeker->Cancel" ) ); |
|
108 } |
|
109 EUNIT_ASSERT( ETrue ); |
|
110 EUNIT_PRINT( _L( "CancelFetchTestL end" ) ); |
|
111 } |
|
112 |
|
113 |
|
114 EUNIT_BEGIN_TEST_TABLE( |
|
115 MT_MProEngAlertToneSeeker, |
|
116 "Wrapper API Alert Tone Seeker Test cases.", |
|
117 "MODULE" ) |
|
118 |
|
119 EUNIT_TEST( |
|
120 "Fetch Alert Tone List - test", |
|
121 "MProEngAlertToneSeeker", |
|
122 "FetchAlertToneListL", |
|
123 "FUNCTIONALITY", |
|
124 SetupL, FetchAlertToneListTestL, Teardown) |
|
125 |
|
126 EUNIT_TEST( |
|
127 "Cancel Fetch Alert Tone List - test", |
|
128 "MProEngAlertToneSeeker", |
|
129 "CancelFetch", |
|
130 "FUNCTIONALITY", |
|
131 SetupCancelFetchTestL, CancelFetchTestL, Teardown) |
|
132 |
|
133 EUNIT_END_TEST_TABLE |
|
134 |
|
135 // End of File |
|
136 |