appfw/apparchitecture/tef/T_ControlPanelTest.cpp
branchRCL_3
changeset 63 c2c61fdca848
parent 62 924385140d98
equal deleted inserted replaced
62:924385140d98 63:c2c61fdca848
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    46 #include <w32std.h>
    46 #include <w32std.h>
    47 
    47 
    48 #if !defined(__E32TEST_H__)
    48 #if !defined(__E32TEST_H__)
    49 #include <e32test.h>
    49 #include <e32test.h>
    50 #endif
    50 #endif
    51 #include "T_SisFileInstaller.h"
       
    52 
    51 
    53 _LIT(KCompleted, "Completed.");
    52 _LIT(KCompleted, "Completed.");
    54 
    53 
    55 
    54 
    56 _LIT(KCtrlApp2SisFile, "z:\\apparctest\\apparctestsisfiles\\app_CTRL2.sis");
    55 _LIT(KRSCDIR,"C:\\Resource\\apps\\");
    57 _LIT(KCtrlApp2Component, "app_CTRL2");
    56 _LIT(KRSCREGDIR,"C:\\private\\10003a3f\\import\\apps\\");
    58 
       
    59 _LIT(KNEWCTLPATH,"C:\\sys\\bin\\app_CTRL2.exe");
    57 _LIT(KNEWCTLPATH,"C:\\sys\\bin\\app_CTRL2.exe");
    60 
    58 _LIT(KSRCRESOURCEPATH,"Z:\\private\\10003a3f\\import\\apps\\App_CTRL2_reg.Rsc");
       
    59 _LIT(KDESTRESOURCEPATH,"C:\\private\\10003a3f\\import\\apps\\App_CTRL2_reg.Rsc");
    61 
    60 
    62 LOCAL_D TInt SimulateKeyL(TAny*)
    61 LOCAL_D TInt SimulateKeyL(TAny*)
    63 	{
    62 	{
    64 	User::After(3000000);
    63 	User::After(3000000);
    65 	RWsSession session;
    64 	RWsSession session;
    85 	session.Flush();
    84 	session.Flush();
    86 	
    85 	
    87 	session.Close();
    86 	session.Close();
    88 	return KErrNone;
    87 	return KErrNone;
    89 	}
    88 	}
       
    89 
       
    90 void CT_ControlPanelTestStep::RemoveFilesFromCDrive()
       
    91 	{
       
    92 	TInt ret = iTestServ.SetReadOnly(KDESTRESOURCEPATH,0); //remove READ ONLY option
       
    93 	TEST(ret==KErrNone);
       
    94 
       
    95 	TRAP(ret,iTestServ.DeleteFileL(KDESTRESOURCEPATH));
       
    96 	TEST(ret==KErrNone);
       
    97 	}
       
    98 
       
    99 
    90 
   100 
    91 /**
   101 /**
    92   Auxiliary Fn for Test Case ID T-ControlPanelStep-testControls1L,
   102   Auxiliary Fn for Test Case ID T-ControlPanelStep-testControls1L,
    93   T-ControlPanelStep-testControls2L, T-ControlPanelStep-testControls3L
   103   T-ControlPanelStep-testControls2L, T-ControlPanelStep-testControls3L
    94  
   104  
   197 
   207 
   198 void CT_ControlPanelTestStep::testControls2L()
   208 void CT_ControlPanelTestStep::testControls2L()
   199 	{
   209 	{
   200 	INFO_PRINTF1(_L("In testControls2L......"));	
   210 	INFO_PRINTF1(_L("In testControls2L......"));	
   201 	
   211 	
   202 	INFO_PRINTF1(_L("Application installing to C Drive......"));
   212 	iTestServ.CreateDirectoryL(KRSCDIR);
   203 
   213 	iTestServ.CreateDirectoryL(KRSCREGDIR);
   204     CSisFileInstaller sisFileInstaller;
   214 
   205     INFO_PRINTF2(_L("Installing sis file from -> %S"), &KCtrlApp2SisFile);
   215 	TInt ret=iTestServ.CopyFileL(KSRCRESOURCEPATH,KDESTRESOURCEPATH);
   206     sisFileInstaller.InstallSisL(KCtrlApp2SisFile);
   216 	TEST(ret==KErrNone);
   207     
   217 	
   208     INFO_PRINTF1(_L("Updating the list ......"));
   218 	INFO_PRINTF1(_L("Files Copied to C Drive......"));
   209     TInt ret;
   219 	INFO_PRINTF1(_L("Updating the list ......"));
   210     iControlCount=iControlList->UpdateCount();
   220 	iControlCount=iControlList->UpdateCount();
   211 	while(iControlList->UpdateCount()<=iControlCount)
   221 	while(iControlList->UpdateCount()<=iControlCount)
   212 		{
   222 		{
   213 		TRAP(ret, iControlList->UpdateL());
   223 		TRAP(ret, iControlList->UpdateL());
   214 		if(ret!=KErrNone)
   224 		if(ret!=KErrNone)
   215 			{
   225 			{
   226 	iIndex = ControlIndexInList(iControlList,ETrue);
   236 	iIndex = ControlIndexInList(iControlList,ETrue);
   227 	TEST((iIndex >= 0) && (iIndex < iControlCount3));
   237 	TEST((iIndex >= 0) && (iIndex < iControlCount3));
   228 
   238 
   229 	TFileName name=iControlList->Control(iIndex)->FileName();
   239 	TFileName name=iControlList->Control(iIndex)->FileName();
   230 	TEST(name.CompareF(KNEWCTLPATH)==0);
   240 	TEST(name.CompareF(KNEWCTLPATH)==0);
   231 	
   241 	RemoveFilesFromCDrive();
   232 	sisFileInstaller.UninstallSisL(KCtrlApp2Component);
   242 	INFO_PRINTF1(_L("Removed the file from C Drive......"));
   233 	INFO_PRINTF1(_L("Removed application from C Drive......"));
       
   234 	INFO_PRINTF1(_L("Updating the list ......"));
   243 	INFO_PRINTF1(_L("Updating the list ......"));
   235 	iControlCount=iControlList->UpdateCount();
   244 	iControlCount=iControlList->UpdateCount();
   236 	while(iControlList->UpdateCount()<=iControlCount)
   245 	while(iControlList->UpdateCount()<=iControlCount)
   237 		{
   246 		{
   238 		TRAPD(ret, iControlList->UpdateL());
   247 		TRAPD(ret, iControlList->UpdateL());
   438 	User::LeaveIfError(iFs.Connect());
   447 	User::LeaveIfError(iFs.Connect());
   439 	
   448 	
   440 	// connect to the test utils server
   449 	// connect to the test utils server
   441 	User::LeaveIfError(iTestServ.Connect());
   450 	User::LeaveIfError(iTestServ.Connect());
   442 	
   451 	
   443 	RApaLsSession ls;
       
   444 	User::LeaveIfError(ls.Connect());
       
   445 	
       
   446 	TRequestStatus status;
       
   447 	ls.SetNotify(ETrue, status);
       
   448 	User::WaitForRequest(status);
       
   449 	ls.Close();
       
   450 	
       
   451 	// Run the tests...w	
   452 	// Run the tests...w	
   452 	TRAPD(ret,DoStepTestsInCallbackL())
   453 	TRAPD(ret,DoStepTestsInCallbackL())
   453 	TEST(ret==KErrNone);
   454 	TEST(ret==KErrNone);
   454 
   455 
   455 	// Close everything
   456 	// Close everything