5615 |
5618 |
5616 CleanupStack::PopAndDestroy(3, this); // data, this, ussdMessaging |
5619 CleanupStack::PopAndDestroy(3, this); // data, this, ussdMessaging |
5617 |
5620 |
5618 } |
5621 } |
5619 |
5622 |
|
5623 |
|
5624 /** |
|
5625 @SYMTestCaseID BA-CTSY-USSDM-USMDH-0001 |
|
5626 @SYMComponent telephony_ctsy |
|
5627 @SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default handler |
|
5628 @SYMTestPriority High |
|
5629 @SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option |
|
5630 @SYMTestExpectedResults Pass |
|
5631 @SYMTestType CT |
|
5632 */ |
|
5633 void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0001L() |
|
5634 { |
|
5635 OpenEtelServerL(EUseExtendedError); |
|
5636 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
5637 OpenPhoneL(); |
|
5638 |
|
5639 RBuf8 data; |
|
5640 CleanupClosePushL(data); |
|
5641 |
|
5642 RArray<TUssdClientTestData> data1; |
|
5643 RMobileUssdMessaging ussdMessaging; |
|
5644 TInt ret = ussdMessaging.Open(iPhone); |
|
5645 ASSERT_EQUALS(KErrNone, ret); |
|
5646 CleanupClosePushL(ussdMessaging); |
|
5647 |
|
5648 TRequestStatus requestStatus; |
|
5649 |
|
5650 TUint32 flags = 100; |
|
5651 RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
|
5652 RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
|
5653 TUint8 dcs = 200; |
|
5654 |
|
5655 //------------------------------------------------------------------------- |
|
5656 // function parameters |
|
5657 |
|
5658 RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
|
5659 TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
|
5660 |
|
5661 attributes.iFlags = flags; |
|
5662 attributes.iFormat = format; |
|
5663 attributes.iType = type; |
|
5664 attributes.iDcs = dcs; |
|
5665 |
|
5666 TName name = _L("Name1"); |
|
5667 TPckg<TName> msgData(name); |
|
5668 |
|
5669 //------------------------------------------------------------------------- |
|
5670 |
|
5671 TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5672 mockData2(name, attributes); |
|
5673 mockData2.SerialiseL(data); |
|
5674 //------------------------------------------------------------------------- |
|
5675 RBuf8 data2; |
|
5676 CleanupClosePushL(data2); |
|
5677 //------------------------------------------------------------------------- |
|
5678 RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes; |
|
5679 completeAttributes.iFlags = flags; |
|
5680 completeAttributes.iFormat = format; |
|
5681 completeAttributes.iType = type; |
|
5682 completeAttributes.iDcs = dcs; |
|
5683 TBuf8<KMaxName> completeName = _L8("Name2"); |
|
5684 TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5685 mockData3(completeName, completeAttributes); |
|
5686 mockData3.SerialiseL(data2); |
|
5687 //------------------------------------------------------------------------- |
|
5688 data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default |
|
5689 const TInt numClients = data1.Count(); |
|
5690 RProcess* proc = new RProcess[numClients]; |
|
5691 TRequestStatus* req = new TRequestStatus[numClients]; |
|
5692 |
|
5693 for (TInt i=0; i<numClients; ++i) |
|
5694 { |
|
5695 TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams); |
|
5696 // If a client isn't created properly, we need to clean up previously created ones here |
|
5697 if (err != KErrNone) |
|
5698 { |
|
5699 for (TInt c=0; c<i-1; ++c) |
|
5700 { |
|
5701 proc[c].Kill(KErrNone); |
|
5702 proc[c].Close(); |
|
5703 } |
|
5704 } |
|
5705 // Fail the test if any client has not been created properly |
|
5706 ASSERT_EQUALS(err, KErrNone); |
|
5707 } |
|
5708 // All processes created successfully, start their execution |
|
5709 for (TInt i = 0; i < numClients; i++) |
|
5710 { |
|
5711 proc[i].Logon(req[i]); |
|
5712 proc[i].Resume(); |
|
5713 // Pause here so that clients register in the order specified (i.e. As ordered in the array) |
|
5714 // Resolves timing issues in WDP/SMP. |
|
5715 User::After(500000); |
|
5716 } |
|
5717 //------------------------------------------------------------------------- |
|
5718 |
|
5719 iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data); |
|
5720 iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone); |
|
5721 |
|
5722 ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler); |
|
5723 User::WaitForRequest(requestStatus); |
|
5724 AssertMockLtsyStatusL(); |
|
5725 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
5726 //--------------------------------------------------------------------------- |
|
5727 |
|
5728 iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15); |
|
5729 User::After(5 * 1000000); |
|
5730 |
|
5731 for (TInt i = 0; i < numClients; i++) |
|
5732 { |
|
5733 TRequestStatus status = req[i]; |
|
5734 TExitType exit = proc[i].ExitType(); |
|
5735 TInt reason = proc[i].ExitReason(); |
|
5736 |
|
5737 // Kill/Close the clients before doing assert |
|
5738 proc[i].Kill(KErrNone); |
|
5739 proc[i].Close(); |
|
5740 |
|
5741 const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus; |
|
5742 const TBool checkExitType = exit == data1[i].iExitType; |
|
5743 TBool checkExitReason = ETrue; |
|
5744 if (data1[i].iExitType == EExitKill) |
|
5745 { |
|
5746 checkExitReason = reason == data1[i].iExitReason; |
|
5747 } |
|
5748 |
|
5749 if (!checkRequestStatus || !checkExitType || !checkExitReason) |
|
5750 { |
|
5751 // Some useful output in case of a failed test |
|
5752 INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i); |
|
5753 if (!checkRequestStatus) |
|
5754 INFO_PRINTF3(_L(" [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int()); |
|
5755 if (!checkExitType) |
|
5756 INFO_PRINTF3(_L(" [ExitType] Expected: %d , Actual: %d"),data1[i].iExitType,exit); |
|
5757 if (!checkExitReason) |
|
5758 INFO_PRINTF3(_L(" [ExitReason] Expected: %d , Actual: %d"),data1[i].iExitReason,reason); |
|
5759 for (TInt c=i+1; c<numClients; ++c) |
|
5760 { |
|
5761 proc[c].Kill(KErrNone); |
|
5762 proc[c].Close(); |
|
5763 } |
|
5764 ASSERT_TRUE(checkRequestStatus); |
|
5765 ASSERT_TRUE(checkExitType); |
|
5766 ASSERT_TRUE(checkExitReason); |
|
5767 } |
|
5768 } |
|
5769 //--------------------------------------------------------------------------- |
|
5770 data1.Close(); |
|
5771 CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging |
|
5772 } |
|
5773 |
|
5774 |
|
5775 |
|
5776 /** |
|
5777 @SYMTestCaseID BA-CTSY-USSDM-USMDH-0002 |
|
5778 @SYMComponent telephony_ctsy |
|
5779 @SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with two default clients |
|
5780 @SYMTestPriority High |
|
5781 @SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option |
|
5782 @SYMTestExpectedResults Pass |
|
5783 @SYMTestType CT |
|
5784 */ |
|
5785 void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0002L() |
|
5786 { |
|
5787 |
|
5788 OpenEtelServerL(EUseExtendedError); |
|
5789 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
5790 OpenPhoneL(); |
|
5791 |
|
5792 RBuf8 data; |
|
5793 CleanupClosePushL(data); |
|
5794 |
|
5795 RArray<TUssdClientTestData> data1; |
|
5796 RMobileUssdMessaging ussdMessaging; |
|
5797 TInt ret = ussdMessaging.Open(iPhone); |
|
5798 ASSERT_EQUALS(KErrNone, ret); |
|
5799 CleanupClosePushL(ussdMessaging); |
|
5800 |
|
5801 TRequestStatus requestStatus; |
|
5802 |
|
5803 TUint32 flags = 100; |
|
5804 RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
|
5805 RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
|
5806 TUint8 dcs = 200; |
|
5807 |
|
5808 //------------------------------------------------------------------------- |
|
5809 // function parameters |
|
5810 |
|
5811 RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
|
5812 TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
|
5813 |
|
5814 attributes.iFlags = flags; |
|
5815 attributes.iFormat = format; |
|
5816 attributes.iType = type; |
|
5817 attributes.iDcs = dcs; |
|
5818 |
|
5819 TName name = _L("Name1"); |
|
5820 TPckg<TName> msgData(name); |
|
5821 |
|
5822 //------------------------------------------------------------------------- |
|
5823 |
|
5824 TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5825 mockData2(name, attributes); |
|
5826 mockData2.SerialiseL(data); |
|
5827 //------------------------------------------------------------------------- |
|
5828 RBuf8 data2; |
|
5829 CleanupClosePushL(data2); |
|
5830 //------------------------------------------------------------------------- |
|
5831 RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes; |
|
5832 completeAttributes.iFlags = flags; |
|
5833 completeAttributes.iFormat = format; |
|
5834 completeAttributes.iType = type; |
|
5835 completeAttributes.iDcs = dcs; |
|
5836 TBuf8<KMaxName> completeName = _L8("Name2"); |
|
5837 TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5838 mockData3(completeName, completeAttributes); |
|
5839 mockData3.SerialiseL(data2); |
|
5840 //------------------------------------------------------------------------- |
|
5841 data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default |
|
5842 data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Second default client |
|
5843 const TInt numClients = data1.Count(); |
|
5844 RProcess* proc = new RProcess[numClients]; |
|
5845 TRequestStatus* req = new TRequestStatus[numClients]; |
|
5846 |
|
5847 for (TInt i=0; i<numClients; ++i) |
|
5848 { |
|
5849 TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams); |
|
5850 // If a client isn't created properly, we need to clean up previously created ones here |
|
5851 if (err != KErrNone) |
|
5852 { |
|
5853 for (TInt c=0; c<i-1; ++c) |
|
5854 { |
|
5855 proc[c].Kill(KErrNone); |
|
5856 proc[c].Close(); |
|
5857 } |
|
5858 } |
|
5859 // Fail the test if any client has not been created properly |
|
5860 ASSERT_EQUALS(err, KErrNone); |
|
5861 } |
|
5862 // All processes created successfully, start their execution |
|
5863 for (TInt i = 0; i < numClients; i++) |
|
5864 { |
|
5865 proc[i].Logon(req[i]); |
|
5866 proc[i].Resume(); |
|
5867 // Pause here so that clients register in the order specified (i.e. As ordered in the array) |
|
5868 // Resolves timing issues in WDP/SMP. |
|
5869 User::After(500000); |
|
5870 } |
|
5871 //------------------------------------------------------------------------- |
|
5872 |
|
5873 iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data); |
|
5874 iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone); |
|
5875 |
|
5876 ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler); |
|
5877 User::WaitForRequest(requestStatus); |
|
5878 AssertMockLtsyStatusL(); |
|
5879 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
5880 //--------------------------------------------------------------------------- |
|
5881 |
|
5882 iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15); |
|
5883 User::After(5 * 1000000); |
|
5884 |
|
5885 for (TInt i = 0; i < numClients; i++) |
|
5886 { |
|
5887 TRequestStatus status = req[i]; |
|
5888 TExitType exit = proc[i].ExitType(); |
|
5889 TInt reason = proc[i].ExitReason(); |
|
5890 |
|
5891 // Kill/Close the clients before doing assert |
|
5892 proc[i].Kill(KErrNone); |
|
5893 proc[i].Close(); |
|
5894 |
|
5895 const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus; |
|
5896 const TBool checkExitType = exit == data1[i].iExitType; |
|
5897 TBool checkExitReason = ETrue; |
|
5898 if (data1[i].iExitType == EExitKill) |
|
5899 { |
|
5900 checkExitReason = reason == data1[i].iExitReason; |
|
5901 } |
|
5902 |
|
5903 if (!checkRequestStatus || !checkExitType || !checkExitReason) |
|
5904 { |
|
5905 // Some useful output in case of a failed test |
|
5906 INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i); |
|
5907 if (!checkRequestStatus) |
|
5908 INFO_PRINTF3(_L(" [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int()); |
|
5909 if (!checkExitType) |
|
5910 INFO_PRINTF3(_L(" [ExitType] Expected: %d , Actual: %d"),data1[i].iExitType,exit); |
|
5911 if (!checkExitReason) |
|
5912 INFO_PRINTF3(_L(" [ExitReason] Expected: %d , Actual: %d"),data1[i].iExitReason,reason); |
|
5913 for (TInt c=i+1; c<numClients; ++c) |
|
5914 { |
|
5915 proc[c].Kill(KErrNone); |
|
5916 proc[c].Close(); |
|
5917 } |
|
5918 ASSERT_TRUE(checkRequestStatus); |
|
5919 ASSERT_TRUE(checkExitType); |
|
5920 ASSERT_TRUE(checkExitReason); |
|
5921 } |
|
5922 } |
|
5923 //--------------------------------------------------------------------------- |
|
5924 data1.Close(); |
|
5925 CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging |
|
5926 } |
|
5927 |
|
5928 |
|
5929 |
|
5930 /** |
|
5931 @SYMTestCaseID BA-CTSY-USSDM-USMDH-0003 |
|
5932 @SYMComponent telephony_ctsy |
|
5933 @SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default and priority clients |
|
5934 @SYMTestPriority High |
|
5935 @SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option |
|
5936 @SYMTestExpectedResults Pass |
|
5937 @SYMTestType CT |
|
5938 */ |
|
5939 void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0003L() |
|
5940 { |
|
5941 |
|
5942 OpenEtelServerL(EUseExtendedError); |
|
5943 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
5944 OpenPhoneL(); |
|
5945 |
|
5946 RBuf8 data; |
|
5947 CleanupClosePushL(data); |
|
5948 |
|
5949 RArray<TUssdClientTestData> data1; |
|
5950 RMobileUssdMessaging ussdMessaging; |
|
5951 TInt ret = ussdMessaging.Open(iPhone); |
|
5952 ASSERT_EQUALS(KErrNone, ret); |
|
5953 CleanupClosePushL(ussdMessaging); |
|
5954 |
|
5955 TRequestStatus requestStatus; |
|
5956 |
|
5957 TUint32 flags = 100; |
|
5958 RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
|
5959 RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
|
5960 TUint8 dcs = 200; |
|
5961 |
|
5962 //------------------------------------------------------------------------- |
|
5963 // function parameters |
|
5964 |
|
5965 RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
|
5966 TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
|
5967 |
|
5968 attributes.iFlags = flags; |
|
5969 attributes.iFormat = format; |
|
5970 attributes.iType = type; |
|
5971 attributes.iDcs = dcs; |
|
5972 |
|
5973 TName name = _L("Name1"); |
|
5974 TPckg<TName> msgData(name); |
|
5975 |
|
5976 //------------------------------------------------------------------------- |
|
5977 |
|
5978 TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5979 mockData2(name, attributes); |
|
5980 mockData2.SerialiseL(data); |
|
5981 //------------------------------------------------------------------------- |
|
5982 RBuf8 data2; |
|
5983 CleanupClosePushL(data2); |
|
5984 //------------------------------------------------------------------------- |
|
5985 RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes; |
|
5986 completeAttributes.iFlags = flags; |
|
5987 completeAttributes.iFormat = format; |
|
5988 completeAttributes.iType = type; |
|
5989 completeAttributes.iDcs = dcs; |
|
5990 TBuf8<KMaxName> completeName = _L8("Name2"); |
|
5991 TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
5992 mockData3(completeName, completeAttributes); |
|
5993 mockData3.SerialiseL(data2); |
|
5994 //------------------------------------------------------------------------- |
|
5995 data1.Append(TUssdClientTestData(_L("ussdtestclient_priority.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Priority |
|
5996 data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default |
|
5997 const TInt numClients = data1.Count(); |
|
5998 RProcess* proc = new RProcess[numClients]; |
|
5999 TRequestStatus* req = new TRequestStatus[numClients]; |
|
6000 |
|
6001 for (TInt i=0; i<numClients; ++i) |
|
6002 { |
|
6003 TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams); |
|
6004 // If a client isn't created properly, we need to clean up previously created ones here |
|
6005 if (err != KErrNone) |
|
6006 { |
|
6007 for (TInt c=0; c<i-1; ++c) |
|
6008 { |
|
6009 proc[c].Kill(KErrNone); |
|
6010 proc[c].Close(); |
|
6011 } |
|
6012 } |
|
6013 // Fail the test if any client has not been created properly |
|
6014 ASSERT_EQUALS(err, KErrNone); |
|
6015 } |
|
6016 // All processes created successfully, start their execution |
|
6017 for (TInt i = 0; i < numClients; i++) |
|
6018 { |
|
6019 proc[i].Logon(req[i]); |
|
6020 proc[i].Resume(); |
|
6021 // Pause here so that clients register in the order specified (i.e. As ordered in the array) |
|
6022 // Resolves timing issues in WDP/SMP. |
|
6023 User::After(500000); |
|
6024 } |
|
6025 //------------------------------------------------------------------------- |
|
6026 |
|
6027 iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data); |
|
6028 iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone); |
|
6029 |
|
6030 ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler); |
|
6031 User::WaitForRequest(requestStatus); |
|
6032 AssertMockLtsyStatusL(); |
|
6033 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
6034 //--------------------------------------------------------------------------- |
|
6035 |
|
6036 iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15); |
|
6037 User::After(5 * 1000000); |
|
6038 |
|
6039 for (TInt i = 0; i < numClients; i++) |
|
6040 { |
|
6041 TRequestStatus status = req[i]; |
|
6042 TExitType exit = proc[i].ExitType(); |
|
6043 TInt reason = proc[i].ExitReason(); |
|
6044 |
|
6045 // Kill/Close the clients before doing assert |
|
6046 proc[i].Kill(KErrNone); |
|
6047 proc[i].Close(); |
|
6048 |
|
6049 const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus; |
|
6050 const TBool checkExitType = exit == data1[i].iExitType; |
|
6051 TBool checkExitReason = ETrue; |
|
6052 if (data1[i].iExitType == EExitKill) |
|
6053 { |
|
6054 checkExitReason = reason == data1[i].iExitReason; |
|
6055 } |
|
6056 |
|
6057 if (!checkRequestStatus || !checkExitType || !checkExitReason) |
|
6058 { |
|
6059 // Some useful output in case of a failed test |
|
6060 INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i); |
|
6061 if (!checkRequestStatus) |
|
6062 INFO_PRINTF3(_L(" [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int()); |
|
6063 if (!checkExitType) |
|
6064 INFO_PRINTF3(_L(" [ExitType] Expected: %d , Actual: %d"),data1[i].iExitType,exit); |
|
6065 if (!checkExitReason) |
|
6066 INFO_PRINTF3(_L(" [ExitReason] Expected: %d , Actual: %d"),data1[i].iExitReason,reason); |
|
6067 for (TInt c=i+1; c<numClients; ++c) |
|
6068 { |
|
6069 proc[c].Kill(KErrNone); |
|
6070 proc[c].Close(); |
|
6071 } |
|
6072 ASSERT_TRUE(checkRequestStatus); |
|
6073 ASSERT_TRUE(checkExitType); |
|
6074 ASSERT_TRUE(checkExitReason); |
|
6075 } |
|
6076 } |
|
6077 //--------------------------------------------------------------------------- |
|
6078 data1.Close(); |
|
6079 CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging |
|
6080 } |
|
6081 |
|
6082 |
|
6083 /** |
|
6084 @SYMTestCaseID BA-CTSY-USSDM-USMDH-0004 |
|
6085 @SYMComponent telephony_ctsy |
|
6086 @SYMTestCaseDesc Test support in CTSY client requests to RMobileUssdMessaging::SendMessage with default, normal and priority clients |
|
6087 @SYMTestPriority High |
|
6088 @SYMTestActions Invokes request to RMobileUssdMessaging::SendMessage with EMobileUssdMessagingSendMessageDefaultHandler option |
|
6089 @SYMTestExpectedResults Pass |
|
6090 @SYMTestType CT |
|
6091 */ |
|
6092 void CCTsyUssdMessagingFU::TestSendMessageDefaultHandlerWithTestClient0004L() |
|
6093 { |
|
6094 |
|
6095 OpenEtelServerL(EUseExtendedError); |
|
6096 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
6097 OpenPhoneL(); |
|
6098 |
|
6099 RBuf8 data; |
|
6100 CleanupClosePushL(data); |
|
6101 |
|
6102 RArray<TUssdClientTestData> data1; |
|
6103 RMobileUssdMessaging ussdMessaging; |
|
6104 TInt ret = ussdMessaging.Open(iPhone); |
|
6105 ASSERT_EQUALS(KErrNone, ret); |
|
6106 CleanupClosePushL(ussdMessaging); |
|
6107 |
|
6108 TRequestStatus requestStatus; |
|
6109 |
|
6110 TUint32 flags = 100; |
|
6111 RMobileUssdMessaging::TMobileUssdDataFormat format = RMobileUssdMessaging::EFormatUnspecified; |
|
6112 RMobileUssdMessaging::TMobileUssdMessageType type = RMobileUssdMessaging::EUssdMORequest; |
|
6113 TUint8 dcs = 200; |
|
6114 |
|
6115 //------------------------------------------------------------------------- |
|
6116 // function parameters |
|
6117 |
|
6118 RMobileUssdMessaging::TMobileUssdAttributesV1 attributes; |
|
6119 TPckg<RMobileUssdMessaging::TMobileUssdAttributesV1> msgAttributes(attributes); |
|
6120 |
|
6121 attributes.iFlags = flags; |
|
6122 attributes.iFormat = format; |
|
6123 attributes.iType = type; |
|
6124 attributes.iDcs = dcs; |
|
6125 |
|
6126 TName name = _L("Name1"); |
|
6127 TPckg<TName> msgData(name); |
|
6128 |
|
6129 //------------------------------------------------------------------------- |
|
6130 |
|
6131 TMockLtsyData2<TName, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
6132 mockData2(name, attributes); |
|
6133 mockData2.SerialiseL(data); |
|
6134 //------------------------------------------------------------------------- |
|
6135 RBuf8 data2; |
|
6136 CleanupClosePushL(data2); |
|
6137 //------------------------------------------------------------------------- |
|
6138 RMobileUssdMessaging::TMobileUssdAttributesV1 completeAttributes; |
|
6139 completeAttributes.iFlags = flags; |
|
6140 completeAttributes.iFormat = format; |
|
6141 completeAttributes.iType = type; |
|
6142 completeAttributes.iDcs = dcs; |
|
6143 TBuf8<KMaxName> completeName = _L8("Name2"); |
|
6144 TMockLtsyData2<TBuf8<KMaxName>, RMobileUssdMessaging::TMobileUssdAttributesV1> |
|
6145 mockData3(completeName, completeAttributes); |
|
6146 mockData3.SerialiseL(data2); |
|
6147 //------------------------------------------------------------------------- |
|
6148 data1.Append(TUssdClientTestData(_L("ussdtestclient_priority.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Priority |
|
6149 data1.Append(TUssdClientTestData(_L("ussdtestclient_normal.exe"),_L("-R -M"), KRequestPending, EExitPending, KErrNone)); //Normal |
|
6150 data1.Append(TUssdClientTestData(_L("ussdtestclient_default.exe"), _L("-R -M"), KErrNone, EExitKill, KErrNone)); //Default |
|
6151 const TInt numClients = data1.Count(); |
|
6152 RProcess* proc = new RProcess[numClients]; |
|
6153 TRequestStatus* req = new TRequestStatus[numClients]; |
|
6154 |
|
6155 for (TInt i=0; i<numClients; ++i) |
|
6156 { |
|
6157 TInt err = proc[i].Create(data1[i].iExe, data1[i].iClientParams); |
|
6158 // If a client isn't created properly, we need to clean up previously created ones here |
|
6159 if (err != KErrNone) |
|
6160 { |
|
6161 for (TInt c=0; c<i-1; ++c) |
|
6162 { |
|
6163 proc[c].Kill(KErrNone); |
|
6164 proc[c].Close(); |
|
6165 } |
|
6166 } |
|
6167 // Fail the test if any client has not been created properly |
|
6168 ASSERT_EQUALS(err, KErrNone); |
|
6169 } |
|
6170 // All processes created successfully, start their execution |
|
6171 for (TInt i = 0; i < numClients; i++) |
|
6172 { |
|
6173 proc[i].Logon(req[i]); |
|
6174 proc[i].Resume(); |
|
6175 // Pause here so that clients register in the order specified (i.e. As ordered in the array) |
|
6176 // Resolves timing issues in WDP/SMP. |
|
6177 User::After(500000); |
|
6178 } |
|
6179 //------------------------------------------------------------------------- |
|
6180 |
|
6181 iMockLTSY.ExpectL(EMobileUssdMessagingSendMessageDefaultHandler, data); |
|
6182 iMockLTSY.CompleteL(EMobileUssdMessagingSendMessageDefaultHandler, KErrNone); |
|
6183 |
|
6184 ussdMessaging.SendMessage(requestStatus, msgData, msgAttributes, RMobileUssdMessaging::ETransferToDefaultHandler); |
|
6185 User::WaitForRequest(requestStatus); |
|
6186 AssertMockLtsyStatusL(); |
|
6187 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
6188 //--------------------------------------------------------------------------- |
|
6189 |
|
6190 iMockLTSY.CompleteL(EMobileUssdMessagingReceiveMessage, KErrNone, data2, 15); |
|
6191 User::After(5 * 1000000); |
|
6192 |
|
6193 for (TInt i = 0; i < numClients; i++) |
|
6194 { |
|
6195 TRequestStatus status = req[i]; |
|
6196 TExitType exit = proc[i].ExitType(); |
|
6197 TInt reason = proc[i].ExitReason(); |
|
6198 |
|
6199 // Kill/Close the clients before doing assert |
|
6200 proc[i].Kill(KErrNone); |
|
6201 proc[i].Close(); |
|
6202 |
|
6203 const TBool checkRequestStatus = status.Int() == data1[i].iReqStatus; |
|
6204 const TBool checkExitType = exit == data1[i].iExitType; |
|
6205 TBool checkExitReason = ETrue; |
|
6206 if (data1[i].iExitType == EExitKill) |
|
6207 { |
|
6208 checkExitReason = reason == data1[i].iExitReason; |
|
6209 } |
|
6210 |
|
6211 if (!checkRequestStatus || !checkExitType || !checkExitReason) |
|
6212 { |
|
6213 // Some useful output in case of a failed test |
|
6214 INFO_PRINTF2(_L("Client[%d] returned unexpected results:"),i); |
|
6215 if (!checkRequestStatus) |
|
6216 INFO_PRINTF3(_L(" [RequestStatus] Expected: %d , Actual: %d"),data1[i].iReqStatus,status.Int()); |
|
6217 if (!checkExitType) |
|
6218 INFO_PRINTF3(_L(" [ExitType] Expected: %d , Actual: %d"),data1[i].iExitType,exit); |
|
6219 if (!checkExitReason) |
|
6220 INFO_PRINTF3(_L(" [ExitReason] Expected: %d , Actual: %d"),data1[i].iExitReason,reason); |
|
6221 for (TInt c=i+1; c<numClients; ++c) |
|
6222 { |
|
6223 proc[c].Kill(KErrNone); |
|
6224 proc[c].Close(); |
|
6225 } |
|
6226 ASSERT_TRUE(checkRequestStatus); |
|
6227 ASSERT_TRUE(checkExitType); |
|
6228 ASSERT_TRUE(checkExitReason); |
|
6229 } |
|
6230 } |
|
6231 //--------------------------------------------------------------------------- |
|
6232 data1.Close(); |
|
6233 CleanupStack::PopAndDestroy(4, this); // data, data2, this, ussdMessaging |
|
6234 } |
|
6235 |