| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.base; | 5 package org.chromium.base; |
| 6 | 6 |
| 7 import android.content.ContentResolver; | |
| 8 import android.content.ContentValues; | 7 import android.content.ContentValues; |
| 9 import android.content.Context; | 8 import android.content.Context; |
| 10 import android.database.Cursor; | 9 import android.database.Cursor; |
| 11 import android.net.Uri; | 10 import android.net.Uri; |
| 12 import android.provider.MediaStore; | 11 import android.provider.MediaStore; |
| 13 | 12 |
| 14 import org.chromium.base.CalledByNative; | |
| 15 | |
| 16 /** | 13 /** |
| 17 * Utilities for testing operations on content URI. | 14 * Utilities for testing operations on content URI. |
| 18 */ | 15 */ |
| 19 public class ContentUriTestUtils { | 16 public class ContentUriTestUtils { |
| 20 /** | 17 /** |
| 21 * Insert an image into the MediaStore, and return the content URI. If the | 18 * Insert an image into the MediaStore, and return the content URI. If the |
| 22 * image already exists in the MediaStore, just retrieve the URI. | 19 * image already exists in the MediaStore, just retrieve the URI. |
| 23 * | 20 * |
| 24 * @param context Application context. | 21 * @param context Application context. |
| 25 * @param path Path to the image file. | 22 * @param path Path to the image file. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 } | 39 } |
| 43 | 40 |
| 44 // Insert the content URI into MediaStore. | 41 // Insert the content URI into MediaStore. |
| 45 ContentValues values = new ContentValues(); | 42 ContentValues values = new ContentValues(); |
| 46 values.put(MediaStore.MediaColumns.DATA, path); | 43 values.put(MediaStore.MediaColumns.DATA, path); |
| 47 Uri uri = context.getContentResolver().insert( | 44 Uri uri = context.getContentResolver().insert( |
| 48 MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); | 45 MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); |
| 49 return uri.toString(); | 46 return uri.toString(); |
| 50 } | 47 } |
| 51 } | 48 } |
| OLD | NEW |