summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java')
-rw-r--r--packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
index 7faa3ce..8c5bac1 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
@@ -114,6 +114,31 @@ public class RootsCacheTest extends AndroidTestCase {
RootsCache.getMatchingRoots(mRoots, mState));
}
+ public void testExcludedAuthorities() throws Exception {
+ final List<RootInfo> roots = Lists.newArrayList();
+
+ // Set up some roots
+ for (int i = 0; i < 5; ++i) {
+ RootInfo root = new RootInfo();
+ root.authority = "authority" + i;
+ roots.add(root);
+ }
+ // Make some allowed authorities
+ List<RootInfo> allowedRoots = Lists.newArrayList(
+ roots.get(0), roots.get(2), roots.get(4));
+ // Set up the excluded authority list
+ for (RootInfo root: roots) {
+ if (!allowedRoots.contains(root)) {
+ mState.excludedAuthorities.add(root.authority);
+ }
+ }
+ mState.acceptMimes = new String[] { "*/*" };
+
+ assertContainsExactly(
+ allowedRoots,
+ RootsCache.getMatchingRoots(roots, mState));
+ }
+
private static void assertContainsExactly(List<?> expected, List<?> actual) {
assertEquals(expected.size(), actual.size());
for (Object o : expected) {