Update contrib.
1 // Copyright (c) 2006-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.
14 // e32test\power\t_lddpowerseqtest.cpp
20 #include "d_lddpowerseqtest.h"
23 _LIT(KLddFileName, "D_LDDPOWERSEQTEST.LDD");
26 GLDEF_D RTest test(_L("T_LDDPOWERSEQTEST"));
31 TInt timeInterval = 3;
32 //time stamp for power up and powerdown of handlers
33 TUint time_power1up = 0, time_power1down = 0;
34 TUint time_power2up = 10, time_power2down = 0;
35 TRequestStatus statuspowerdown1;
36 TRequestStatus statuspowerdown2;
37 TRequestStatus statuspowerup1;
38 TRequestStatus statuspowerup2;
40 TRequestStatus tstatus;
42 test.Printf(_L("Loading logical device \n"));
43 r=User::LoadLogicalDevice(KLddFileName);
46 test.Printf(_L("Opening of logical device\n"));
50 //Send asynchronouse request for power status and time stamp during powerdown.
51 ldd.Test_power1down(statuspowerdown1, time_power1down);
52 ldd.Test_power2down(statuspowerdown2, time_power2down);
53 ldd.Test_power1up(statuspowerup1, time_power1up);
54 ldd.Test_power2up(statuspowerup2, time_power2up);
57 r = ldd.Test_setSleepTime(timeInterval);
61 r = timer.CreateLocal();
66 wakeup += TTimeIntervalMicroSeconds(5000000);
67 timer.At(tstatus, wakeup);
69 test.Printf(_L("Enable wakeup power events to standby\n"));
70 r = Power::EnableWakeupEvents(EPwStandby);
73 test.Printf(_L("Powerdown\n"));
74 r = Power::PowerDown();
77 test.Printf(_L("Waiting for power down request completion of handler1\n"));
78 User::WaitForRequest(statuspowerdown1);
79 test(statuspowerdown1.Int() == KErrNone);
81 test.Printf(_L("Waiting for power up request completion of handler1\n"));
82 User::WaitForRequest(statuspowerdown2);
83 test(statuspowerdown2.Int() == KErrNone);
85 test.Printf(_L("Waiting for power down request completion of handler2\n"));
86 User::WaitForRequest(statuspowerup1);
87 test(statuspowerup1.Int() == KErrNone);
89 test.Printf(_L("Waiting for power up request completion of handler2\n"));
90 User::WaitForRequest(statuspowerup2);
91 test(statuspowerup2.Int() == KErrNone);
93 test.Printf(_L("Waiting for time request completion\n"));;
94 User::WaitForRequest(tstatus);
95 test(tstatus.Int() == KErrNone);
99 test(time_power2down >= time_power1down + timeInterval);
100 test(time_power1up >= time_power2up + timeInterval);
101 test.Printf(_L("Verified power up and power down sequence -- OK \n"));
103 test.Printf(_L("Closing the channel\n"));
106 test.Printf(_L("Freeing logical device\n"));
107 r = User::FreeLogicalDevice(KLddFileName);;
115 GLDEF_C TInt E32Main()
117 // Test LDD power sequence
120 test.Start(_L("Test power up and power down sequence"));