• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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 com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
20 
21 /**
22  * Set of tests that verify behavior of
23  * {@link android.provider.DocumentsContract} and related intents.
24  */
25 public class DocumentsTest extends DocumentsTestCase {
26     private static final String PROVIDER_PKG = "com.android.cts.documentprovider";
27     private static final String PROVIDER_APK = "CtsDocumentProvider.apk";
28     private static final String DUMMYIME_APK = "CtsDummyIme.apk";
29 
30     @Override
setUp()31     protected void setUp() throws Exception {
32         super.setUp();
33 
34         getDevice().uninstallPackage(PROVIDER_PKG);
35         CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mCtsBuild);
36         assertNull(getDevice().installPackage(buildHelper.getTestFile(PROVIDER_APK), false));
37         assertNull(getDevice().installPackage(buildHelper.getTestFile(DUMMYIME_APK), false));
38     }
39 
40     @Override
tearDown()41     protected void tearDown() throws Exception {
42         super.tearDown();
43 
44         getDevice().uninstallPackage(PROVIDER_PKG);
45         getDevice().uninstallPackage(DUMMYIME_APK);
46     }
47 
testOpenSimple()48     public void testOpenSimple() throws Exception {
49         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testOpenSimple");
50     }
51 
testOpenVirtual()52     public void testOpenVirtual() throws Exception {
53         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testOpenVirtual");
54     }
55 
testCreateNew()56     public void testCreateNew() throws Exception {
57         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testCreateNew");
58     }
59 
testCreateExisting()60     public void testCreateExisting() throws Exception {
61         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testCreateExisting");
62     }
63 
testTree()64     public void testTree() throws Exception {
65         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testTree");
66     }
67 
testGetContent_rootsShowing()68     public void testGetContent_rootsShowing() throws Exception {
69         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testGetContent_rootsShowing");
70     }
71 
testGetContentWithQuery_matchingFileShowing()72     public void testGetContentWithQuery_matchingFileShowing() throws Exception {
73         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest",
74                 "testGetContentWithQuery_matchingFileShowing");
75     }
76 
testGetContent_returnsResultToCallingActivity()77     public void testGetContent_returnsResultToCallingActivity() throws Exception {
78         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest",
79                 "testGetContent_returnsResultToCallingActivity");
80     }
81 
testTransferDocument()82     public void testTransferDocument() throws Exception {
83         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testTransferDocument");
84     }
85 
testFindDocumentPathInScopedAccess()86     public void testFindDocumentPathInScopedAccess() throws Exception {
87         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testFindDocumentPathInScopedAccess");
88     }
89 
testOpenDocumentAtInitialLocation()90     public void testOpenDocumentAtInitialLocation() throws Exception {
91         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testOpenDocumentAtInitialLocation");
92     }
93 
testOpenDocumentTreeAtInitialLocation()94     public void testOpenDocumentTreeAtInitialLocation() throws Exception {
95         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testOpenDocumentTreeAtInitialLocation");
96     }
97 
testOpenRootWithoutRootIdAtInitialLocation()98     public void testOpenRootWithoutRootIdAtInitialLocation() throws Exception {
99         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest",
100                 "testOpenRootWithoutRootIdAtInitialLocation");
101     }
102 
testCreateDocumentAtInitialLocation()103     public void testCreateDocumentAtInitialLocation() throws Exception {
104         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testCreateDocumentAtInitialLocation");
105     }
106 
testCreateWebLink()107     public void testCreateWebLink() throws Exception {
108         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testCreateWebLink");
109     }
110 
testEject()111     public void testEject() throws Exception {
112         runDeviceTests(CLIENT_PKG, ".DocumentsClientTest", "testEject");
113     }
114 }
115