Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java
diff --git a/base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java b/base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java
index f6d5f60a729cd79c0d4a3407a0ea394534463035..fe9d5403de7d93823d3a0da3ca1bb427d8deecc6 100644
--- a/base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java
+++ b/base/test/android/java/src/org/chromium/base/ContentUriTestUtils.java
@@ -5,7 +5,6 @@
package org.chromium.base;
import android.content.ContentValues;
-import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
@@ -20,19 +19,16 @@ public class ContentUriTestUtils {
* Insert an image into the MediaStore, and return the content URI. If the
* image already exists in the MediaStore, just retrieve the URI.
*
- * @param context Application context.
* @param path Path to the image file.
* @return Content URI of the image.
*/
@CalledByNative
- private static String insertImageIntoMediaStore(Context context, String path) {
+ private static String insertImageIntoMediaStore(String path) {
// Check whether the content URI exists.
- Cursor c = context.getContentResolver().query(
+ Cursor c = ContextUtils.getApplicationContext().getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
- new String[] { MediaStore.Video.VideoColumns._ID },
- MediaStore.Images.Media.DATA + " LIKE ?",
- new String[] { path },
- null);
+ new String[] {MediaStore.Video.VideoColumns._ID},
+ MediaStore.Images.Media.DATA + " LIKE ?", new String[] {path}, null);
if (c != null && c.getCount() > 0) {
c.moveToFirst();
int id = c.getInt(0);
@@ -43,7 +39,7 @@ public class ContentUriTestUtils {
// Insert the content URI into MediaStore.
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, path);
- Uri uri = context.getContentResolver().insert(
+ Uri uri = ContextUtils.getApplicationContext().getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
return uri.toString();
}

Powered by Google App Engine
This is Rietveld 408576698