Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through file URIs to ContentResolver implementation. #4862

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.Shadows;
Expand All @@ -38,8 +40,10 @@
public class ThumbnailStreamOpenerTest {
private Harness harness;

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

@Before
public void setUp() {
public void setUp() throws Exception {
harness = new Harness();
}

Expand Down Expand Up @@ -123,15 +127,15 @@ private static ContentResolver getContentResolver() {
return ApplicationProvider.getApplicationContext().getContentResolver();
}

private static class Harness {
private class Harness {
final MatrixCursor cursor = new MatrixCursor(new String[1]);
final File file = new File("fake/uri");
final File file = temporaryFolder.newFile();
final Uri uri = Uri.fromFile(file);
final ThumbnailQuery query = mock(ThumbnailQuery.class);
final FileService service = mock(FileService.class);
final ArrayPool byteArrayPool = new LruArrayPool();

Harness() {
Harness() throws Exception {
cursor.addRow(new String[] {file.getAbsolutePath()});
when(query.query(eq(uri))).thenReturn(cursor);
when(service.get(eq(file.getAbsolutePath()))).thenReturn(file);
Expand Down