• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 com.android.documentsui;
18 
19 import static com.android.documentsui.StubProvider.ROOT_0_ID;
20 import static com.android.documentsui.StubProvider.ROOT_1_ID;
21 
22 import android.os.RemoteException;
23 
24 import androidx.recyclerview.R;
25 import androidx.test.filters.LargeTest;
26 
27 import com.android.documentsui.base.RootInfo;
28 import com.android.documentsui.files.FilesActivity;
29 import com.android.documentsui.filters.HugeLongTest;
30 
31 @LargeTest
32 public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> {
33 
FilesActivityDefaultsUiTest()34     public FilesActivityDefaultsUiTest() {
35         super(FilesActivity.class);
36     }
37 
38     @Override
initTestFiles()39     protected void initTestFiles() throws RemoteException {
40         // Overriding to init with no items in test roots
41     }
42 
43     @Override
getInitialRoot()44     protected RootInfo getInitialRoot() {
45         return null;  // test the default, unaffected state of the app.
46     }
47 
48     @HugeLongTest
testNavigate_FromEmptyDirectory()49     public void testNavigate_FromEmptyDirectory() throws Exception {
50         device.waitForIdle();
51 
52         bots.roots.openRoot(rootDir0.title);
53 
54         String msg = String.valueOf(context.getString(R.string.empty));
55         bots.directory.assertPlaceholderMessageText(msg);
56 
57         // Check to make sure back button is properly handled by non-Doc type DocHolders
58         device.pressBack();
59     }
60 
61     @HugeLongTest
testDefaultRoots()62     public void testDefaultRoots() throws Exception {
63         device.waitForIdle();
64 
65         // Should also have Drive, but that requires pre-configuration of devices
66         // We omit for now.
67         bots.roots.assertRootsPresent(
68                 "Images",
69                 "Videos",
70                 "Audio",
71                 "Downloads",
72                 ROOT_0_ID,
73                 ROOT_1_ID);
74     }
75 }
76