Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: OONI Run v2 API Bootstrap #582

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b81dc16
added ooni run v2 in experimental mode
aanorbel Jul 10, 2023
64a54cf
updated app to support OONI Run V2 links
aanorbel Jul 12, 2023
0e1a351
updated app to cache test descriptors
aanorbel Jul 13, 2023
b12636a
updated app to cache test descriptors
aanorbel Jul 13, 2023
57c3bba
updated app to use string resources in dashboard and overview instead…
aanorbel Jul 13, 2023
ba1076e
added result row
aanorbel Jul 13, 2023
6ec5283
updated result list and ooni run screen
aanorbel Jul 14, 2023
cabac91
update with change in cli interface
aanorbel Jul 15, 2023
b8dedf6
updated run activity to install link and navigate to overview activity
aanorbel Jul 18, 2023
d996736
modified list on ooni run activity to display inputs for nettests
aanorbel Jul 19, 2023
22cf159
Updates recycler view for inputs
aanorbel Jul 21, 2023
c19ac4f
Updates OONI Run V2 to install links even when tests are already runn…
aanorbel Aug 1, 2023
1158fb0
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 1, 2023
92950eb
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 2, 2023
44a3d4f
Merge branch 'xoonirun' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 2, 2023
f6e3782
Adds support for icons and a default icons when the Ooni Run V2 link …
aanorbel Aug 2, 2023
e8f2307
Updated Icon color for OONI Run V2 Icons
aanorbel Aug 3, 2023
09c61e0
Merge branch 'chore/running-activity-upgrade-to-view-binding' of gith…
aanorbel Aug 3, 2023
a94376f
Updated `RunningActivity` to show Icon of OONI Run V2 link
aanorbel Aug 3, 2023
4d7c065
Merge branch 'chore/upgdate-ooni-run-activity-to-viewbinding' of gith…
aanorbel Aug 3, 2023
23d541f
Merge branch 'chore/overview-activity-upgrade-to-view-binding' of git…
aanorbel Aug 3, 2023
781c70d
Updated Result to contain reference to the descriptor.
aanorbel Aug 4, 2023
8c13a21
Added support for translation
aanorbel Aug 4, 2023
e4989af
Satisfied constructor dependency for testsuites in test package
aanorbel Aug 5, 2023
003a9c5
Add measurement count to run item
aanorbel Aug 7, 2023
221d446
Start implementation of autorun and auto update
aanorbel Aug 10, 2023
a981699
add support for item update by swipe to refresh
aanorbel Aug 10, 2023
c6d1f43
Updated logic for automatically updating and approved updated
aanorbel Aug 11, 2023
b82cc0b
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 11, 2023
ca44991
Merge branch 'xoonirun' of github.com:ooni/probe-android into oonirun…
aanorbel Aug 11, 2023
ea8c3da
Updated `OoniRunActivity` to fetch v2 descriptor async
aanorbel Aug 14, 2023
0e3dc3c
Merge branch 'xoonirun' of github.com:ooni/probe-android into oonirun…
aanorbel Aug 14, 2023
2d7d8b7
Updated xml to remove duplicate tools
aanorbel Aug 14, 2023
ebeca76
Updates UI on refresh complete
aanorbel Aug 15, 2023
f41142a
Updated ViewModel
aanorbel Aug 16, 2023
6f85191
Merge pull request #599 from ooni/oonirun/add-autorun-and-auto-update…
aanorbel Aug 17, 2023
7ab812a
- Changed theme for `OverviewActivity`, `ResultDetailActivity`, `Meas…
aanorbel Aug 18, 2023
f99de74
Adds default property values for `color` and `animation` if backend d…
aanorbel Aug 21, 2023
b9a03b3
removed default animation
aanorbel Aug 21, 2023
75d166b
Modified scheduling of workers.
aanorbel Aug 25, 2023
04eaff1
Updated scheduling of workers
aanorbel Aug 25, 2023
368b509
Merge pull request #601 from ooni/oonirun/add-support-for-color-and-a…
aanorbel Aug 28, 2023
c0d34c2
Adds ooni run id to anotations
aanorbel Oct 9, 2023
c152544
Merge pull request #620 from ooni/oonirun/add-run-id-to-anotations
aanorbel Oct 11, 2023
21e5ebb
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Oct 31, 2023
fa156e8
Merge branches 'xoonirun' and 'master' of github.com:ooni/probe-andro…
aanorbel Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ Generate code coverage report (after all unit and instrumented tests successfull
To manage translations check out our [translation repo](https://github.com/ooni/translations)
and follow the instructions there.

## Importing Icons

```shell
./scripts/import_icons.sh ~/Downloads/react-icons-xmls
```
Comment on lines +149 to +153
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

## Contributing

* Write some code
Expand Down
9 changes: 9 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'kotlin-kapt'
}
apply from: 'jacoco.gradle'
apply plugin: 'org.jetbrains.kotlin.android'

android {
compileSdk libs.versions.compileSdk.get().toInteger()
Expand Down Expand Up @@ -95,6 +96,10 @@ android {
buildFeatures {
viewBinding = true
}
dataBinding {
enabled = true
enabledForTests = true
}
namespace 'org.openobservatory.ooniprobe'
}

Expand All @@ -114,6 +119,10 @@ dependencies {
implementation libs.google.guava
implementation libs.google.gson

implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// WorkManager dependency
implementation 'androidx.work:work-runtime:2.8.1'

// Third-party
kapt libs.dbflow.processor
implementation libs.dbflow.core
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.openobservatory.ooniprobe.ui;

import android.content.Intent;
import android.content.res.Resources;

import androidx.test.core.app.ActivityScenario;
import androidx.test.ext.junit.runners.AndroidJUnit4;
Expand All @@ -15,6 +16,7 @@
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
import org.openobservatory.ooniprobe.AbstractTest;
import org.openobservatory.ooniprobe.TestApplicationProvider;
import org.openobservatory.ooniprobe.activity.MainActivity;
import org.openobservatory.ooniprobe.activity.RunningActivity;
import org.openobservatory.ooniprobe.common.service.RunTestService;
Expand Down Expand Up @@ -45,6 +47,8 @@ public class RunningActivityTest extends AbstractTest {
public RuleChain chain = RuleChain.outerRule(flakyRule)
.around(serviceRule);

Resources resources = TestApplicationProvider.app().getResources();

@Override
public void before() {
super.before();
Expand Down Expand Up @@ -87,7 +91,7 @@ private void startRunTestService() {
serviceRule.startService(
new Intent(c, RunTestService.class)
.putExtra("testSuites", new ArrayList<AbstractSuite>() {{
add(new InstantMessagingSuite());
add(new InstantMessagingSuite(resources));
}})
);
} catch (TimeoutException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.TestApplicationProvider;
import org.openobservatory.ooniprobe.factory.ResultFactory;
import org.openobservatory.ooniprobe.model.database.Measurement;
import org.openobservatory.ooniprobe.model.database.Result;
Expand All @@ -22,17 +23,20 @@
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;

import android.content.res.Resources;

@RunWith(AndroidJUnit4.class)
public class CircumventionTest extends MeasurementAbstractTest {

@Rule
public FlakyTestRule flakyRule = new FlakyTestRule();
Resources resources = TestApplicationProvider.app().getResources();

@Test
@AllowFlaky(attempts = 3)
public void testHeaderData() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 3, 0);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 3, 0);

// Act
launchDetails(testResult.id);
Expand All @@ -44,7 +48,7 @@ public void testHeaderData() {
@Test
public void testSuccessPsiphon() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 3, 0);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 3, 0);
Measurement measurement = testResult.getMeasurement("psiphon");
String formattedBootstrap = FormattingUtils.formatBootstrap(measurement.getTestKeys().bootstrap_time);

Expand All @@ -61,7 +65,7 @@ public void testSuccessPsiphon() {
@Test
public void testBlockedPsiphon() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 0, 3);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 0, 3);
Measurement measurement = testResult.getMeasurement("psiphon");

// Act
Expand All @@ -77,7 +81,7 @@ public void testBlockedPsiphon() {
@Test
public void testSuccessTor() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 3, 0);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 3, 0);
Measurement measurement = testResult.getMeasurement("tor");

String formattedBridges = FormattingUtils.getFormattedBridges(measurement);
Expand All @@ -97,7 +101,7 @@ public void testSuccessTor() {
@Test
public void testBlockedTor() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 0, 3);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 0, 3);
Measurement measurement = testResult.getMeasurement("tor");

String formattedBridges = FormattingUtils.getFormattedBridges(measurement);
Expand All @@ -117,7 +121,7 @@ public void testBlockedTor() {
@Test
public void testSuccessfulRiseUpVPN() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 3, 0);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 3, 0);
Measurement measurement = testResult.getMeasurement("riseupvpn");

// Act
Expand All @@ -135,7 +139,7 @@ public void testSuccessfulRiseUpVPN() {
@Test
public void testBlockedRiseUpVPN() {
// Arrange
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(), 0, 3);
Result testResult = ResultFactory.createAndSave(new CircumventionSuite(resources), 0, 3);
Measurement measurement = testResult.getMeasurement("riseupvpn");

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.TestApplicationProvider;
import org.openobservatory.ooniprobe.factory.ResultFactory;
import org.openobservatory.ooniprobe.model.database.Result;
import org.openobservatory.ooniprobe.test.suite.InstantMessagingSuite;
Expand All @@ -20,17 +21,20 @@
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;

import android.content.res.Resources;

@RunWith(AndroidJUnit4.class)
public class InstantMessagingTest extends MeasurementAbstractTest {

@Rule
public FlakyTestRule flakyRule = new FlakyTestRule();
Resources resources = TestApplicationProvider.app().getResources();

@Test
@AllowFlaky(attempts = 3)
public void testHeaderData() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite());
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources));

// Act
launchDetails(testResult.id);
Expand All @@ -43,7 +47,7 @@ public void testHeaderData() {
@AllowFlaky(attempts = 2)
public void testSuccessWhatsApp() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite());
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources));

// Act
launchDetails(testResult.id);
Expand All @@ -57,7 +61,7 @@ public void testSuccessWhatsApp() {
@Test
public void testBlockedWhatsApp() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(), 0, 4);
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources), 0, 4);

// Act
launchDetails(testResult.id);
Expand All @@ -72,7 +76,7 @@ public void testBlockedWhatsApp() {
@Test
public void testSuccessTelegram() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite());
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources));

// Act
launchDetails(testResult.id);
Expand All @@ -87,7 +91,7 @@ public void testSuccessTelegram() {
@Test
public void testBlockedTelegram() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(), 0, 4);
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources), 0, 4);

// Act
launchDetails(testResult.id);
Expand All @@ -102,7 +106,7 @@ public void testBlockedTelegram() {
@Test
public void testSuccessFacebookMessenger() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite());
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources));

// Act
launchDetails(testResult.id);
Expand All @@ -117,7 +121,7 @@ public void testSuccessFacebookMessenger() {
@Test
public void testBlockedFacebookMessenger() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(), 0, 4);
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources), 0, 4);

// Act
launchDetails(testResult.id);
Expand All @@ -132,7 +136,7 @@ public void testBlockedFacebookMessenger() {
@Test
public void testSuccessSignal() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite());
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources));

// Act
launchDetails(testResult.id);
Expand All @@ -146,7 +150,7 @@ public void testSuccessSignal() {
@Test
public void testBlockedSignal() {
// Arrange
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(), 0, 4);
Result testResult = ResultFactory.createAndSave(new InstantMessagingSuite(resources), 0, 4);

// Act
launchDetails(testResult.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.TestApplicationProvider;
import org.openobservatory.ooniprobe.factory.ResultFactory;
import org.openobservatory.ooniprobe.model.database.Measurement;
import org.openobservatory.ooniprobe.model.database.Result;
Expand All @@ -33,17 +34,20 @@
import static org.hamcrest.Matchers.containsString;
import static org.openobservatory.ooniprobe.ui.utils.RecyclerViewMatcher.withRecyclerView;

import android.content.res.Resources;

@RunWith(AndroidJUnit4.class)
public class PerformanceTest extends MeasurementAbstractTest {

@Rule
public FlakyTestRule flakyRule = new FlakyTestRule();
Resources resources = TestApplicationProvider.app().getResources();

@Test
@AllowFlaky(attempts = 3)
public void testHeaderData() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement dashMeasurement = testResult.getMeasurement(Dash.NAME);
String videoQuality = getResourceString(dashMeasurement.getTestKeys().getVideoQuality(false));

Expand Down Expand Up @@ -90,7 +94,7 @@ public void testHeaderData() {
@Test
public void testListOfMeasurements() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement dashMeasurement = testResult.getMeasurement(Dash.NAME);
String videoQuality = getResourceString(dashMeasurement.getTestKeys().getVideoQuality(true));
String notDetected = getResourceString(R.string.TestResults_Overview_MiddleBoxes_NotFound);
Expand Down Expand Up @@ -147,7 +151,7 @@ public void testListOfMeasurements() {
@Test
public void testNDT() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement ndtMeasurement = testResult.getMeasurement(Ndt.NAME);
Integer ndtProtocol = ndtMeasurement.getTestKeys().protocol;
TestKeys.Summary ndtSummary = ndtMeasurement.getTestKeys().summary;
Expand Down Expand Up @@ -193,7 +197,7 @@ public void testNDT() {
@Test
public void testStreaming() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement dashMeasurement = testResult.getMeasurement(Dash.NAME);
String videoQuality = getResourceString(dashMeasurement.getTestKeys().getVideoQuality(true));
String bitrateUnit = getResourceString(dashMeasurement.getTestKeys().getMedianBitrateUnit());
Expand All @@ -214,7 +218,7 @@ public void testStreaming() {
@Test
public void testRequestLine() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement invalidRequest = testResult.getMeasurement(HttpInvalidRequestLine.NAME);

// Act
Expand All @@ -229,7 +233,7 @@ public void testRequestLine() {
@Test
public void testRequestLineDetection() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(), 2, 2);
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources), 2, 2);
Measurement invalidRequest = testResult.getMeasurement(HttpInvalidRequestLine.NAME);

// Act
Expand All @@ -244,7 +248,7 @@ public void testRequestLineDetection() {
@Test
public void testFieldManipulation() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite());
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources));
Measurement fieldManipulation = testResult.getMeasurement(HttpHeaderFieldManipulation.NAME);

// Act
Expand All @@ -259,7 +263,7 @@ public void testFieldManipulation() {
@Test
public void testFieldManipulationDetection() {
// Arrange
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(), 2, 2);
Result testResult = ResultFactory.createAndSave(new PerformanceSuite(resources), 2, 2);
Measurement fieldManipulation = testResult.getMeasurement(HttpHeaderFieldManipulation.NAME);

// Act
Expand Down
Loading
Loading