am f9fb333: AI 148276: CTS: Remove internal API dependency from MediaSto
Merge commit 'f9fb33343ea97aaa019443f2f8eb2d7c5da10e10' into donut
* commit 'f9fb33343ea97aaa019443f2f8eb2d7c5da10e10':
AI 148276: CTS: Remove internal API dependency from MediaStore tests
diff --git a/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java b/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java
index 6b3fbb1..905c069 100644
--- a/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java
+++ b/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java
@@ -210,7 +210,7 @@
}
}
+ // These constants are not part of the public API
public static final String EXTERNAL_VOLUME_NAME = "external";
-
public static final String INTERNAL_VOLUME_NAME = "internal";
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_AlbumsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_AlbumsTest.java
index 572f9af..98792e7 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_AlbumsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_AlbumsTest.java
@@ -25,8 +25,6 @@
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Albums;
import android.provider.cts.MediaStoreAudioTestHelper.Audio1;
import android.provider.cts.MediaStoreAudioTestHelper.Audio2;
@@ -40,16 +38,11 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@TestTargetNew(
- level = TestLevel.COMPLETE,
+ level = TestLevel.SUFFICIENT,
method = "getContentUri",
args = {String.class}
)
@@ -64,8 +57,7 @@
null, null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Albums.getContentUri(volume), null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_ArtistsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_ArtistsTest.java
index 21a8b87..917aa3d 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_ArtistsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_ArtistsTest.java
@@ -25,8 +25,6 @@
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Artists;
import android.provider.cts.MediaStoreAudioTestHelper.Audio1;
import android.provider.cts.MediaStoreAudioTestHelper.Audio2;
@@ -40,11 +38,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -64,8 +57,7 @@
null, null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Artists.getContentUri(volume), null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Artists_AlbumsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Artists_AlbumsTest.java
index 060ba4f..c450939 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Artists_AlbumsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Artists_AlbumsTest.java
@@ -25,8 +25,6 @@
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.Media;
import android.provider.MediaStore.Audio.Artists.Albums;
@@ -42,11 +40,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -66,8 +59,7 @@
assertNotNull(mContentResolver.query(contentUri, null, null, null, null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(MediaStore.Audio.Artists.Albums.getContentUri(volume, 1),
null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_GenresTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_GenresTest.java
index a0dce12..4e343cc 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_GenresTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_GenresTest.java
@@ -26,8 +26,6 @@
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Genres;
import android.test.InstrumentationTestCase;
@@ -39,11 +37,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -60,7 +53,6 @@
Genres.getContentUri(MediaStoreAudioTestHelper.EXTERNAL_VOLUME_NAME), null, null,
null, null));
- // can not accept any other volume names
try {
assertNotNull(mContentResolver.query(
Genres.getContentUri(MediaStoreAudioTestHelper.INTERNAL_VOLUME_NAME), null,
@@ -70,8 +62,8 @@
// expected
}
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ // can not accept any other volume names
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Genres.getContentUri(volume), null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Genres_MembersTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Genres_MembersTest.java
index 34d420e..66ac599 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Genres_MembersTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Genres_MembersTest.java
@@ -26,8 +26,6 @@
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Genres;
import android.provider.MediaStore.Audio.Media;
import android.provider.MediaStore.Audio.Genres.Members;
@@ -47,11 +45,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
Uri uri = Audio1.getInstance().insertToExternal(mContentResolver);
Cursor c = mContentResolver.query(uri, null, null, null, null);
@@ -87,7 +80,6 @@
Members.getContentUri(MediaStoreAudioTestHelper.EXTERNAL_VOLUME_NAME, 1), null,
null, null, null));
- // can not accept any other volume names
try {
assertNotNull(mContentResolver.query(
Members.getContentUri(MediaStoreAudioTestHelper.INTERNAL_VOLUME_NAME, 1), null,
@@ -97,8 +89,8 @@
// expected
}
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ // can not accept any other volume names
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Members.getContentUri(volume, 1), null, null, null,
null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
index 1969a20..29b270e 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
@@ -26,7 +26,6 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Media;
import android.provider.cts.MediaStoreAudioTestHelper.Audio1;
import android.provider.cts.MediaStoreAudioTestHelper.Audio2;
@@ -40,11 +39,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -62,8 +56,7 @@
null, null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "faveVolume";
assertNull(mContentResolver.query(Media.getContentUri(volume), null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_PlaylistsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_PlaylistsTest.java
index 045cc8e..1bf66f1 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_PlaylistsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_PlaylistsTest.java
@@ -26,8 +26,6 @@
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Playlists;
import android.test.InstrumentationTestCase;
@@ -39,11 +37,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -69,8 +62,7 @@
// expected
}
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Playlists.getContentUri(volume), null, null, null,
null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Playlists_MembersTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Playlists_MembersTest.java
index 60bb323..f4d2d66 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Playlists_MembersTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_Playlists_MembersTest.java
@@ -26,8 +26,6 @@
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore.Audio.Media;
import android.provider.MediaStore.Audio.Playlists;
import android.provider.MediaStore.Audio.Playlists.Members;
@@ -102,11 +100,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached or the sdcard is not accessible!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
Uri uri = Audio1.getInstance().insertToExternal(mContentResolver);
Cursor c = mContentResolver.query(uri, null, null, null, null);
@@ -171,8 +164,7 @@
// expected
}
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Members.getContentUri(volume, 1), null, null, null,
null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
index deed3b7..aa47aca 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
@@ -30,8 +30,6 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore;
import android.provider.MediaStore.Images.Media;
import android.provider.MediaStore.Images.Thumbnails;
@@ -80,11 +78,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached!");
- }
-
mContext = getInstrumentation().getTargetContext();
mContentResolver = mContext.getContentResolver();
@@ -248,8 +241,7 @@
null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Media.getContentUri(volume), null, null, null, null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
index b2b390e..2e68695 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
@@ -30,8 +30,6 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore;
import android.provider.MediaStore.Images.Media;
import android.provider.MediaStore.Images.Thumbnails;
@@ -68,11 +66,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached!");
- }
-
mContext = getInstrumentation().getTargetContext();
mContentResolver = mContext.getContentResolver();
@@ -191,8 +184,7 @@
null, null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Thumbnails.getContentUri(volume), null, null, null,
null));
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
index 27e0b08..d2067ab 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
@@ -24,8 +24,6 @@
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Environment;
-import android.os.FileUtils;
import android.provider.MediaStore;
import android.provider.MediaStore.Video.Media;
import android.test.InstrumentationTestCase;
@@ -38,11 +36,6 @@
protected void setUp() throws Exception {
super.setUp();
- if (FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath()) < 0) {
- // tests for external database need sdcard
- fail("There is no sdcard attached!");
- }
-
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
@@ -58,8 +51,7 @@
null));
// can not accept any other volume names
- String volume = "volume"
- + FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());
+ String volume = "fakeVolume";
assertNull(mContentResolver.query(Media.getContentUri(volume), null, null, null, null));
}