RootsCacheTestpublic class RootsCacheTest extends android.test.AndroidTestCase
Fields Summary |
---|
private com.android.documentsui.model.RootInfo | mNull | private com.android.documentsui.model.RootInfo | mEmpty | private com.android.documentsui.model.RootInfo | mWild | private com.android.documentsui.model.RootInfo | mImages | private com.android.documentsui.model.RootInfo | mAudio | private com.android.documentsui.model.RootInfo | mDocs | private com.android.documentsui.model.RootInfo | mMalformed1 | private com.android.documentsui.model.RootInfo | mMalformed2 | private List | mRoots | private com.android.documentsui.DocumentsActivity.State | mState |
Methods Summary |
---|
private static void | assertContainsExactly(java.util.List expected, java.util.List actual)
assertEquals(expected.size(), actual.size());
for (Object o : expected) {
assertTrue(actual.contains(o));
}
| private static com.android.documentsui.model.RootInfo | buildForMimeTypes(java.lang.String mimeTypes)
final RootInfo root = new RootInfo();
root.derivedMimeTypes = mimeTypes;
return root;
| protected void | setUp()
super.setUp();
mState = new State();
mState.action = State.ACTION_OPEN;
mState.showAdvanced = true;
mState.localOnly = false;
| public void | testMatchingRootsApplication()
mState.acceptMimes = new String[] { "application/*" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mAudio, mDocs),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsAudioSpecific()
mState.acceptMimes = new String[] { "audio/mpeg" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mAudio),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsAudioWild()
mState.acceptMimes = new String[] { "audio/*" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mAudio),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsAudioWildOrImageWild()
mState.acceptMimes = new String[] { "audio/*", "image/*" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mAudio, mImages),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsDocument()
mState.acceptMimes = new String[] { "application/msword" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mDocs),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsEverything()
mState.acceptMimes = new String[] { "*/*" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mImages, mAudio, mDocs, mMalformed1, mMalformed2),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsFlacOrPng()
mState.acceptMimes = new String[] { "application/x-flac", "image/png" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mAudio, mImages),
RootsCache.getMatchingRoots(mRoots, mState));
| public void | testMatchingRootsPngOrWild()
mState.acceptMimes = new String[] { "image/png", "*/*" };
assertContainsExactly(
Lists.newArrayList(mNull, mWild, mImages, mAudio, mDocs, mMalformed1, mMalformed2),
RootsCache.getMatchingRoots(mRoots, mState));
|
|