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"
31 extern CMsDrive* msDrive;
33 RTest test(_L("T_MSSUSPEND"));
47 void TTestMsSuspend::t1L()
49 test.Start(_L("Test"));
50 test.Next(_L("Test1"));
55 test.Printf(_L("Waiting for host to suspend..."));
57 TBool usbActive = TTestUtils::WaitForConnectionStateEventL();
58 test(usbActive == EFalse);
62 // Resume device by accessing drive
65 test.Printf(_L("Waiting for host to suspend..."));
67 usbActive = TTestUtils::WaitForConnectionStateEventL();
69 test(usbActive == EFalse);
72 // Resume device by accessing drive
75 test.Printf(_L("Waiting for host to suspend..."));
77 usbActive = TTestUtils::WaitForConnectionStateEventL();
79 test(usbActive == EFalse);
82 // Resume device by accessing drive
85 test.Printf(_L("Waiting for host to suspend..."));
87 usbActive = TTestUtils::WaitForConnectionStateEventL();
89 test(usbActive == EFalse);
94 void TTestMsSuspend::DrvWrite()
98 static const TInt KFileSize = 1000;
99 _LIT(KTxtControlFile, "ControlFile.txt");
100 static const TChar KFillChar = 'x';
102 TBuf8<KFileSize> testData;
103 testData.Fill(KFillChar, KFileSize);
105 // write control file
106 TInt err = file.Replace(fsSession, KTxtControlFile, EFileStream);
107 test(err == KErrNone);
109 err = file.Write(testData);
110 test(err == KErrNone);
115 err = fsSession.Delete(KTxtControlFile);
116 test(err == KErrNone);
122 TInt driveNumber = msDrive->DriveNumber();
124 TRAPD(err, TMsPrintDrive::VolInfoL(driveNumber));