|
1 // Copyright (c) 2003-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 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // RemoveMedia |
|
17 // [Action Parameters] |
|
18 // TInt Drive <input>: External drive (between D: and Y:) that we want to remove. |
|
19 // [Action Description] |
|
20 // Tells the message server to pretend its media is missing next time it gets a disk notification. |
|
21 // [APIs Used] |
|
22 // RMsvServerSession::SetFailure |
|
23 // __ACTION_INFO_END__ |
|
24 // |
|
25 // |
|
26 |
|
27 /** |
|
28 @file |
|
29 */ |
|
30 |
|
31 |
|
32 #include "CMtfTestActionRemoveMedia.h" |
|
33 #include "CMtfTestCase.h" |
|
34 #include "CMtfTestActionParameters.h" |
|
35 |
|
36 |
|
37 CMtfTestAction* CMtfTestActionRemoveMedia::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
38 { |
|
39 CMtfTestActionRemoveMedia* self = new (ELeave) CMtfTestActionRemoveMedia(aTestCase); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(aActionParameters); |
|
42 CleanupStack::Pop(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 CMtfTestActionRemoveMedia::CMtfTestActionRemoveMedia(CMtfTestCase& aTestCase) |
|
48 : CMtfSynchronousTestAction(aTestCase) |
|
49 { |
|
50 } |
|
51 |
|
52 |
|
53 CMtfTestActionRemoveMedia::~CMtfTestActionRemoveMedia() |
|
54 { |
|
55 } |
|
56 |
|
57 void CMtfTestActionRemoveMedia::ExecuteActionL() |
|
58 { |
|
59 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionRemoveMedia); |
|
60 RFs fs; |
|
61 RMsvServerSession server; |
|
62 TFileName fsName; |
|
63 |
|
64 TInt drive = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0)); |
|
65 |
|
66 fs.Connect(); |
|
67 server.Connect(fs); |
|
68 |
|
69 // This tells the server to pretend that its media is missing next time it gets a disk notification |
|
70 server.SetFailure(EDiskFailure, ETrue); |
|
71 |
|
72 // Generate a disk change notification |
|
73 fs.FileSystemName(fsName, drive); |
|
74 fs.MountFileSystem(fsName, drive); |
|
75 |
|
76 // Close session |
|
77 server.Close(); |
|
78 fs.Close(); |
|
79 |
|
80 User::After(100000); // wait a bit... |
|
81 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionRemoveMedia); |
|
82 TestCase().ActionCompletedL(*this); |
|
83 } |
|
84 |
|
85 |