1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2005-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 the License "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". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
669 TEST(ret == KErrNone); |
667 TEST(ret == KErrNone); |
670 User::LeaveIfError(ret); |
668 User::LeaveIfError(ret); |
671 INFO_PRINTF1(_L(" Attach CommandLine of Child One to its Process ")); |
669 INFO_PRINTF1(_L(" Attach CommandLine of Child One to its Process ")); |
672 |
670 |
673 INFO_PRINTF1(_L(" Run Child One ")); |
671 INFO_PRINTF1(_L(" Run Child One ")); |
|
672 TRequestStatus childOnestatus; |
|
673 childProcOne.Rendezvous(childOnestatus); |
674 childProcOne.Resume(); |
674 childProcOne.Resume(); |
675 //Time for the child process to launch itself |
675 //Wait for the child process to launch itself |
676 User::After(1000000); |
676 User::WaitForRequest(childOnestatus); |
677 |
677 |
678 //child process Id is reqd to monitor if it gets killed on its parent's termination |
678 //child process Id is reqd to monitor if it gets killed on its parent's termination |
679 TUint64 childProcOneId = childProcOne.Id(); |
679 TUint64 childProcOneId = childProcOne.Id(); |
680 INFO_PRINTF2(_L(" Child One Id = 0x%lx "),childProcOneId); |
680 INFO_PRINTF2(_L(" Child One Id = 0x%lx "),childProcOneId); |
681 |
681 |
701 TEST(ret == KErrNone); |
701 TEST(ret == KErrNone); |
702 User::LeaveIfError(ret); |
702 User::LeaveIfError(ret); |
703 INFO_PRINTF1(_L(" Attach CommandLine of Child Two to its Process ")); |
703 INFO_PRINTF1(_L(" Attach CommandLine of Child Two to its Process ")); |
704 |
704 |
705 INFO_PRINTF1(_L(" Run Child Two ")); |
705 INFO_PRINTF1(_L(" Run Child Two ")); |
|
706 TRequestStatus childTwostatus; |
|
707 childProcTwo.Rendezvous(childTwostatus); |
706 childProcTwo.Resume(); |
708 childProcTwo.Resume(); |
707 //Time for the child process to launch itself |
709 //Wait for the child process to launch itself |
708 User::After(1000000); |
710 User::WaitForRequest(childTwostatus); |
709 |
711 |
710 //child process Id is reqd to monitor if it gets killed on its parent's termination |
712 //child process Id is reqd to monitor if it gets killed on its parent's termination |
711 TUint64 childProcTwoId = childProcTwo.Id(); |
713 TUint64 childProcTwoId = childProcTwo.Id(); |
712 INFO_PRINTF2(_L(" Child Two Id = 0x%lx "),childProcTwoId); |
714 INFO_PRINTF2(_L(" Child Two Id = 0x%lx "),childProcTwoId); |
713 |
715 |
732 TRAP(ret,childProcThreeCmdln->SetProcessEnvironmentL(childProcThree)); |
734 TRAP(ret,childProcThreeCmdln->SetProcessEnvironmentL(childProcThree)); |
733 TEST(ret == KErrNone); |
735 TEST(ret == KErrNone); |
734 User::LeaveIfError(ret); |
736 User::LeaveIfError(ret); |
735 INFO_PRINTF1(_L(" Attach CommandLine of Child Three to its Process ")); |
737 INFO_PRINTF1(_L(" Attach CommandLine of Child Three to its Process ")); |
736 |
738 |
|
739 TRequestStatus childThreestatus; |
|
740 childProcThree.Rendezvous(childThreestatus); |
737 childProcThree.Resume(); |
741 childProcThree.Resume(); |
738 |
742 |
739 //Time for the child process to launch itself |
743 //Wait for the child process to launch itself |
740 User::After(1000000); |
744 User::WaitForRequest(childThreestatus); |
741 |
745 |
742 //child process Id is reqd to monitor if it gets killed on its parent's termination |
746 //child process Id is reqd to monitor if it gets killed on its parent's termination |
743 TUint64 childProcThreeId = childProcThree.Id(); |
747 TUint64 childProcThreeId = childProcThree.Id(); |
744 INFO_PRINTF2(_L(" Child Three Id = 0x%lx "),childProcThreeId); |
748 INFO_PRINTF2(_L(" Child Three Id = 0x%lx "),childProcThreeId); |
745 |
749 |
751 |
755 |
752 TExitType exitType = parentProc.ExitType(); |
756 TExitType exitType = parentProc.ExitType(); |
753 TEST(exitType == EExitTerminate); |
757 TEST(exitType == EExitTerminate); |
754 TInt exitReason = parentProc.ExitReason(); |
758 TInt exitReason = parentProc.ExitReason(); |
755 TEST(exitReason == 0); |
759 TEST(exitReason == 0); |
|
760 INFO_PRINTF3(_L(" Parent process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); |
756 if(exitType == EExitTerminate && exitReason == 0) |
761 if(exitType == EExitTerminate && exitReason == 0) |
757 { |
762 { |
758 INFO_PRINTF1(_L(" Parent process is Terminated ")); |
763 INFO_PRINTF1(_L(" Parent process is Terminated ")); |
759 } |
764 } |
760 |
765 |
761 exitType = childProcOne.ExitType(); |
766 exitType = childProcOne.ExitType(); |
762 TEST(exitType == EExitTerminate); |
767 TEST(exitType == EExitTerminate); |
763 exitReason = childProcOne.ExitReason(); |
768 exitReason = childProcOne.ExitReason(); |
764 TEST(exitReason == 0); |
769 TEST(exitReason == 0); |
|
770 INFO_PRINTF3(_L(" Child I process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); |
765 if(exitType == EExitTerminate && exitReason == 0) |
771 if(exitType == EExitTerminate && exitReason == 0) |
766 { |
772 { |
767 INFO_PRINTF1(_L(" Child I is killed ")); |
773 INFO_PRINTF1(_L(" Child I is killed ")); |
768 } |
774 } |
769 |
775 |
|
776 childProcTwo.Logon(childTwostatus); |
|
777 User::WaitForRequest(childTwostatus); |
770 exitType = childProcTwo.ExitType(); |
778 exitType = childProcTwo.ExitType(); |
771 TEST(exitType == EExitTerminate); |
779 TEST(exitType == EExitTerminate); |
772 exitReason = childProcTwo.ExitReason(); |
780 exitReason = childProcTwo.ExitReason(); |
773 TEST(exitReason == 0); |
781 TEST(exitReason == 0); |
|
782 INFO_PRINTF3(_L(" Child II process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); |
774 if(exitType == EExitTerminate && exitReason == 0) |
783 if(exitType == EExitTerminate && exitReason == 0) |
775 { |
784 { |
776 INFO_PRINTF1(_L(" Child II is killed ")); |
785 INFO_PRINTF1(_L(" Child II is killed ")); |
777 } |
786 } |
778 |
787 |
779 //Wait 1sec to close the child process |
788 //Wait to close the child process |
780 User::After(1000000); |
789 childProcThree.Logon(childThreestatus); |
|
790 User::WaitForRequest(childThreestatus); |
781 exitType = childProcThree.ExitType(); |
791 exitType = childProcThree.ExitType(); |
782 TEST(exitType == EExitTerminate); |
792 TEST(exitType == EExitTerminate); |
783 exitReason = childProcThree.ExitReason(); |
793 exitReason = childProcThree.ExitReason(); |
784 TEST(exitReason == 0); |
794 TEST(exitReason == 0); |
|
795 INFO_PRINTF3(_L(" Child III process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); |
785 if(exitType == EExitTerminate && exitReason == 0) |
796 if(exitType == EExitTerminate && exitReason == 0) |
786 { |
797 { |
787 INFO_PRINTF1(_L(" Child III is killed ")); |
798 INFO_PRINTF1(_L(" Child III is killed ")); |
788 } |
799 } |
789 |
800 |
1090 ret = childProc.SetParameter(12,parentProcId); |
1101 ret = childProc.SetParameter(12,parentProcId); |
1091 TEST(ret == KErrNone); |
1102 TEST(ret == KErrNone); |
1092 INFO_PRINTF2(_L(" Set the Parent Process Id - 0x%lx to Child through SetParameter API in Slot 12 "),parentProcId); |
1103 INFO_PRINTF2(_L(" Set the Parent Process Id - 0x%lx to Child through SetParameter API in Slot 12 "),parentProcId); |
1093 |
1104 |
1094 INFO_PRINTF1(_L(" Run Child Process ")); |
1105 INFO_PRINTF1(_L(" Run Child Process ")); |
|
1106 TRequestStatus status; |
|
1107 childProc.Rendezvous(status); |
1095 childProc.Resume(); |
1108 childProc.Resume(); |
1096 //Time for the child process to launch itself |
1109 //Wait for the child process to launch itself |
1097 User::After(1000000); |
1110 User::WaitForRequest(status); |
1098 |
1111 |
1099 RFs fs; |
1112 RFs fs; |
1100 RFile file; |
1113 RFile file; |
1101 ret=fs.Connect(); |
1114 ret=fs.Connect(); |
1102 TEST(ret == KErrNone); |
1115 TEST(ret == KErrNone); |
1247 ret = childProc.SetParameter(12,parentProcId); |
1260 ret = childProc.SetParameter(12,parentProcId); |
1248 TEST(ret == KErrNone); |
1261 TEST(ret == KErrNone); |
1249 INFO_PRINTF2(_L(" Set the Parent Process Id - 0x%lx to Child through SetParameter API in Slot 12 "),parentProcId); |
1262 INFO_PRINTF2(_L(" Set the Parent Process Id - 0x%lx to Child through SetParameter API in Slot 12 "),parentProcId); |
1250 |
1263 |
1251 INFO_PRINTF1(_L(" Run Child Process ")); |
1264 INFO_PRINTF1(_L(" Run Child Process ")); |
|
1265 TRequestStatus status; |
|
1266 childProc.Rendezvous(status); |
1252 childProc.Resume(); |
1267 childProc.Resume(); |
1253 //Time for the child process to launch itself |
1268 //Wait for the child process to launch itself |
1254 User::After(1000000); |
1269 User::WaitForRequest(status); |
1255 |
1270 |
1256 RFs fs; |
1271 RFs fs; |
1257 RFile file; |
1272 RFile file; |
1258 ret = fs.Connect(); |
1273 ret = fs.Connect(); |
1259 TEST(ret == KErrNone); |
1274 TEST(ret == KErrNone); |