|
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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This is a defect fix for the following defect |
|
15 // INC040672 - MMC Card door open causes wrong mime type instead of error code |
|
16 // This test is fully automated and performs the following task |
|
17 // Tests to access a file which is on MMC and the MMC card is removed at the time of access. |
|
18 // |
|
19 // |
|
20 |
|
21 |
|
22 |
|
23 /** |
|
24 @file |
|
25 @internalComponent - Internal Symbian test code |
|
26 */ |
|
27 |
|
28 #include "testableapalssession.h" |
|
29 #include "T_AutoMMCReaderOpen.h" |
|
30 |
|
31 const TInt KDirLength = 5; // No need of length more than this , hence length is 5 |
|
32 |
|
33 CTestAutoMMCReaderStep::~CTestAutoMMCReaderStep() |
|
34 { |
|
35 } |
|
36 |
|
37 CTestAutoMMCReaderStep::CTestAutoMMCReaderStep() |
|
38 { |
|
39 SetTestStepName(KTestAutoMMCReaderOpenStep); |
|
40 } |
|
41 |
|
42 TVerdict CTestAutoMMCReaderStep::doTestStepPreambleL() |
|
43 /** |
|
44 @return - TVerdict code |
|
45 Override of base class virtual |
|
46 */ |
|
47 { |
|
48 SetTestStepResult(EPass); |
|
49 return TestStepResult(); |
|
50 } |
|
51 |
|
52 TVerdict CTestAutoMMCReaderStep::doTestStepPostambleL() |
|
53 /** |
|
54 @return - TVerdict code |
|
55 Override of base class virtual |
|
56 */ |
|
57 { |
|
58 return TestStepResult(); |
|
59 } |
|
60 |
|
61 TVerdict CTestAutoMMCReaderStep::doTestStepL() |
|
62 { |
|
63 INFO_PRINTF1(_L("Testing Apparch...T_AutoMMCReaderOpen")); |
|
64 |
|
65 OpenMMCCardReaderDrive(); |
|
66 INFO_PRINTF1(_L("\nT_AutoMMCReaderOpen Completed.")); |
|
67 return TestStepResult(); |
|
68 } |
|
69 |
|
70 void CTestAutoMMCReaderStep::OpenMMCCardReaderDrive() |
|
71 { |
|
72 INFO_PRINTF1(_L("Testing fix for INC040672 - MMC Card door open causes wrong mime type instead of error code")); |
|
73 |
|
74 _LIT(KValidFileName, "ValidFileName.jpg"); |
|
75 |
|
76 RFs fs; |
|
77 TInt ret = fs.Connect(); |
|
78 TEST(ret == KErrNone); |
|
79 RTestableApaLsSession ls; |
|
80 ret = ls.Connect(); |
|
81 TEST(ret == KErrNone); |
|
82 |
|
83 // The following steps are to reproduce the removal of MMC card |
|
84 // Loop through drive letters Y -> D to access a file on that drive (any filename) |
|
85 // Find a drive letter that returns KErrNotReady , |
|
86 // setup a valid filename with that drive. |
|
87 |
|
88 for (TInt drive = EDriveY; drive >= EDriveD ; drive--) |
|
89 { |
|
90 TDriveUnit driveUnit(drive); |
|
91 TDriveName driveName = driveUnit.Name(); |
|
92 |
|
93 TBuf<KDirLength> bufDirName(driveName); |
|
94 bufDirName.Append(_L("\\")); |
|
95 |
|
96 ret = fs.MkDirAll(bufDirName); |
|
97 if (ret == KErrNotReady) |
|
98 { |
|
99 TFileName bufValidFileName(bufDirName); |
|
100 bufValidFileName.Append(KValidFileName); |
|
101 TDataType dataType; |
|
102 TUid uid = KNullUid; |
|
103 |
|
104 HEAP_TEST_LS_SESSION(ls, 0, 0, ret = ls.AppForDocument(bufValidFileName, uid, dataType), NO_CLEANUP); |
|
105 TEST(ret == KErrNotReady); |
|
106 TEST(uid == KNullUid); |
|
107 TEST(dataType == TDataType()); |
|
108 break; |
|
109 } |
|
110 } |
|
111 TEST(ret == KErrNotReady); |
|
112 ls.Close(); |
|
113 fs.Close(); |
|
114 } |