|
1 // Copyright (c) 1997-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 #include <e32test.h> |
|
17 |
|
18 #include "TE_EtelMMTestStepBase.h" |
|
19 #include "TE_mmline.h" |
|
20 #include "testdef.h" |
|
21 |
|
22 CTestLine::CTestLine() |
|
23 /** Each test step initialises it's own name |
|
24 */ |
|
25 { |
|
26 // store the name of this test case |
|
27 // this is the name that is used by the script file |
|
28 SetTestStepName(_L("TestLine")); |
|
29 } |
|
30 |
|
31 enum TVerdict CTestLine::doTestStepL() |
|
32 // |
|
33 // Test Line Functions |
|
34 // |
|
35 { |
|
36 iTestCount=1; |
|
37 INFO_PRINTF1(_L("")); |
|
38 INFO_PRINTF1(_L("Test Mobile Line Functionality")); |
|
39 // LOGTEXT(_L8("Test Mobile Line Functionality")); |
|
40 |
|
41 RMobilePhone mmPhone; |
|
42 TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME); |
|
43 TEST(ret==KErrNone); |
|
44 |
|
45 RMobileLine mmLine; |
|
46 ret=mmLine.Open(mmPhone,DMMTSY_LINE_VOICE_NAME); |
|
47 TEST(ret==KErrNone); |
|
48 |
|
49 // Test for Primary or Auxillary voice line |
|
50 |
|
51 // line caps are part of Etel core api but as we have extended them |
|
52 // in etelmm so we test the extension here |
|
53 RLine::TCaps lineCaps = {DMMTSY_MOBILE_LINE_AUX_VOICE}; |
|
54 lineCaps.iFlags ^= DMMTSY_MOBILE_LINE_AUX_VOICE; // make sure AUX voice bit is clear |
|
55 |
|
56 // Get Caps will set the AUX voice bit |
|
57 TEST(KErrNone==mmLine.GetCaps(lineCaps)); |
|
58 |
|
59 if(lineCaps.iFlags & DMMTSY_MOBILE_LINE_AUX_VOICE) |
|
60 { |
|
61 INFO_PRINTF2(_L("Test %d - Line is an auxiliary voice line"), iTestCount) ; |
|
62 INFO_PRINTF2(_L("Test %d - Test for Primary or Auxillary voice line - passed"), iTestCount++); |
|
63 } |
|
64 else |
|
65 { |
|
66 INFO_PRINTF2(_L("Test %d - Line is a primary voice line"), iTestCount) ; |
|
67 INFO_PRINTF2(_L("Test %d - Test for Primary or Auxillary voice line - FAILED"), iTestCount++); |
|
68 } |
|
69 |
|
70 // Get Line Status |
|
71 TRequestStatus reqStatus; |
|
72 |
|
73 RMobileCall::TMobileCallStatus lineStatus; |
|
74 TEST(KErrNone==mmLine.GetMobileLineStatus(lineStatus)); |
|
75 TEST(lineStatus==DMMTSY_CALL_STATUS1); |
|
76 INFO_PRINTF2(_L("Test %d - RMobileLine::GetMobileLineStatus (sync) passed"), iTestCount++); |
|
77 |
|
78 // Notify Change of Line Status |
|
79 // asynchronous |
|
80 |
|
81 mmLine.NotifyMobileLineStatusChange(reqStatus,lineStatus); |
|
82 User::WaitForRequest(reqStatus); |
|
83 TEST(reqStatus.Int()==KErrNone); |
|
84 TEST(lineStatus==DMMTSY_CALL_STATUS2); |
|
85 |
|
86 // asynchronous & cancel |
|
87 |
|
88 mmLine.NotifyMobileLineStatusChange(reqStatus,lineStatus); |
|
89 mmLine.CancelAsyncRequest(EMobileLineNotifyMobileLineStatusChange); |
|
90 User::WaitForRequest(reqStatus); |
|
91 TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel); |
|
92 if (reqStatus.Int()==KErrCancel) |
|
93 INFO_PRINTF2(_L("Test %d - RMobileLine::NotifyMobileLineStatusChange (async & cancel (Cancelled Request)) passed"), iTestCount++); |
|
94 else |
|
95 { |
|
96 TEST(lineStatus==DMMTSY_CALL_STATUS2); |
|
97 INFO_PRINTF2(_L("Test %d - RMobileLine::NotifyMobileLineStatusChange (async & cancel (Request Not Cancelled)) passed"), iTestCount++); |
|
98 } |
|
99 |
|
100 mmLine.Close(); |
|
101 mmPhone.Close(); |
|
102 INFO_PRINTF1(_L("")); |
|
103 |
|
104 // INFO_PRINTF2(_L("OK: RMobileLine's MobileLineStatus")); |
|
105 |
|
106 return TestStepResult(); |
|
107 } |