Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 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; |
Brett Chabot | 2027ca0 | 2018-12-13 19:06:31 -0800 | [diff] [blame] | 21 | |
| 22 | import androidx.test.filters.LargeTest; |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 23 | |
Tony Huang | 8430f5d | 2019-10-30 14:50:41 +0800 | [diff] [blame] | 24 | import com.android.documentsui.files.FilesActivity; |
Steve McKay | f433d20 | 2017-07-12 18:46:09 -0700 | [diff] [blame] | 25 | import com.android.documentsui.inspector.InspectorActivity; |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 26 | |
Steve McKay | efd10ac | 2017-07-25 13:33:57 -0700 | [diff] [blame] | 27 | @LargeTest |
Steve McKay | f433d20 | 2017-07-12 18:46:09 -0700 | [diff] [blame] | 28 | public class InspectorUiTest extends ActivityTest<InspectorActivity> { |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 29 | |
| 30 | private static final String TEST_DOC_NAME = "test.txt"; |
| 31 | |
| 32 | public InspectorUiTest() { |
Steve McKay | f433d20 | 2017-07-12 18:46:09 -0700 | [diff] [blame] | 33 | super(InspectorActivity.class); |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 34 | } |
| 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 Huang | 8430f5d | 2019-10-30 14:50:41 +0800 | [diff] [blame] | 46 | final Intent intent = new Intent(context, FilesActivity.class); |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 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 | |
| 54 | public void testDisplayFileName() throws Exception { |
| 55 | if (!features.isInspectorEnabled()) { |
| 56 | return; |
| 57 | } |
| 58 | bots.inspector.assertTitle("test.txt"); |
| 59 | } |
| 60 | |
Steve McKay | 9937346 | 2017-08-04 15:17:08 -0700 | [diff] [blame] | 61 | public void testFolderDetails() throws Exception { |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 62 | if (!features.isInspectorEnabled()) { |
| 63 | return; |
| 64 | } |
Steve McKay | 9937346 | 2017-08-04 15:17:08 -0700 | [diff] [blame] | 65 | bots.inspector.assertRowEquals( |
Steve McKay | efd10ac | 2017-07-25 13:33:57 -0700 | [diff] [blame] | 66 | getActivity().getString(R.string.sort_dimension_file_type), |
| 67 | "Folder", |
| 68 | getActivity()); |
Steve McKay | 9937346 | 2017-08-04 15:17:08 -0700 | [diff] [blame] | 69 | bots.inspector.assertRowEquals( |
| 70 | getActivity().getString(R.string.directory_items), |
Jackal Guo | 8e01a45 | 2018-06-21 18:19:17 +0800 | [diff] [blame] | 71 | InspectorProvider.NUMBER_OF_ITEMS, |
Steve McKay | 9937346 | 2017-08-04 15:17:08 -0700 | [diff] [blame] | 72 | getActivity()); |
Julian Mancini | db28d84 | 2017-06-19 10:14:57 -0700 | [diff] [blame] | 73 | } |
| 74 | } |