• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 package com.android.documentsui;
17 
18 import android.content.Intent;
19 import android.net.Uri;
20 import android.provider.DocumentsContract;
21 import android.support.test.filters.LargeTest;
22 
23 import com.android.documentsui.bots.UiBot;
24 import com.android.documentsui.inspector.InspectorActivity;
25 
26 @LargeTest
27 public class InspectorUiTest extends ActivityTest<InspectorActivity> {
28 
29     private static final String TEST_DOC_NAME = "test.txt";
30 
InspectorUiTest()31     public InspectorUiTest() {
32         super(InspectorActivity.class);
33     }
34 
35     @Override
setUp()36     public void setUp() throws Exception {
37         super.setUp();
38     }
39 
40     @Override
launchActivity()41     public void launchActivity() {
42         if (!features.isInspectorEnabled()) {
43             return;
44         }
45         final Intent intent = context.getPackageManager().getLaunchIntentForPackage(
46                 UiBot.TARGET_PKG);
47         intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
48         Uri uri = DocumentsContract.buildDocumentUri(InspectorProvider.AUTHORITY, TEST_DOC_NAME);
49         intent.setData(uri);
50         setActivityIntent(intent);
51         getActivity();
52     }
53 
testDisplayFileName()54     public void testDisplayFileName() throws Exception {
55         if (!features.isInspectorEnabled()) {
56             return;
57         }
58         bots.inspector.assertTitle("test.txt");
59     }
60 
testFolderDetails()61     public void testFolderDetails() throws Exception {
62         if (!features.isInspectorEnabled()) {
63             return;
64         }
65         bots.inspector.assertRowEquals(
66                 getActivity().getString(R.string.sort_dimension_file_type),
67                 "Folder",
68                 getActivity());
69         bots.inspector.assertRowEquals(
70                 getActivity().getString(R.string.directory_items),
71                 "4",
72                 getActivity());
73     }
74 }
75