//
// Copyright (c) 2009 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"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

PRINT Running  EMsvDeleteFileStore

///////////////////////////////////
// **** Service entry tests ****
///////////////////////////////////

//******************************************
// Entry is a service entry.
// We need WriteDeviceData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = WriteDeviceData. Same SID. Should Pass.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000020 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateServiceEntry.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Pass.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is a service entry.
// We need WriteDeviceData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = WriteUserData. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000020 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateServiceEntry.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00010000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is a service entry.
// We need WriteDeviceData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = 0. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000020 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateServiceEntry.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script





//////////////////////////////////////////
// **** Outbox tests (Protected folder) ****
//////////////////////////////////////////

//******************************************
// Entry is in Outbox (protected folder).
// We need ReadUserData + WriteUserData + NetworkServices to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData + WriteUserData + NetworkServices. Same SID. Should Pass.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001a000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateSingleEntryOutbox.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStorePF_Pass.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is in Outbox (protected folder).
// We need ReadUserData + WriteUserData + NetworkServices to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData + WriteUserData. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001e000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateSingleEntryOutbox.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00018000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStorePF_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is in Outbox (protected folder).
// We need ReadUserData + WriteUserData + NetworkServices to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData + NetworkServices. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001e000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateSingleEntryOutbox.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0000a000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStorePF_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is in Outbox (protected folder).
// We need ReadUserData + WriteUserData + NetworkServices to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = WriteUserData + NetworkServices. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001e000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateSingleEntryOutbox.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00012000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStorePF_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is in Outbox (protected folder).
// We need ReadUserData + WriteUserData + NetworkServices to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = 0. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001e000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateSingleEntryOutbox.script

DELAY 3000

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStorePF_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script



//////////////////////////////////////////
// **** Unprotected folder tests ****
//////////////////////////////////////////

//******************************************
// We don't own the entry.
// We need ReadUserData + WriteUserData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData + WriteUserData. Different SID. Should Pass.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00018000 -SID 101F7777 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStore_Pass.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// We don't own the entry.
// We need ReadUserData + WriteUserData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData. Different SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00008000 -SID 101F7777 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStore_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// We don't own the entry.
// We need ReadUserData + WriteUserData to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = WriteUserData. Different SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00010000 -SID 101F7777 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStore_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// We own the entry.
// We need no capabilities to access the entry.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = 0. Same SID. Should Pass.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStore_Pass.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script


///////////////////////////////////
// **** Remote Service tests ****
///////////////////////////////////

//******************************************
// Entry is in a remote service.
// We need ReadUserData + WriteUserData + MTM specific caps to access the entry.
// We're using pigeon which doesn't require any additional caps.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData + WriteUserData. Same SID. Should Pass.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 0001e000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateRemoteEntry.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Pass.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script


//******************************************
// Entry is in a remote service.
// We need ReadUserData + WriteUserData + MTM specific caps to access the entry.
// We're using pigeon which doesn't require any additional caps.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = ReadUserData. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00008000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateRemoteEntry.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script


//******************************************
// Entry is in a remote service.
// We need ReadUserData + WriteUserData + MTM specific caps to access the entry.
// We're using pigeon which doesn't require any additional caps.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = WriteUserData. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00010000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateRemoteEntry.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Fail.script

// Need delay to allow SendProxyServer shutting down
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script

//******************************************
// Entry is in a remote service.
// We need ReadUserData + WriteUserData + MTM specific caps to access the entry.
// We're using pigeon which doesn't require any additional caps.
//******************************************

PRINT Running  EMsvDeleteFileStore : Read Caps = 0. Same SID. Should Fail.
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Setup.script

RUN_PROGRAM -1 setcap MessagingTestServer_caps.exe 0003fffe -SID 101F7776 MessagingTestServer.exe

RUN_PROGRAM -1 setcap SendProxyServer_caps.exe 00000000 -SID 101F7776 SendProxyServer.exe

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_CreateRemoteEntry.script

RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_SendEMsvDeleteFileStoreSE_Fail.script
DELAY 3000
RUN_SCRIPT  c:\msgtest\TestFramework\ScriptedTestCases\Capabilities\Cap_Restore.script
