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