|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 */ |
|
22 |
|
23 #include "uisscaptest.h" |
|
24 |
|
25 #include "sislauncherclient.h" |
|
26 |
|
27 #include <e32def.h> |
|
28 |
|
29 _LIT(KUissCapTestName, "Swi Launcher capability test"); |
|
30 |
|
31 |
|
32 CUissCapTest* CUissCapTest::NewL() |
|
33 { |
|
34 CUissCapTest* self=new(ELeave) CUissCapTest(); |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop(self); |
|
38 return self; |
|
39 } |
|
40 |
|
41 CUissCapTest::CUissCapTest() |
|
42 { |
|
43 SetCapabilityRequired(ECapabilityTCB); |
|
44 } |
|
45 |
|
46 void CUissCapTest::ConstructL() |
|
47 { |
|
48 SetNameL(KUissCapTestName); |
|
49 } |
|
50 |
|
51 void CUissCapTest::RunTestL() |
|
52 { |
|
53 Swi::RSisLauncherSession launcher; |
|
54 CleanupClosePushL(launcher); |
|
55 |
|
56 if (KErrNone != CheckFailL(launcher.Connect(), _L("Connect"))) |
|
57 { |
|
58 // if we get here we didn't connect and expected not to, but cannot carry on with tests |
|
59 CleanupStack::PopAndDestroy(&launcher); |
|
60 return; |
|
61 } |
|
62 |
|
63 TInt err=KErrNone; |
|
64 |
|
65 TRAP(err, launcher.RunExecutableL(_L("exe"), ETrue)); |
|
66 CheckFailL(err, _L("RunExecutableL")); |
|
67 |
|
68 RFs fs; |
|
69 User::LeaveIfError(fs.Connect()); |
|
70 User::LeaveIfError(fs.ShareProtected()); |
|
71 CleanupClosePushL(fs); |
|
72 RFile file; |
|
73 CleanupClosePushL(file); |
|
74 |
|
75 _LIT(KFilePath ,"\\tswi\\swicaptests\\data\\testdoc.txt"); |
|
76 TDriveUnit sysDrive (RFs::GetSystemDrive()); |
|
77 TBuf<128> testDocFileOnSysDrive = sysDrive.Name(); |
|
78 testDocFileOnSysDrive.Append(KFilePath); |
|
79 |
|
80 User::LeaveIfError(file.Open(fs, testDocFileOnSysDrive , EFileShareExclusive|EFileWrite)); |
|
81 |
|
82 TRAP(err, launcher.StartDocumentL(file, ETrue)); |
|
83 CheckFailL(err, _L("StartDocumentL")); |
|
84 |
|
85 TRAP(err, launcher.StartByMimeL(file, _L8("mime"), ETrue)); |
|
86 CheckFailL(err, _L("StartByMimeL")); |
|
87 |
|
88 CleanupStack::PopAndDestroy(&file); |
|
89 CleanupStack::PopAndDestroy(&fs); |
|
90 |
|
91 RArray<TUid> uidList; |
|
92 TRAP(err, launcher.ShutdownL(uidList, 10)); |
|
93 CheckFailL(err, _L("ShutdownL")); |
|
94 |
|
95 CleanupStack::PopAndDestroy(&launcher); |
|
96 } |
|
97 |