1 package com.android.documentsui;
2 
3 import android.content.Intent;
4 import android.net.Uri;
5 
6 import androidx.test.filters.SmallTest;
7 import androidx.test.runner.AndroidJUnit4;
8 
9 import com.android.documentsui.base.Providers;
10 import com.android.documentsui.base.State;
11 
12 import org.junit.Test;
13 import org.junit.runner.RunWith;
14 
15 /**
16  * Tests for the specialized behaviors provided by Metrics.
17  */
18 @RunWith(AndroidJUnit4.class)
19 @SmallTest
20 public class MetricsTest {
21     @Test
logActivityLaunch_storageAuthority_shouldNotCrash()22     public void logActivityLaunch_storageAuthority_shouldNotCrash() {
23         final Intent intent = new Intent(null, Uri.parse(
24                 "content://" + Providers.AUTHORITY_STORAGE + "/document/primary:"));
25         final State state = new State();
26         state.action = State.ACTION_BROWSE;
27         Metrics.logActivityLaunch(state, intent);
28     }
29 
30     @Test
logActivityLaunch_mediaAuthority_shouldNotCrash()31     public void logActivityLaunch_mediaAuthority_shouldNotCrash() {
32         final Intent intent = new Intent(null, Uri.parse(
33                 "content://" + Providers.AUTHORITY_MEDIA + "/document/primary:"));
34         final State state = new State();
35         state.action = State.ACTION_BROWSE;
36         Metrics.logActivityLaunch(state, intent);
37     }
38 
39     @Test
logDragInitiated_shouldNotCrash()40     public void logDragInitiated_shouldNotCrash() {
41         Metrics.logDragInitiated(true);
42     }
43 }
44