First public contribution.
1 // Copyright (c) 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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
23 #define __E32TEST_EXTENSION__
27 #include "tmsprintdrive.h"
28 #include "ttestutils.h"
29 #include "cblockdevicetester.h"
32 extern CMsDrive* msDrive;
34 RTest test(_L("T_MSRMB"));
40 TTests(TInt aDriveNumber);
52 TTests::TTests(TInt aDriveNumber)
53 : iDriveNumber(aDriveNumber)
58 void TTests::RemountDrive()
61 const TUint KMediaRemountForceMediaChange = 0x00000001;
63 TRequestStatus changeStatus;
64 fsSession.NotifyChange(ENotifyAll, changeStatus);
66 test.Printf(_L("Remounting the drive\n"));
67 TInt err = fsSession.RemountDrive(iDriveNumber, NULL, KMediaRemountForceMediaChange);
68 test(err == KErrNotReady || err == KErrNone);
72 test.Printf(_L("Waiting for media change...\n"));
73 User::WaitForRequest(changeStatus);
75 err = fsSession.Drive(info, iDriveNumber);
76 test.Printf(_L("Completed\n"));
78 fsSession.NotifyChange(ENotifyAll, changeStatus);
80 while (err == KErrNotReady);
81 fsSession.NotifyChangeCancel(changeStatus);
85 void TTests::tRemovableSet()
87 test.Start(_L("tRemovableSet\n"));
90 TInt err = fsSession.Drive(driveInfo);
91 test(err == KErrNone);
93 test.Printf(_L("DriveInfo DriveAtt= %x\n"), driveInfo.iDriveAtt);
95 test(driveInfo.iDriveAtt&KDriveAttRemovable != 0);
100 void TTests::tRemovableClr()
102 test.Start(_L("tRemovableClr\n"));
104 TDriveInfo driveInfo;
105 TInt err = fsSession.Drive(driveInfo);
106 test(err == KErrNone);
108 test.Printf(_L("DriveInfo DriveAtt= %x\n"), driveInfo.iDriveAtt);
110 test(driveInfo.iDriveAtt&KDriveAttRemovable != 0);
115 void TTests::FullFormat()
119 test.Next(_L("Test EFullFormat"));
121 TInt err = format.Open(fsSession, msDrive->GetSessionPath(), EFullFormat, counter);
122 test(err == KErrNone);
125 err = format.Next(counter);
126 test(err == KErrNone);
135 TInt driveNumber = msDrive->DriveNumber();
137 TRAPD(err, TMsPrintDrive::VolInfoL(driveNumber));
140 TTests t(driveNumber);
142 test.Printf(_L("Preparing target drive..."));
145 CWrPrTester* wpTester = CWrPrTester::NewL(driveNumber);
146 CleanupStack::PushL(wpTester);
147 test.Printf(_L("Target drive ready.\n"));
149 test.Start(_L("REMOVABLE"));
151 test.Next(_L("Test RMB=Set\n"));
152 err = wpTester->SetRemovableL();
153 test(err == KErrNone);
157 test.Next(_L("Test RMB=Clr\n"));
158 err = wpTester->ClrRemovableL();
159 test(err == KErrNone);
164 CleanupStack::PopAndDestroy(wpTester);