1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.appsecurity.cts; 18 19 import android.platform.test.annotations.AppModeFull; 20 21 /** 22 * Set of tests that verify behavior of the Scoped Directory access API. 23 */ 24 @AppModeFull // TODO: Needs porting to instant 25 public class ScopedDirectoryAccessTest extends DocumentsTestCase { 26 27 public void testInvalidPath() throws Exception { 28 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testInvalidPath"); 29 } 30 31 public void testUserRejects() throws Exception { 32 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testUserRejects"); 33 } 34 35 public void testUserAccepts() throws Exception { 36 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testUserAccepts"); 37 } 38 39 public void testUserAcceptsNewDirectory() throws Exception { 40 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", 41 "testUserAcceptsNewDirectory"); 42 } 43 44 public void testNotAskedAgain() throws Exception { 45 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testNotAskedAgain"); 46 } 47 48 public void testDeniesOnceForAllClearedWhenPackageRemoved() throws Exception { 49 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", 50 "testRemovePackageStep1UserDenies"); 51 reinstallClientPackage(); 52 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", 53 "testRemovePackageStep2UserAcceptsDoNotClear"); 54 } 55 56 public void testDeniesOnceButAllowsAskingAgain() throws Exception { 57 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", 58 "testDeniesOnceButAllowsAskingAgain"); 59 } 60 61 public void testDeniesOnceForAll() throws Exception { 62 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testDeniesOnceForAll"); 63 } 64 65 public void testResetDoNotAskAgain() throws Exception { 66 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testResetDoNotAskAgain"); 67 } 68 69 public void testResetGranted() throws Exception { 70 runDeviceTests(CLIENT_PKG, ".ScopedDirectoryAccessClientTest", "testResetGranted"); 71 } 72 } 73