[tbb-commits] [tor-browser/tor-browser-60.1.0esr-8.0-1] Bug 25741 - TBA: Add an AppConstant for TOR_BROWSER_VERSION

gk at torproject.org gk at torproject.org
Fri Jul 27 08:37:27 UTC 2018


commit b148406e9e358c325e008a22454fe13c416e5789
Author: Matthew Finkel <Matthew.Finkel at gmail.com>
Date:   Fri Jan 19 20:13:58 2018 +0000

    Bug 25741 - TBA: Add an AppConstant for TOR_BROWSER_VERSION
---
 .../java/org/mozilla/gecko/TorBrowserTest.java     | 27 ++++++++++++++++++++++
 mobile/android/base/AppConstants.java.in           | 15 ++++++++++++
 mobile/android/base/generate_build_config.py       |  3 ++-
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/mobile/android/app/src/test/java/org/mozilla/gecko/TorBrowserTest.java b/mobile/android/app/src/test/java/org/mozilla/gecko/TorBrowserTest.java
new file mode 100644
index 000000000000..15ee5aa1b70f
--- /dev/null
+++ b/mobile/android/app/src/test/java/org/mozilla/gecko/TorBrowserTest.java
@@ -0,0 +1,27 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+package org.mozilla.gecko;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mozilla.gecko.background.testhelpers.TestRunner;
+import org.mozilla.gecko.AppConstants;
+
+import static org.junit.Assert.*;
+
+ at RunWith(TestRunner.class)
+public class TorBrowserTest {
+    /**
+     * Tests the compile-time constants are set.
+     */
+    @Test
+    public void testIsTorBrowser() {
+        assertTrue(AppConstants.isTorBrowser());
+    }
+
+    @Test
+    public void testTorBrowserVersion() {
+        assertEquals(AppConstants.TOR_BROWSER_VERSION, "8.0");
+    }
+}
diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in
index 34e483a6db77..79f81257dade 100644
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -338,4 +338,19 @@ public class AppConstants {
 //#else
         null;
 //#endif
+
+    public static final String TOR_BROWSER_VERSION =
+//#ifdef TOR_BROWSER_VERSION
+        "@TOR_BROWSER_VERSION@";
+//#else
+        null;
+//#endif
+
+    public static final boolean isTorBrowser() {
+//#ifdef TOR_BROWSER_VERSION
+        return true;
+//#else
+        return false;
+//#endif
+    }
 }
diff --git a/mobile/android/base/generate_build_config.py b/mobile/android/base/generate_build_config.py
index f5f499b09aed..61e5f91aa6e4 100644
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -64,7 +64,8 @@ def _defines():
                 'MOZ_ANDROID_MAX_SDK_VERSION',
                 'MOZ_ANDROID_MIN_SDK_VERSION',
                 'MOZ_PKG_SPECIAL',
-                'MOZ_UPDATER'):
+                'MOZ_UPDATER',
+                'TOR_BROWSER_VERSION'):
         if CONFIG[var]:
             DEFINES[var] = CONFIG[var]
 





More information about the tbb-commits mailing list