예제 #1
0
        public void Test_ContentResolver(string strContentHeader, string strExpectServiceRequest, string strRootKid, string strLeafKid)
        {
            TestLogger.LogMessage("Enter Test_ContentResolver()");

            TestLogger.LogMessage("Root Kid = " + strRootKid);
            TestLogger.LogMessage("Leaf Kid = " + strLeafKid);

            bool bTestActionResult     = false;
            bool bExpectServiceRequest = ActionParamConvertToBool(strExpectServiceRequest);

            TestLogger.LogMessage(strContentHeader);
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(new System.Text.UnicodeEncoding().GetBytes(strContentHeader));

            LicenseAcquisition.DumpContentHeaderValues(contentHeader);

            TestLogger.LogMessage("Using PlayReadyContentResolver...");
            IPlayReadyServiceRequest serviceRequest = PlayReadyContentResolver.ServiceRequest(contentHeader);

            if (serviceRequest == null && !bExpectServiceRequest)
            {
                TestLogger.LogMessage("ServiceRequest not needed!!!");
                bTestActionResult = true;
            }
            else
            {
                TestLogger.LogMessage("Inspecting servicing request...");
                PlayReadyLicenseAcquisitionServiceRequest licenseServiceRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;

                if (licenseServiceRequest == null)
                {
                    TestLogger.LogMessage("!!!!!!!!!!!!!!! servicing request is null !!!!!!!!!!");
                }
                else
                {
                    TestLogger.LogMessage("licenseServiceRequest.ContentHeader.KeyId = " + licenseServiceRequest.ContentHeader.KeyId.ToString());
                    if (licenseServiceRequest.ContentHeader.KeyId == new Guid(strRootKid))
                    {
                        TestLogger.LogMessage("KeyId is equal to expired Root KeyId, as expected");
                        bTestActionResult = true;
                    }
                }
            }

            TestActionFinished(bTestActionResult, null);
            TestLogger.LogMessage("Leave Test_ContentResolver()");
        }
예제 #2
0
        public void Test_CocktailContentResolver(string strContentHeader, string strLAURL, string strExpectServiceRequest)
        {
            TestLogger.LogMessage("Enter Test_CocktailContentResolver()");

            bool bExpectServiceRequest = ActionParamConvertToBool(strExpectServiceRequest);
            Uri  uri = ActionParamConvertToUri(strLAURL);

            TestLogger.LogMessage(strContentHeader);
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                new System.Text.UnicodeEncoding().GetBytes(strContentHeader),
                uri,
                uri,
                String.Empty,
                Guid.Empty
                );

            LicenseAcquisition.DumpContentHeaderValues(contentHeader);

            TestLogger.LogMessage("Using PlayReadyContentResolver...");
            IPlayReadyServiceRequest serviceRequest = PlayReadyContentResolver.ServiceRequest(contentHeader);

            if (serviceRequest == null && !bExpectServiceRequest)
            {
                TestLogger.LogMessage("ServiceRequest not needed!!!");
                TestActionFinished(true, null);
            }
            else
            {
                TestLogger.LogMessage("Servicing request...");
                PlayReadyLicenseAcquisitionServiceRequest licenseServiceRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;

                LAAndReportResult licenseAcquisition = new LAAndReportResult(new ReportResultDelegate(TestActionFinished), null);
                licenseAcquisition.AcquireLicenseReactively(serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
            }

            TestLogger.LogMessage("Leave Test_CocktailContentResolver()");
        }