blob: de52250aa7a747dc9d8dd5b41b79201b004f917c [file] [log] [blame]
Julian Mancinidb28d842017-06-19 10:14:57 -07001/*
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 */
16package com.android.documentsui;
17
18import android.content.Intent;
19import android.net.Uri;
20import android.provider.DocumentsContract;
Brett Chabot2027ca02018-12-13 19:06:31 -080021
22import androidx.test.filters.LargeTest;
Julian Mancinidb28d842017-06-19 10:14:57 -070023
Tony Huang8430f5d2019-10-30 14:50:41 +080024import com.android.documentsui.files.FilesActivity;
Steve McKayf433d202017-07-12 18:46:09 -070025import com.android.documentsui.inspector.InspectorActivity;
Julian Mancinidb28d842017-06-19 10:14:57 -070026
Steve McKayefd10ac2017-07-25 13:33:57 -070027@LargeTest
Steve McKayf433d202017-07-12 18:46:09 -070028public class InspectorUiTest extends ActivityTest<InspectorActivity> {
Julian Mancinidb28d842017-06-19 10:14:57 -070029
30 private static final String TEST_DOC_NAME = "test.txt";
31
32 public InspectorUiTest() {
Steve McKayf433d202017-07-12 18:46:09 -070033 super(InspectorActivity.class);
Julian Mancinidb28d842017-06-19 10:14:57 -070034 }
35
36 @Override
37 public void setUp() throws Exception {
38 super.setUp();
39 }
40
41 @Override
42 public void launchActivity() {
43 if (!features.isInspectorEnabled()) {
44 return;
45 }
Tony Huang8430f5d2019-10-30 14:50:41 +080046 final Intent intent = new Intent(context, FilesActivity.class);
Julian Mancinidb28d842017-06-19 10:14:57 -070047 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
54 public void testDisplayFileName() throws Exception {
55 if (!features.isInspectorEnabled()) {
56 return;
57 }
58 bots.inspector.assertTitle("test.txt");
59 }
60
Steve McKay99373462017-08-04 15:17:08 -070061 public void testFolderDetails() throws Exception {
Julian Mancinidb28d842017-06-19 10:14:57 -070062 if (!features.isInspectorEnabled()) {
63 return;
64 }
Steve McKay99373462017-08-04 15:17:08 -070065 bots.inspector.assertRowEquals(
Steve McKayefd10ac2017-07-25 13:33:57 -070066 getActivity().getString(R.string.sort_dimension_file_type),
67 "Folder",
68 getActivity());
Steve McKay99373462017-08-04 15:17:08 -070069 bots.inspector.assertRowEquals(
70 getActivity().getString(R.string.directory_items),
Jackal Guo8e01a452018-06-21 18:19:17 +080071 InspectorProvider.NUMBER_OF_ITEMS,
Steve McKay99373462017-08-04 15:17:08 -070072 getActivity());
Julian Mancinidb28d842017-06-19 10:14:57 -070073 }
74}