Dan Ballard pushed to branch tor-browser-153.5.0esr-16.0-1 at The Tor Project / Applications / Tor Browser Commits: 19c61226 by Beatriz Rizental at 2026-10-09T13:47:22+02:00 fixup! BB 45120: Add tests for Tor Browser Bug 44820: Upstream geckoiew's own manifest requests ACCESS_NETWORK_STATE. Tor Browser comments that line out so geckoview doesn't ask for network-state access, but the test app needs it. So we add it back. - - - - - 4e1e8bb6 by Beatriz Rizental at 2026-10-09T13:47:22+02:00 fixup! TB 43817: Add tests for Tor Browser Disable Fenix unit tests by default, since most of them don't work in Tor Browser (some don't even compile). An allowlist in the Fenix build.gradle controls which unit tests are compiled and run, so they can be re-enabled as they get fixed. When the allowlist is empty, the unit test compile and test tasks are skipped entirely. Also add a trivial SanityTest, enabled in the allowlist, to make sure the unit test pipeline works. - - - - - 72e858f6 by Makoto Kato at 2026-10-09T13:47:22+02:00 Bug 2047317 - Setup logging when using mach gtest. r=ahal This is a regression by bug 2017145. After landing it, `mach gtest` always causes an error because log is None. When using `mach` command, `android_gtest` in `mach_commands.py` will call `RemoteGTests.run_gtest` directly. So we need to consider this case. Differential Revision: https://phabricator.services.mozilla.com/D321136 - - - - - 4 changed files: - mobile/android/fenix/app/build.gradle - + mobile/android/fenix/app/src/test/java/org/mozilla/fenix/torbrowser/SanityTest.kt - mobile/android/geckoview/src/androidTest/AndroidManifest.xml - testing/gtest/remotegtests.py Changes: ===================================== mobile/android/fenix/app/build.gradle ===================================== @@ -720,6 +720,39 @@ protobuf { } } +// Unit tests are disabled by default because most of them don't work in Tor Browser. +// Add source path patterns here (e.g. 'org/mozilla/fenix/home/**') to re-enable them +// as they get fixed. Only the listed tests (plus the shared helpers) are compiled and run. +// When the list is empty, unit tests are neither compiled nor run. +def enabledUnitTests = [ + 'org/mozilla/fenix/torbrowser/**', +] +def unitTestHelpers = [ + 'org/mozilla/fenix/helpers/**', +] + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + if (name.contains("UnitTest")) { + if (enabledUnitTests) { + // The task already has default include patterns, so we can only narrow it down with excludes. + def allowed = new org.gradle.api.tasks.util.PatternSet() + .include((enabledUnitTests + unitTestHelpers).collect { "**/$it" }) + .asSpec + exclude { !it.directory && !allowed.isSatisfiedBy(it) } + } else { + enabled = false + } + } +} + +tasks.withType(Test).configureEach { + if (enabledUnitTests) { + include enabledUnitTests + } else { + enabled = false + } +} + if (project.hasProperty("coverage")) { tasks.withType(Test).configureEach { jacoco.includeNoLocationClasses = true ===================================== mobile/android/fenix/app/src/test/java/org/mozilla/fenix/torbrowser/SanityTest.kt ===================================== @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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.fenix.torbrowser + +import org.junit.Assert.assertEquals +import org.junit.Test + +class SanityTest { + @Test + fun `one plus one is two`() { + assertEquals(2, 1 + 1) + } +} ===================================== mobile/android/geckoview/src/androidTest/AndroidManifest.xml ===================================== @@ -4,6 +4,7 @@ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" ===================================== testing/gtest/remotegtests.py ===================================== @@ -81,6 +81,8 @@ class RemoteGTests: Launch the test app, run gtest, collect test results and wait for completion. Return False if a crash or other failure is detected, else True. """ + # mach gtest will call run_gtest() directly + setup_logging() update_mozinfo() self.device = mozdevice.ADBDeviceFactory( adb=adb_path, @@ -485,11 +487,16 @@ def update_mozinfo(): mozinfo.find_and_update_from_json(*dirs) -def main(): +def setup_logging(options=None): global log + if log is None: + log = commandline.setup_logging("gtest", options, {"raw": sys.stdout}) + + +def main(): parser = remoteGtestOptions() options = parser.parse_args() - log = commandline.setup_logging("gtest", options, {"raw": sys.stdout}) + setup_logging(options) args = options.args if not options.libxul_path: parser.error("--libxul is required") View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/aeb4c4a... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/aeb4c4a... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Dan Ballard (@dan)