[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-68.1.0esr-9.0-1] Bug 25741 - TBA: Add an AppConstant for TOR_BROWSER_VERSION



commit 7bcca0910e5ccd82858b5be0980437f61ce1df5f
Author: Matthew Finkel <Matthew.Finkel@xxxxxxxxx>
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 ++-
 mobile/android/geckoview/build.gradle              |  1 +
 4 files changed, 45 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..ae1d481807de
--- /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.*;
+
+@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, "9.0");
+    }
+}
diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in
index 655a5e94cbb7..bfc594e7e801 100644
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -357,4 +357,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 4e079ce2e0cd..592a8ec9dae3 100644
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -63,7 +63,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]
 
diff --git a/mobile/android/geckoview/build.gradle b/mobile/android/geckoview/build.gradle
index 84035fdce449..fe1b1ca7cb7a 100644
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -89,6 +89,7 @@ android {
         buildConfigField 'String', "MOZ_APP_DISPLAYNAME", "\"${mozconfig.substs.MOZ_APP_DISPLAYNAME}\"";
         buildConfigField 'String', "MOZ_APP_UA_NAME", "\"${mozconfig.substs.MOZ_APP_UA_NAME}\"";
         buildConfigField 'String', "MOZ_UPDATE_CHANNEL", "\"${mozconfig.substs.MOZ_UPDATE_CHANNEL}\"";
+        buildConfigField 'String', "TOR_BROWSER_VERSION", "\"${mozconfig.substs.TOR_BROWSER_VERSION}\"";
 
         // MOZILLA_VERSION is oddly quoted from autoconf, but we don't have to handle it specially in Gradle.
         buildConfigField 'String', "MOZILLA_VERSION", "\"${mozconfig.substs.MOZILLA_VERSION}\"";



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits