sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\window\t_mmcpw.cpp
|
sl@0
|
15 |
// Tests MMC card password notifier
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32svr.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <e32test.h>
|
sl@0
|
22 |
#include <e32twin.h>
|
sl@0
|
23 |
#include <e32def.h>
|
sl@0
|
24 |
#include <e32def_private.h>
|
sl@0
|
25 |
#include <e32std.h>
|
sl@0
|
26 |
#include <e32std_private.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
static RTest test(_L("T_MMCPW"));
|
sl@0
|
29 |
|
sl@0
|
30 |
GLDEF_C TInt E32Main()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
test.Start(_L("E32Main"));
|
sl@0
|
33 |
|
sl@0
|
34 |
test.Next(_L("Creating notifier."));
|
sl@0
|
35 |
RNotifier n;
|
sl@0
|
36 |
|
sl@0
|
37 |
test.Next(_L("Connected to notify server."));
|
sl@0
|
38 |
TInt r;
|
sl@0
|
39 |
test((r = n.Connect()) == KErrNone);
|
sl@0
|
40 |
|
sl@0
|
41 |
TPckgBuf<TMediaPswdSendNotifyInfoV1> send;
|
sl@0
|
42 |
send().iVersion = TVersion(1, 0, 0);
|
sl@0
|
43 |
TPckgBuf<TMediaPswdReplyNotifyInfoV1> reply;
|
sl@0
|
44 |
reply().iVersion = TVersion(1, 0, 0);
|
sl@0
|
45 |
|
sl@0
|
46 |
test.Next(_L("Launching notify server."));
|
sl@0
|
47 |
TRequestStatus rs;
|
sl@0
|
48 |
n.StartNotifierAndGetResponse(rs, TUid::Uid(KMediaPasswordNotifyUid), send, reply);
|
sl@0
|
49 |
|
sl@0
|
50 |
test.Next(_L("Waiting for dialog to respond."));
|
sl@0
|
51 |
User::WaitForRequest(rs);
|
sl@0
|
52 |
|
sl@0
|
53 |
test.Next(_L("Reading exit mode and resultant password."));
|
sl@0
|
54 |
test(reply().iEM == EMPEMUnlock || reply().iEM == EMPEMCancel || reply().iEM == EMPEMUnlockAndStore);
|
sl@0
|
55 |
test.Printf(_L("reply().iEM = %d(d).\n"), TInt(reply().iEM));
|
sl@0
|
56 |
|
sl@0
|
57 |
switch (reply().iEM)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
case EMPEMUnlock:
|
sl@0
|
60 |
case EMPEMUnlockAndStore:
|
sl@0
|
61 |
{
|
sl@0
|
62 |
if (reply().iEM == EMPEMUnlock)
|
sl@0
|
63 |
test.Printf(_L("EMPEMUnlock selected.\n"));
|
sl@0
|
64 |
else
|
sl@0
|
65 |
test.Printf(_L("EMPEMUnlockAndStore selected.\n"));
|
sl@0
|
66 |
|
sl@0
|
67 |
TMediaPassword pw;
|
sl@0
|
68 |
pw.Copy(reply().iPW, KMaxMediaPassword);
|
sl@0
|
69 |
|
sl@0
|
70 |
TInt i; // bad for-scope under VC
|
sl@0
|
71 |
|
sl@0
|
72 |
for (i = 0; i < KMaxMediaPassword; i++)
|
sl@0
|
73 |
test.Printf(_L("%02x "), pw[i]);
|
sl@0
|
74 |
test.Printf(_L("\n"));
|
sl@0
|
75 |
|
sl@0
|
76 |
for (i = 0; i < KMaxMediaPassword; i++)
|
sl@0
|
77 |
test.Printf(_L("%02x "), i);
|
sl@0
|
78 |
test.Printf(_L("\n"));
|
sl@0
|
79 |
}
|
sl@0
|
80 |
break;
|
sl@0
|
81 |
|
sl@0
|
82 |
case EMPEMCancel:
|
sl@0
|
83 |
test.Printf(_L("EMPEMCancel selected.\n"));
|
sl@0
|
84 |
break;
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
test.Next(_L("Closing notifier."));
|
sl@0
|
88 |
n.Close();
|
sl@0
|
89 |
|
sl@0
|
90 |
test.Getch();
|
sl@0
|
91 |
|
sl@0
|
92 |
test.End();
|
sl@0
|
93 |
|
sl@0
|
94 |
return KErrNone;
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|