felkachang | ec40c5c | 2018-05-14 18:01:11 +0800 | [diff] [blame] | 1 | package com.android.documentsui; |
| 2 | |
felkachang | ec40c5c | 2018-05-14 18:01:11 +0800 | [diff] [blame] | 3 | import android.content.Intent; |
| 4 | import android.net.Uri; |
Brett Chabot | 2027ca0 | 2018-12-13 19:06:31 -0800 | [diff] [blame] | 5 | |
| 6 | import androidx.test.InstrumentationRegistry; |
| 7 | import androidx.test.filters.SmallTest; |
| 8 | import androidx.test.runner.AndroidJUnit4; |
felkachang | ec40c5c | 2018-05-14 18:01:11 +0800 | [diff] [blame] | 9 | |
| 10 | import com.android.documentsui.base.Providers; |
| 11 | import com.android.documentsui.base.State; |
| 12 | |
| 13 | import org.junit.Test; |
| 14 | import org.junit.runner.RunWith; |
| 15 | |
| 16 | /** |
| 17 | * Tests for the specialized behaviors provided by Metrics. |
| 18 | */ |
| 19 | @RunWith(AndroidJUnit4.class) |
| 20 | @SmallTest |
| 21 | public class MetricsTest { |
| 22 | @Test |
| 23 | public void logActivityLaunch_storageAuthority_shouldNotCrash() { |
| 24 | final Intent intent = new Intent(null, Uri.parse( |
| 25 | "content://" + Providers.AUTHORITY_STORAGE + "/document/primary:")); |
| 26 | final State state = new State(); |
| 27 | state.action = State.ACTION_BROWSE; |
shawnlin | 9cee68f | 2019-01-25 11:20:18 +0800 | [diff] [blame] | 28 | Metrics.logActivityLaunch(state, intent); |
felkachang | ec40c5c | 2018-05-14 18:01:11 +0800 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | @Test |
| 32 | public void logActivityLaunch_mediaAuthority_shouldNotCrash() { |
| 33 | final Intent intent = new Intent(null, Uri.parse( |
| 34 | "content://" + Providers.AUTHORITY_MEDIA + "/document/primary:")); |
| 35 | final State state = new State(); |
| 36 | state.action = State.ACTION_BROWSE; |
shawnlin | 9cee68f | 2019-01-25 11:20:18 +0800 | [diff] [blame] | 37 | Metrics.logActivityLaunch(state, intent); |
felkachang | ec40c5c | 2018-05-14 18:01:11 +0800 | [diff] [blame] | 38 | } |
| 39 | } |