FileDocCategorySizeDatePackage
PmPermissionsTests.javaAPI DocAndroid 5.1 API4660Thu Mar 12 22:22:44 GMT 2015com.android.framework.permission.tests

PmPermissionsTests

public class PmPermissionsTests extends android.test.AndroidTestCase
Verify PackageManager api's that require specific permissions.

Fields Summary
private android.content.pm.PackageManager
mPm
private String
mPkgName
Constructors Summary
Methods Summary
protected voidsetUp()


    
         
        super.setUp();
        mPm = getContext().getPackageManager();
    
public voidtestClearApplicationUserData()

        try {
            mPm.clearApplicationUserData(mPkgName, null);
            fail("PackageManager.clearApplicationUserData" +
                    "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestDeleteApplicationCacheFiles()

        try {
            mPm.deleteApplicationCacheFiles(mPkgName, null);
            fail("PackageManager.deleteApplicationCacheFiles" +
                    "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestDeletePackage()

        try {
            mPm.deletePackage(mPkgName, null, 0);
            fail("PackageManager.deletePackage" +
                   "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestFreeStorage1()

        try {
            mPm.freeStorage(100000, null);
            fail("PackageManager.freeStorage " +
                   "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestFreeStorage2()

        try {
            mPm.freeStorageAndNotify(100000, null);
            fail("PackageManager.freeStorageAndNotify" +
                    " did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestGetPackageSize()

        try {
            mPm.getPackageSizeInfo(mPkgName, null);
            fail("PackageManager.getPackageSizeInfo" +
                    "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }
    
public voidtestInstallPackage()

        TestInstallObserver observer = new TestInstallObserver();
        try {
            mPm.installPackage(null, observer, 0, null);
            fail("PackageManager.installPackage" +
                    "did not throw SecurityException as expected");
        } catch (SecurityException e) {
            // expected
        }