Bug 1243713 - TestDownloadContentCatalog: Skip testCatalogIsBootstrapedIfFileDoesNotExist() if MOZ_ANDROID_EXCLUDE_FONTS is not set. r?nalexander draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 28 Jan 2016 13:15:56 +0100
changeset 326716 fd50f566e83ef466aa82e988dd10b149f8b64ed4
parent 326715 f01c61b2c49270a44aa4d53c011c9b9f74447988
child 513631 a2c8f3d9375c865504a072092c367b9e062fe841
push id10166
push users.kaspari@gmail.com
push dateThu, 28 Jan 2016 12:16:34 +0000
reviewersnalexander
bugs1243713
milestone47.0a1
Bug 1243713 - TestDownloadContentCatalog: Skip testCatalogIsBootstrapedIfFileDoesNotExist() if MOZ_ANDROID_EXCLUDE_FONTS is not set. r?nalexander
mobile/android/tests/background/junit4/src/org/mozilla/gecko/dlc/catalog/TestDownloadContentCatalog.java
--- 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);
     }