Bug 1243713 - TestDownloadContentCatalog: Skip testCatalogIsBootstrapedIfFileDoesNotExist() if MOZ_ANDROID_EXCLUDE_FONTS is not set. r?nalexander
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/dlc/catalog/TestDownloadContentCatalog.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/dlc/catalog/TestDownloadContentCatalog.java
@@ -3,18 +3,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.dlc.catalog;
import android.support.v4.util.AtomicFile;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.Collections;
import static org.mockito.Mockito.doReturn;
@@ -52,17 +54,21 @@ public class TestDownloadContentCatalog
/**
* Scenario: Create a new, fresh catalog.
*
* Verify that:
* * Catalog is bootstrapped with items.
*/
@Test
- public void testCatalogIsBootstrapedIfFileDoesNotExist() throws Exception {
+ public void testCatalogIsBootstrappedIfFileDoesNotExist() throws Exception {
+ // The catalog is only bootstrapped if fonts are excluded from the build. If this is a build
+ // with fonts included then ignore this test.
+ Assume.assumeTrue("Fonts are excluded from build", AppConstants.MOZ_ANDROID_EXCLUDE_FONTS);
+
AtomicFile file = mock(AtomicFile.class);
doThrow(FileNotFoundException.class).when(file).readFully();
DownloadContentCatalog catalog = spy(new DownloadContentCatalog(file));
catalog.loadFromDisk();
Assert.assertTrue("Catalog is not empty", catalog.getContentWithoutState().size() > 0);
}