1577 |
1621 |
1578 __UHEAP_MARKEND; |
1622 __UHEAP_MARKEND; |
1579 return TestStepResult(); |
1623 return TestStepResult(); |
1580 } |
1624 } |
1581 |
1625 |
|
1626 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |
|
1627 |
|
1628 // The following methods test the various manager attribute APIs for WMDRM content. |
|
1629 |
|
1630 TVerdict CCAFManagerAttributeStep::doWmdrmTestStepL() |
|
1631 { |
|
1632 SetTestStepResult(EFail); |
|
1633 |
|
1634 TInt attribVal; |
|
1635 GetIntFromConfig(ConfigSection(),_L("attribute"), attribVal); |
|
1636 |
|
1637 TInt expectedValue; |
|
1638 GetIntFromConfig(ConfigSection(),_L("value"), expectedValue); |
|
1639 |
|
1640 __UHEAP_MARK; |
|
1641 |
|
1642 TPtrC header; |
|
1643 HBufC8* headerData = NULL; |
|
1644 |
|
1645 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1646 { |
|
1647 headerData = ConvertDes16toHBufC8LC(header); |
|
1648 } |
|
1649 else |
|
1650 { |
|
1651 headerData = CreateWmdrmHeaderLC(); |
|
1652 } |
|
1653 |
|
1654 TInt value; |
|
1655 CManager *manager = CManager::NewLC(); |
|
1656 |
|
1657 User::LeaveIfError(manager->GetAttribute(*headerData, attribVal, value)); |
|
1658 if(expectedValue == value) |
|
1659 { |
|
1660 SetTestStepResult(EPass); |
|
1661 } |
|
1662 else |
|
1663 { |
|
1664 INFO_PRINTF3(_L("CManager::GetAttribute() Expected value: %d, actual value: %d"), expectedValue, value); |
|
1665 } |
|
1666 |
|
1667 CleanupStack::PopAndDestroy(2, headerData); |
|
1668 |
|
1669 __UHEAP_MARKEND; |
|
1670 return TestStepResult(); |
|
1671 } |
|
1672 |
|
1673 |
|
1674 TVerdict CCAFManagerAttributeSetStep::doWmdrmTestStepL() |
|
1675 { |
|
1676 SetTestStepResult(EFail); |
|
1677 |
|
1678 TInt attribute1; |
|
1679 GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1); |
|
1680 |
|
1681 TInt attribute2; |
|
1682 GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2); |
|
1683 |
|
1684 TInt expectedValue1; |
|
1685 GetIntFromConfig(ConfigSection(),_L("value1"),expectedValue1); |
|
1686 |
|
1687 TInt expectedValue2; |
|
1688 GetIntFromConfig(ConfigSection(),_L("value2"),expectedValue2); |
|
1689 |
|
1690 __UHEAP_MARK; |
|
1691 |
|
1692 TPtrC header; |
|
1693 HBufC8* headerData = NULL; |
|
1694 |
|
1695 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1696 { |
|
1697 headerData = ConvertDes16toHBufC8LC(header); |
|
1698 } |
|
1699 else |
|
1700 { |
|
1701 headerData = CreateWmdrmHeaderLC(); |
|
1702 } |
|
1703 |
|
1704 RAttributeSet attributeSet; |
|
1705 CleanupClosePushL(attributeSet); |
|
1706 attributeSet.AddL(attribute1); |
|
1707 attributeSet.AddL(attribute2); |
|
1708 |
|
1709 CManager *manager = CManager::NewLC(); |
|
1710 TInt result = manager->GetAttributeSet(*headerData, attributeSet); |
|
1711 if(result == KErrNone) |
|
1712 { |
|
1713 SetTestStepResult(EPass); |
|
1714 } |
|
1715 else |
|
1716 { |
|
1717 INFO_PRINTF1(_L("CManager::GetAttributeSet() failed")); |
|
1718 } |
|
1719 |
|
1720 TInt value1; |
|
1721 User::LeaveIfError(attributeSet.GetValue(attribute1, value1)); |
|
1722 |
|
1723 TInt value2; |
|
1724 User::LeaveIfError(attributeSet.GetValue(attribute2, value2)); |
|
1725 |
|
1726 if(expectedValue1 == value1 && expectedValue2 == value2 && attributeSet.Count() == 2) |
|
1727 { |
|
1728 SetTestStepResult(EPass); |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 INFO_PRINTF1(_L("CManager::GetAttributeSet() values don't match expected values")); |
|
1733 } |
|
1734 |
|
1735 CleanupStack::PopAndDestroy(3, headerData); |
|
1736 |
|
1737 __UHEAP_MARKEND; |
|
1738 |
|
1739 return TestStepResult(); |
|
1740 } |
|
1741 |
|
1742 |
|
1743 TVerdict CCAFManagerStringAttributeStep::doWmdrmTestStepL() |
|
1744 { |
|
1745 SetTestStepResult(EFail); |
|
1746 |
|
1747 TInt attribVal; |
|
1748 GetIntFromConfig(ConfigSection(),_L("attribute"),attribVal); |
|
1749 |
|
1750 TPtrC expectedValue; |
|
1751 GetStringFromConfig(ConfigSection(),_L("value"),expectedValue); |
|
1752 |
|
1753 TInt expectedResult; |
|
1754 GetIntFromConfig(ConfigSection(),_L("result"),expectedResult); |
|
1755 |
|
1756 __UHEAP_MARK; |
|
1757 |
|
1758 TPtrC header; |
|
1759 HBufC8* headerData = NULL; |
|
1760 |
|
1761 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1762 { |
|
1763 headerData = ConvertDes16toHBufC8LC(header); |
|
1764 } |
|
1765 else |
|
1766 { |
|
1767 headerData = CreateWmdrmHeaderLC(); |
|
1768 } |
|
1769 |
|
1770 CManager* manager = CManager::NewLC(); |
|
1771 TBuf <200> value; |
|
1772 TInt result = manager->GetStringAttribute(*headerData, attribVal, value); |
|
1773 if(result == expectedResult && value == expectedValue) |
|
1774 { |
|
1775 SetTestStepResult(EPass); |
|
1776 } |
|
1777 else |
|
1778 { |
|
1779 INFO_PRINTF3(_L("CManager::GetStringAttribute() Expected result: %d, actual result: %d"), expectedResult, result); |
|
1780 INFO_PRINTF3(_L("CManager::GetStringAttribute() Expected value: %S, actual value: %S"), &expectedValue, &value); |
|
1781 } |
|
1782 |
|
1783 CleanupStack::PopAndDestroy(2, headerData); |
|
1784 |
|
1785 __UHEAP_MARKEND; |
|
1786 |
|
1787 return TestStepResult(); |
|
1788 } |
|
1789 |
|
1790 |
|
1791 TVerdict CCAFManagerStringAttributeSetStep::doWmdrmTestStepL() |
|
1792 { |
|
1793 SetTestStepResult(EFail); |
|
1794 |
|
1795 TInt attribute1; |
|
1796 GetIntFromConfig(ConfigSection(),_L("attribute1"),attribute1); |
|
1797 |
|
1798 TInt attribute2; |
|
1799 GetIntFromConfig(ConfigSection(),_L("attribute2"),attribute2); |
|
1800 |
|
1801 TPtrC expectedValue1; |
|
1802 GetStringFromConfig(ConfigSection(),_L("value1"),expectedValue1); |
|
1803 |
|
1804 TPtrC expectedValue2; |
|
1805 GetStringFromConfig(ConfigSection(),_L("value2"),expectedValue2); |
|
1806 |
|
1807 __UHEAP_MARK; |
|
1808 |
|
1809 TPtrC header; |
|
1810 HBufC8* headerData = NULL; |
|
1811 |
|
1812 if(GetStringFromConfig(ConfigSection(),_L("header"), header)) |
|
1813 { |
|
1814 headerData = ConvertDes16toHBufC8LC(header); |
|
1815 } |
|
1816 else |
|
1817 { |
|
1818 headerData = CreateWmdrmHeaderLC(); |
|
1819 } |
|
1820 |
|
1821 RStringAttributeSet attributeSet; |
|
1822 CleanupClosePushL(attributeSet); |
|
1823 attributeSet.AddL(attribute1); |
|
1824 attributeSet.AddL(attribute2); |
|
1825 |
|
1826 CManager* manager = CManager::NewLC(); |
|
1827 TInt result = manager->GetStringAttributeSet(*headerData, attributeSet); |
|
1828 TBuf <200> value1; |
|
1829 TBuf <200> value2; |
|
1830 if(result == KErrNone) |
|
1831 { |
|
1832 TInt result3 = attributeSet.GetValue(attribute1, value1); |
|
1833 TInt result4 = attributeSet.GetValue(attribute2, value2); |
|
1834 |
|
1835 if(value1 == expectedValue1 && value2 == expectedValue2 && attributeSet.Count() == 2 |
|
1836 && result3 == KErrNone && result4 == KErrNone) |
|
1837 { |
|
1838 SetTestStepResult(EPass); |
|
1839 } |
|
1840 else |
|
1841 { |
|
1842 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1.Expected value: %S, actual value: %S"), &expectedValue1, &value1); |
|
1843 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2.Expected value: %S, actual value: %S"), &expectedValue2, &value2); |
|
1844 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute1. Expected result: %d, actual result: %d"), 0, result3); |
|
1845 INFO_PRINTF3(_L("RStringAttributeSet::GetValue() for attribute2. Expected result: %d, actual result: %d"), 0, result4); |
|
1846 } |
|
1847 } |
|
1848 else |
|
1849 { |
|
1850 INFO_PRINTF1(_L("CManager::GetStringAttributeSet() failed")); |
|
1851 } |
|
1852 |
|
1853 CleanupStack::PopAndDestroy(3, headerData); |
|
1854 |
|
1855 __UHEAP_MARKEND; |
|
1856 |
|
1857 return TestStepResult(); |
|
1858 } |
|
1859 |
|
1860 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT |