diff options
Diffstat (limited to 'app')
8 files changed, 41 insertions, 66 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java index ff32f5aa..6d267e6e 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -72,7 +72,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co private void waitForProviderDetails() { String text = solo.getString(R.string.provider_details_fragment_title); - assertTrue("Provider details dialog did not appear", solo.waitForText(text)); + assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 40*1000)); } public void testAddNewProvider() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java index 68416b4a..06fe0a42 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -4,6 +4,7 @@ import android.content.*; import android.graphics.*; import android.test.*; import android.view.*; +import android.widget.Toast; import com.robotium.solo.*; @@ -118,18 +119,17 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D private void okToBrowserWarning() { solo.waitForDialogToOpen(); - String yes = solo.getString(R.string.yes); - solo.clickOnText(yes); + clickYes(); } - private void sayOkToDisconnect() { - assertTrue(solo.waitForActivity(DisconnectVPN.class)); + private void clickYes() { String yes = solo.getString(android.R.string.yes); solo.clickOnText(yes); } - private void assertDisconnected() { - assertTrue(iconDisconnected()); + private void sayOkToDisconnect() { + assertTrue(solo.waitForActivity(DisconnectVPN.class)); + clickYes(); } private boolean iconDisconnected() { @@ -201,31 +201,31 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } public void testEveryProvider() { - changeProvider("demo.bitmask.net"); - clickVpnImage(); - turningEipOn(); - clickVpnImage(); - turningEipOff(); - - changeProvider("riseup.net"); - clickVpnImage(); - turningEipOn(); - clickVpnImage(); - turningEipOff(); + changeAndTestProvider("demo.bitmask.net"); + changeAndTestProvider("riseup.net"); + changeAndTestProvider("calyx.net"); + } - changeProvider("calyx.net"); + private void changeAndTestProvider(String provider) { + changeProvider(provider); + sleep(1); clickVpnImage(); turningEipOn(); clickVpnImage(); turningEipOff(); } + private void sleep(int seconds) { + try { + Thread.sleep(seconds * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } private void changeProvider(String provider) { - tapSwitchProvider(); + tapSwitchProvider(); solo.clickOnText(provider); - useRegistered(); - solo.waitForText(solo.getString(R.string.downloading_certificate_message)); - assertDisconnected(); + useRegistered(); } private void useRegistered() { @@ -245,7 +245,6 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D solo.waitForDialogToClose(milliseconds_to_log_in); assertSuccessfulLogin(); } - public void testVpnIconIsDisplayed() { assertTrue(isShownWithinConfinesOfVisibleScreen(getVpnButton())); } diff --git a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java index 6ab08a06..12a2b239 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -194,8 +194,6 @@ public class ConfigurationWizard extends Activity mProgressBar.incrementProgressBy(1); hideProgressBar(); - setResult(RESULT_OK); - showProviderDetails(); } } else if (resultCode == ProviderAPI.PROVIDER_NOK) { @@ -212,8 +210,6 @@ public class ConfigurationWizard extends Activity hideProgressBar(); showProviderDetails(); - - setResult(RESULT_OK); } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { hideProgressBar(); cancelSettingUpProvider(); diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index ddd03dbc..afc6b131 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -161,7 +161,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn providerToPreferences(provider); buildDashboard(false); - invalidateOptionsMenu(); + invalidateOptionsMenuOnUiThread(); if (data.hasExtra(SessionDialog.TAG)) { sessionDialog(Bundle.EMPTY); } @@ -322,7 +322,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn else hideUserSessionProgressBar(); changeSessionStatusMessage(user_session_status.toString()); - invalidateOptionsMenu(); + invalidateOptionsMenuOnUiThread(); } } @@ -432,7 +432,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn setResult(RESULT_CANCELED); } else if (resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) { eip_fragment.updateEipService(); - eip_fragment.handleNewVpnCertificate(); setResult(RESULT_OK); } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { setResult(RESULT_CANCELED); @@ -453,4 +452,13 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn intent.putExtra(Dashboard.REQUEST_CODE, requestCode); super.startActivityForResult(intent, requestCode); } + + public void invalidateOptionsMenuOnUiThread() { + runOnUiThread(new Runnable() { + @Override + public void run() { + invalidateOptionsMenu(); + } + }); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index a13cab09..6decacb7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -111,10 +111,6 @@ public class EipFragment extends Fragment implements Observer { saveStatus(); } - void handleNewVpnCertificate() { - handleIcon(); - } - private void handleSwitchOn() { if (canStartEIP()) startEipFromScratch(); @@ -144,20 +140,20 @@ public class EipFragment extends Fragment implements Observer { } else if (eip_status.isConnected()) { askToStopEIP(); } else - setDisconnectedUI(); + updateIcon(); } private void askPendingStartCancellation() { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(dashboard); alertBuilder.setTitle(dashboard.getString(R.string.eip_cancel_connect_title)) .setMessage(dashboard.getString(R.string.eip_cancel_connect_text)) - .setPositiveButton((R.string.yes), new DialogInterface.OnClickListener() { + .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { askToStopEIP(); } }) - .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() { + .setNegativeButton(dashboard.getString(android.R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } @@ -193,13 +189,13 @@ public class EipFragment extends Fragment implements Observer { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(dashboard); alertBuilder.setTitle(dashboard.getString(R.string.eip_cancel_connect_title)) .setMessage(dashboard.getString(R.string.eip_warning_browser_inconsistency)) - .setPositiveButton((R.string.yes), new DialogInterface.OnClickListener() { + .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { stopEipIfPossible(); } }) - .setNegativeButton(dashboard.getString(R.string.no), new DialogInterface.OnClickListener() { + .setNegativeButton(dashboard.getString(android.R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } @@ -247,18 +243,10 @@ public class EipFragment extends Fragment implements Observer { dashboard.showLog(); VoidVpnService.stop(); } - adjustSwitch(); - } - - private void setConnectedUI() { - adjustSwitch(); - } - - private void setDisconnectedUI() { - adjustSwitch(); + updateIcon(); } - private void adjustSwitch() { + private void updateIcon() { if (eip_status.isConnected() || eip_status.isConnecting()) { if(eip_status.isConnecting()) { vpn_status_image.showProgress(true); @@ -273,13 +261,6 @@ public class EipFragment extends Fragment implements Observer { } } - private void setInProgressUI(EipStatus eip_status) { - adjustSwitch(); - } - - private void updatingCertificateUI() { - } - protected class EIPReceiver extends ResultReceiver { protected EIPReceiver(Handler handler) { @@ -320,7 +301,6 @@ public class EipFragment extends Fragment implements Observer { case Activity.RESULT_OK: break; case Activity.RESULT_CANCELED: - updatingCertificateUI(); dashboard.downloadVpnCertificate(); break; } diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 82ca44e9..42b8cce4 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -65,8 +65,6 @@ <string name="eip_cancel_connect_title">¿Abortar conexión?</string> <string name="eip_cancel_connect_text">Hay una conexión iniciándose. ¿Quieres cancelarla?</string> <string name="eip.warning.browser_inconsistency">Para salvaguardar la privacidad de tu información personal, te recomendamos que después de apagar la VPN cierres la sesión del navegador y abras una sesión privada en él. Gracias.</string> - <string name="yes">Sí</string> - <string name="no">No</string> <string name="eip_state_not_connected">"¡Conexión no protegida!"</string> <string name="eip_state_connected">Conexión protegida.</string> <string name="provider_problem">Parece que hay un problema con el proveedor.</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bcfd3a2c..07bc4770 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -63,8 +63,6 @@ <string name="eip_cancel_connect_title">Cancel connection?</string> <string name="eip_cancel_connect_text">There is a connection attempt in progress. Do you wish to cancel it?</string> <string name="eip.warning.browser_inconsistency">In order to avoid leaking your personal information, please close your browser and start a private window after disconnecting the Encrypted VPN Internet Access. Thanks.</string> - <string name="yes">Yes</string> - <string name="no">No</string> <string name="eip_state_not_connected">"Not running! Connection not secure!"</string> <string name="eip_state_connected">Connection Secure.</string> <string name="provider_problem">It seems there is a problem with the provider.</string> diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index 2742e1e9..eed9413b 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -193,8 +193,6 @@ public class ConfigurationWizard extends Activity mProgressBar.incrementProgressBy(1); hideProgressBar(); - setResult(RESULT_OK); - showProviderDetails(); } } else if (resultCode == ProviderAPI.PROVIDER_NOK) { @@ -211,8 +209,6 @@ public class ConfigurationWizard extends Activity hideProgressBar(); showProviderDetails(); - - setResult(RESULT_OK); } else if (resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { hideProgressBar(); |