--- a/smsprotocols/smsstack/wapprot/test/Te_wapprot/WapIoctlSteps.cpp Mon Aug 09 17:43:08 2010 +0100
+++ b/smsprotocols/smsstack/wapprot/test/Te_wapprot/WapIoctlSteps.cpp Tue Sep 14 17:55:14 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
@@ -666,202 +666,6 @@
iSocket.Close();
return TestStepResult();
}
-
-TInt CBackupRestoreStep::SendWapL()
- {
- //modified from test 10
- INFO_PRINTF1(_L("SendWapL: send 7-Bit business card using IOCTL"));
-
- TInt ret = KErrNone;
-
- TPtrC16 TelNumber;
- TInt port=226;
-
- if(!GetStringFromConfig(ConfigSection(),KSCNumber,TelNumber) ||
- !GetIntFromConfig(ConfigSection(),KWapPort,port)
- )
- {
- // Leave if there's any error.
- User::Leave(KErrNotFound);
- }
-
- //
- // Setting the port number and service center number of the wap address
- // The service center number should be the same as the sim phone number used
- // for test (not required for SIM tsy)
- //
- TWapAddr wapAddr;
- wapAddr.SetWapPort(TWapPortNumber(port));
-
- TBuf8<100> scNumber;
- scNumber.Copy(TelNumber);
- TPtrC8 scAddr(scNumber);
- wapAddr.SetWapAddress(scAddr);
-
- //
- // Define and open the socket
- //
- RSocket sock;
- ret = sock.Open(iSocketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol);
- if (ret != KErrNone)
- {
- //
- // PREQ399 changes mean that -1 is sometimes now returned from Open() when
- // a Backup and Restore session is in progress (DEF114381).
- //
- INFO_PRINTF2(_L("Socket could not be opened (error %d)..."), ret);
-
- return ret;
- }
- CleanupClosePushL(sock);
-
- TRequestStatus status;
-
- //
- // Indicating to the protocol that it's a new client
- //
- INFO_PRINTF1(_L("Socket set option for indicating new client"));
- User::LeaveIfError(sock.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
- //
- // Bind
- //
- User::LeaveIfError(sock.Bind(wapAddr));
-
- TTimeIntervalMicroSeconds32 InitPause=9000000; //Pause to Allow SMSStack to Complete its Async Init
- User::After(InitPause); //call to the TSY and finish its StartUp.
-
- //
- // Send a calendar entry
- //
- TPtrC testData = GetStringFromConfigL(KTestData1);
- TBuf8<200> data;
- data.Copy(testData);
- sock.SendTo(data, wapAddr, 0, status);
- User::WaitForRequest(status);
- ret = status.Int();
-
- if(ret == KErrNone)
- {
- INFO_PRINTF1(_L("Message sent..."));
- }
- else
- {
- INFO_PRINTF2(_L("Message NOT sent (error %d)..."), ret);
- }
-
- CleanupStack::PopAndDestroy(&sock);
- return ret;
- }
-
-TBool CBackupRestoreStep::IsWapFileOpenL()
- {
- TBool ret = ETrue; //assume the file was open
- RFs fsSession;
- User::LeaveIfError(fsSession.Connect());
- CleanupClosePushL(fsSession);
-
- CFileMan* fileManager = CFileMan::NewL(fsSession);
- CleanupStack::PushL(fileManager);
-
- _LIT(KWapFile,"C:\\Private\\101F7989\\sms\\wapreast.dat");
- _LIT(KWapFileBackup,"C:\\Private\\101f7989\\sms\\wapreast.backup");
-
- TEntry entry;
- if (fsSession.Entry(KWapFile,entry)==KErrNone) // File found
- {
- TInt moveStatus = fileManager->Move(KWapFile,KWapFileBackup);
- TESTL(moveStatus == KErrNone || moveStatus == KErrInUse);
-
- // If the move was successful, the file is not opened
- // If the move failed with KErrInUse the file is opened
- if (moveStatus == KErrNone)
- {
- // move it back
- TEST(fileManager->Move(KWapFileBackup,KWapFile) == KErrNone);
- ret = EFalse;
- }
- else // moveStatus == KErrInUse
- {
- ret = ETrue;
- }
- }
- else
- {
- //file not found so it couldn't be open
- ret = EFalse;
- }
-
- CleanupStack::PopAndDestroy(fileManager);
- CleanupStack::PopAndDestroy(&fsSession);
-
- if(ret)
- INFO_PRINTF1(_L("Wapfile open..."));
- else
- INFO_PRINTF1(_L("Wapfile closed..."));
-
- return ret;
- }
-
-TVerdict CBackupRestoreStep::doTestStepL()
-/**
- * Test step 16:
- * simulating backup and restore
- * @return - TVerdict code
- */
- {
- INFO_PRINTF1(_L("IOCTL Test step 16: send 7-Bit business card using IOCTL to test backup and restore"));
- CSBEClient* secureBackupEngine = CSBEClient::NewL();
- CleanupStack::PushL(secureBackupEngine);
- secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
- EBURNormal, ENoBackup);
-
- INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
- TEST(SendWapL() == KErrNone);
- TEST(IsWapFileOpenL() != EFalse);
-
- // Notify the WAPPROT server that a backup is about to take place and
- // that the server should close the wapstor
- INFO_PRINTF1(_L("Simulating a backup notification"));
- secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
- EBURBackupFull, EBackupBase);
-
- INFO_PRINTF1(_L("Expecting SendWapL to fail and the wap data file to be closed"));
- TEST(SendWapL() != KErrNone);
- TEST(IsWapFileOpenL() == EFalse);
-
- // Notify the WAPPROT server that a backup has completed
- // that the server should open the wapstor
- INFO_PRINTF1(_L("Simulating a backup complete notification"));
- secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
- EBURNormal, ENoBackup);
-
- INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
- TEST(SendWapL() == KErrNone);
- TEST(IsWapFileOpenL() != EFalse);
-
- // Notify the WAPPROT server that a restore is about to take place and
- // that the server should close the wapstor
- INFO_PRINTF1(_L("Simulating a restore notification"));
- secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
- EBURRestorePartial, EBackupIncrement);
-
- INFO_PRINTF1(_L("Expecting SendWapL to fail and the wap data file to be closed"));
- TEST(SendWapL() != KErrNone);
- TEST(IsWapFileOpenL() == EFalse);
-
- // Notify the WAPPROT server that a restore has completed
- // that the server should open the wapstor
- INFO_PRINTF1(_L("Simulating a restore complete notification"));
- secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
- EBURNormal, ENoBackup);
-
- INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
- TEST(SendWapL() == KErrNone);
- TEST(IsWapFileOpenL() != EFalse);
-
- CleanupStack::PopAndDestroy(secureBackupEngine); // testNumberProperty, secureBackupEngine
- return TestStepResult();
- }
TVerdict CIoctlStep_17::doTestStepL()
/**