diff options
author | cyBerta <cyberta@riseup.net> | 2021-11-08 00:54:24 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-11-08 00:54:24 +0100 |
commit | 0b80fad26c91e5aa0faf8bc0132184eeeb7883b0 (patch) | |
tree | 7e11500369176c54a122f11e857840f9c65cc379 /app/src/test/java/se | |
parent | 62c28b219a85aa3074356e1e49e92e30c1166c3b (diff) |
revert restriction to be connected to wifi in order to use snowflake/tor fallback
Diffstat (limited to 'app/src/test/java/se')
-rw-r--r-- | app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java index 5ecde5d4..3411274a 100644 --- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java +++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java @@ -108,13 +108,11 @@ public class ProviderApiManagerTest { static class TestProviderApiServiceCallback implements ProviderApiManagerBase.ProviderApiServiceCallback { Throwable startTorServiceException; - boolean isConnectedToWifi; TestProviderApiServiceCallback() { - new TestProviderApiServiceCallback(null/*, 0*/, true); + new TestProviderApiServiceCallback(null); } - TestProviderApiServiceCallback(@Nullable Throwable startTorServiceException/*, int torHttpTunnelPort*/, boolean isConnectedToWifi) { + TestProviderApiServiceCallback(@Nullable Throwable startTorServiceException) { this.startTorServiceException = startTorServiceException; - this.isConnectedToWifi = isConnectedToWifi; } @Override @@ -142,10 +140,6 @@ public class ProviderApiManagerTest { return 0; } - @Override - public boolean isConnectedToWifi() { - return this.isConnectedToWifi; - } } @Before @@ -627,7 +621,7 @@ public class ProviderApiManagerTest { mockFingerprintForCertificate(" a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494"); mockProviderApiConnector(ERROR_DNS_RESUOLUTION_TOR_FALLBACK); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null)); Intent providerApiCommand = mockIntent(); providerApiCommand.putExtra(PROVIDER_KEY, provider); @@ -641,31 +635,12 @@ public class ProviderApiManagerTest { } @Test - public void test_handleIntentSetupProvider_TorFallback_SecondTryFailedNoWifi() throws IOException, CertificateEncodingException, NoSuchAlgorithmException, TimeoutException, InterruptedException { - Provider provider = getConfiguredProviderAPIv4(); - - mockFingerprintForCertificate(" a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494"); - mockProviderApiConnector(ERROR_DNS_RESUOLUTION_TOR_FALLBACK); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, false)); - - Intent providerApiCommand = mockIntent(); - providerApiCommand.putExtra(PROVIDER_KEY, provider); - providerApiCommand.setAction(ProviderAPI.SET_UP_PROVIDER); - providerApiCommand.putExtra(ProviderAPI.RECEIVER_KEY, mockResultReceiver(PROVIDER_NOK)); - - mockTorStatusObservable(null); - - providerApiManager.handleIntent(providerApiCommand); - assertEquals(-1, TorStatusObservable.getProxyPort()); - } - - @Test public void test_handleIntentSetupProvider_TorFallbackStartServiceException_SecondTryFailed() throws IOException, CertificateEncodingException, NoSuchAlgorithmException, TimeoutException, InterruptedException { Provider provider = getConfiguredProviderAPIv4(); mockFingerprintForCertificate(" a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494"); mockProviderApiConnector(ERROR_DNS_RESUOLUTION_TOR_FALLBACK); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(new IllegalStateException("Tor service start not failed."), true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(new IllegalStateException("Tor service start not failed."))); Intent providerApiCommand = mockIntent(); providerApiCommand.putExtra(PROVIDER_KEY, provider); @@ -684,7 +659,7 @@ public class ProviderApiManagerTest { mockFingerprintForCertificate(" a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494"); mockProviderApiConnector(ERROR_DNS_RESUOLUTION_TOR_FALLBACK); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null)); Intent providerApiCommand = mockIntent(); providerApiCommand.putExtra(PROVIDER_KEY, provider); @@ -705,7 +680,7 @@ public class ProviderApiManagerTest { mockProviderApiConnector(NO_ERROR_API_V4); mockPreferences.edit().putBoolean(USE_BRIDGES, true).putBoolean(USE_TOR, true).commit(); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null)); Intent providerApiCommand = mockIntent(); providerApiCommand.putExtra(PROVIDER_KEY, provider); @@ -726,7 +701,7 @@ public class ProviderApiManagerTest { mockProviderApiConnector(NO_ERROR_API_V4); mockPreferences.edit().putBoolean(USE_BRIDGES, false).putBoolean(USE_TOR, false).commit(); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null)); Intent providerApiCommand = mockIntent(); providerApiCommand.putExtra(PROVIDER_KEY, provider); @@ -744,7 +719,7 @@ public class ProviderApiManagerTest { Provider provider = getConfiguredProviderAPIv4(); mockPreferences.edit().putBoolean(USE_BRIDGES, true).putBoolean(USE_TOR, true).commit(); - providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null, true)); + providerApiManager = new ProviderApiManager(mockPreferences, mockResources, mockClientGenerator(), new TestProviderApiServiceCallback(null)); Bundle expectedResult = mockBundle(); expectedResult.putBoolean(BROADCAST_RESULT_KEY, false); |