summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml37
-rwxr-xr-x.gitlab/wait-for-emulator.sh44
-rw-r--r--README.md33
-rw-r--r--app/build.gradle52
-rw-r--r--app/src/androidTest/assets/riseup.net.json37
-rw-r--r--app/src/androidTest/assets/riseup.net.pem32
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java127
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java81
-rw-r--r--app/src/androidTest/legacy/BaseTestDashboardFragment.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java)0
-rw-r--r--app/src/androidTest/legacy/ConnectionManager.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/ConnectionManager.java)0
-rw-r--r--app/src/androidTest/legacy/FromAssets.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/FromAssets.java)0
-rw-r--r--app/src/androidTest/legacy/Screenshot.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java)0
-rw-r--r--app/src/androidTest/legacy/TestCalendarProvider.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestCalendarProvider.java)0
-rw-r--r--app/src/androidTest/legacy/TestConstants.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestConstants.java)0
-rw-r--r--app/src/androidTest/legacy/TestDashboardIntegration.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestDashboardIntegration.java)0
-rw-r--r--app/src/androidTest/legacy/TestEipFragment.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestEipFragment.java)0
-rw-r--r--app/src/androidTest/legacy/TestGatewaysManager.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java)0
-rw-r--r--app/src/androidTest/legacy/TestLeapSRPSession.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestLeapSRPSession.java)0
-rw-r--r--app/src/androidTest/legacy/TestProviderListActivity.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java)0
-rw-r--r--app/src/androidTest/legacy/TestUserStatusFragment.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java)0
-rw-r--r--app/src/androidTest/legacy/TestVpnCertificateValidator.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/TestVpnCertificateValidator.java)0
-rw-r--r--app/src/androidTest/legacy/UserStatusTestController.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java)0
-rw-r--r--app/src/androidTest/legacy/VpnTestController.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java)1
-rw-r--r--app/src/main/res/layout-sw600dp-port/f_log.xml29
-rw-r--r--app/src/main/res/layout-sw600dp/f_log.xml6
-rw-r--r--app/src/main/res/layout-xlarge/about.xml2
-rw-r--r--app/src/main/res/layout-xlarge/eip_service_fragment.xml4
-rw-r--r--app/src/main/res/layout/about.xml2
-rw-r--r--app/src/main/res/layout/drawer_main.xml5
-rw-r--r--app/src/main/res/layout/eip_service_fragment.xml5
-rw-r--r--app/src/main/res/layout/f_log.xml4
-rw-r--r--app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java43
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java4
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java16
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java (renamed from app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java)42
-rw-r--r--docker/android-emulator/Dockerfile7
-rw-r--r--docker/android-sdk/Dockerfile7
37 files changed, 430 insertions, 190 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0edd09a9..fdcc6594 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,6 +57,43 @@ unit_test:
script:
- ./gradlew test
+ui_test:
+ image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
+ stage: test
+ script:
+ - emulator -avd testApi27 -no-audio -no-window &
+ - .gitlab/wait-for-emulator.sh
+ - adb devices
+ - adb shell settings put global window_animation_scale 0 &
+ - adb shell settings put global transition_animation_scale 0 &
+ - adb shell settings put global animator_duration_scale 0 &
+ - adb shell input keyevent 82 &
+ - ./gradlew connectedAndroidTest
+ - adb -s testApi27 emu kill
+
+expanded_test:
+ image: "0xacab.org:4567/leap/bitmask_android/android-emulator:latest"
+ stage: test
+ script:
+ - emulator -avd testApi27 -no-audio -no-window &
+ - .gitlab/wait-for-emulator.sh
+ - adb devices
+ - adb shell settings put global window_animation_scale 0 &
+ - adb shell settings put global transition_animation_scale 0 &
+ - adb shell settings put global animator_duration_scale 0 &
+ - adb shell input keyevent 82 &
+ - ./gradlew connectedAndroidTest
+ - ./gradlew createProductionDebugCoverageReport
+ - adb -s testApi27 emu kill
+ - ./gradlew test
+ artifacts:
+ expire_in: 3 days
+ paths:
+ - app/build/reports/androidTests/connected/
+ - app/build/reports/coverage/production/
+ - app/build/tests/
+ when: manual
+
build:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
diff --git a/.gitlab/wait-for-emulator.sh b/.gitlab/wait-for-emulator.sh
new file mode 100755
index 00000000..cd51428a
--- /dev/null
+++ b/.gitlab/wait-for-emulator.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# from https://gitlab.com/fdroid/fdroidclient
+
+sec=0
+timeout=360
+
+err() {
+ echo "$@"
+ exit 1
+}
+
+explain() {
+ if [[ "$1" =~ "not found" ]]; then
+ printf "device not found"
+ elif [[ "$1" =~ "offline" ]]; then
+ printf "device offline"
+ elif [[ "$1" =~ "running" ]]; then
+ printf "booting"
+ else
+ printf "$1"
+ fi
+}
+
+while true; do
+ if [[ $sec -ge $timeout ]]; then
+ err "Timeout ($timeout seconds) reached - Failed to start emulator"
+ fi
+ out=$(adb -e shell getprop init.svc.bootanim 2>&1 | grep -v '^\*')
+ if [[ "$out" =~ "command not found" ]]; then
+ err "$out"
+ fi
+ if [[ "$out" =~ "stopped" ]]; then
+ break
+ fi
+ let "r = sec % 5"
+ if [[ $r -eq 0 ]]; then
+ echo "Waiting for emulator to start: $(explain "$out")"
+ fi
+ sleep 1
+ let "sec++"
+done
+
+echo "Emulator is ready"
diff --git a/README.md b/README.md
index 0f2fc20d..6780e462 100644
--- a/README.md
+++ b/README.md
@@ -48,16 +48,16 @@ The Bitmask Android Client has the following system-level dependencies:
* JDK v. 1.8
* Assorted 32-bit C libraries
-* Android SDK Tools, v. 26.0.0, with these packages:
- * Platform-Tools, v. 26.0.0
- * Build-Tools, API v. 23-26
- * Platforms 23-26
+* Android SDK Tools, v. 27.0.3, with these packages:
+ * Platform-Tools, v. 27.0.3
+ * Build-Tools, API v. 23-27
+ * Platforms 23-27
* Android Support Repository
* Google Support Repository
* NDK v. r15c (enables C code in Android)
* For running the app in an emulator, you will also need these packages:
* Android Emulator
- * System Images for Android APIs 23-26
+ * System Images for Android APIs 23-27
* The ICS-OpenVpn submodule
You can install them as follows:
@@ -92,7 +92,7 @@ Once you've got it installed, use the `SDK Manager` tool (Android figure Icon wi
#### With Bash <a name="with-bash"></a>
-Alternatley (eg: for build machines), you may download and unzip the `android-sdk` bundle from Google as follows (assuming an install location of `/opt/android-sdk-linux`:
+Alternatively (eg: for build machines), you may download and unzip the `android-sdk` bundle from Google as follows (assuming an install location of `/opt/android-sdk-linux`:
```
curl -L https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -o sdk-tools.zip \
@@ -129,13 +129,11 @@ sdkmanager tools
sdkmanager platform-tools
sdkmanager extras;android;m2repository
sdkmanager extras;google;m2repository
-sdkmanager build-tools;26.0.0
+sdkmanager build-tools;27.0.3
sdkmanager build-tools;25.0.2
-sdkmanager build-tools;24.0.3
sdkmanager build-tools;23.0.3
-sdkmanager platforms;android-26
+sdkmanager platforms;android-27
sdkmanager platforms;android-25
-sdkmanager platforms;android-24
sdkmanager platforms;android-23
```
@@ -250,18 +248,11 @@ $ sudo docker run --rm -it -v `pwd`:/bitmask_android 0xacab.org:4567/leap/bitmas
To run the automated tests:
- 1. Run an emulator (device doesn't necesarily has root, so testVpnCertificateValidator.testIsValid may fail).
+ 1. Run an emulator
2. Unlock Android
3. Issue the command ./gradlew connectedCheck
4. Pay attention and check the "Trust this app" checkbox, if you don't do so tests won't run.
-Due to the nature of some tests, adb will lose its connectivity and you won't receive any tests results. To look for failed tests, do the following:
-
- 1. adb kill-server
- 2. adb logcat | less
- 3. Look for: "failed: test"
-
-We'll polish this process soon, but right now that's what we're doing.
## Debugging in an Emulator <a name="debugging-in-an-emulator"></a>
@@ -285,9 +276,9 @@ To run the app:
* Ensure you have an emulator running
* Open the left-hand project pane (Meta-1 or Cmd-1, depending on your keybindings)
-* Navigate to `bitmask_android/app/src/main/java/se/leap/bitmaskclient/Dashboard`
-* Right-click over the `Dashboard` filename and click the `Run 'Dashboard'` option (or use Shift-Ctl-F10 or Shift-Ctl-R, depending on your keybindings)
-* After you have done this once, you should be able to simply select `Dashboard` from the dropdown menu next to the big green arrow in the toolbar, then click the green arrow to run the app.
+* Navigate to `bitmask_android/app/src/main/java/se/leap/bitmaskclient/StartActivity`
+* Right-click over the `StartActivity` filename and click the `Run 'StartActivity'` option (or use Shift-Ctl-F10 or Shift-Ctl-R, depending on your keybindings)
+* After you have done this once, you should be able to simply select `StartActivity` from the dropdown menu next to the big green arrow in the toolbar, then click the green arrow to run the app.
### From the Shell <a name="from-the-shell"></a>
diff --git a/app/build.gradle b/app/build.gradle
index 759871fb..9eca4753 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -4,13 +4,18 @@ import java.util.regex.Pattern
apply plugin: 'com.android.application'
android {
- compileSdkVersion 26
- buildToolsVersion '26.0.0'
+ compileSdkVersion 27
+ buildToolsVersion '27.0.3'
defaultConfig {
applicationId "se.leap.bitmaskclient"
resValue "string", "app_name", "Bitmask"
vectorDrawables.useSupportLibrary = true
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ dexOptions {
+ jumboMode true
+ multiDexEnabled true
+ }
}
signingConfigs {
@@ -52,6 +57,9 @@ android {
applicationIdSuffix ".beta"
resValue "string", "app_name", "Bitmask Beta"
}
+ debug {
+ testCoverageEnabled = true
+ }
}
lintOptions {
@@ -67,23 +75,32 @@ android {
debug {
assets.srcDirs = ['src/debug/assets']
}
+
test {
resources.srcDirs += ['src/test/resources']
+ java.srcDirs += ['src/sharedTest/java']
+ }
+
+ androidTest {
+ java.srcDirs += ['src/sharedTest/java']
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
- testCompile 'org.mockito:mockito-core:2.8.0'
- testCompile 'org.powermock:powermock-api-mockito2:1.7.3'
+ testCompile 'org.mockito:mockito-core:2.8.9'
+ testCompile('org.powermock:powermock-api-mockito2:1.7.3')
+ { exclude group: 'junit' exclude group: 'org.mockito' }
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
testCompile 'org.powermock:powermock-core:1.7.3'
testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3'
- //testCompile 'com.madgag.spongycastle:bctls-jdk15on:1.58.0.0'
- //testCompile 'com.madgag.spongycastle:bcpkix-jdk15on:1.58.0.0'
- //testCompile 'com.madgag.spongycastle:bcpg-jdk15on:1.58.0.0'
+ androidTestCompile 'org.mockito:mockito-core:2.8.9'
+ androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
+ androidTestCompile 'com.android.support.test.espresso:espresso-contrib:3.0.1'
+ androidTestCompile 'com.android.support.test.espresso:espresso-intents:3.0.1'
+ //TODO: remove that library
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.3'
testCompile 'junit:junit:4.12'
testCompile 'org.json:json:20170516'
@@ -93,19 +110,22 @@ dependencies {
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.jakewharton:butterknife:6.1.0'
+ //TODO: replace that library
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
+ //TODO: remove that library?
compile 'com.github.pedrovgs:renderers:1.5'
compile 'com.intellij:annotations:12.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
+ //TODO: remove that library
compile 'mbanje.kurt:fabbutton:1.1.4'
- compile "com.android.support:support-core-utils:26.1.0"
+ compile "com.android.support:support-core-utils:27.0.2"
compile 'com.android.support:support-annotations:27.0.2'
- compile 'com.android.support:support-v4:26.1.0'
- compile 'com.android.support:appcompat-v7:26.1.0'
- compile 'com.android.support:design:26.1.0'
- compile 'com.android.support:support-fragment:26.1.0'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ compile 'com.android.support:support-v4:27.0.2'
+ compile 'com.android.support:appcompat-v7:27.0.2'
+ compile 'com.android.support:design:27.0.2'
+ compile 'com.android.support:support-fragment:27.0.2'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
// Ensure the no-op dependency is always used in JVM tests.
@@ -117,6 +137,12 @@ configurations.all { config ->
}
}
}
+ resolutionStrategy.force "com.android.support:support-annotations:27.0.2"
+ resolutionStrategy.force "com.android.support:support-v4:27.0.2"
+ resolutionStrategy.force "ccom.android.support:support-core-utils:27.0.2"
+ resolutionStrategy.force "com.android.support:appcompat-v7:27.0.2"
+ resolutionStrategy.force "com.android.support:design:27.0.2"
+ resolutionStrategy.force "com.android.support:support-fragment:27.0.2"
}
def processFileInplace(file, Closure processText) {
diff --git a/app/src/androidTest/assets/riseup.net.json b/app/src/androidTest/assets/riseup.net.json
new file mode 100644
index 00000000..9a5ec79e
--- /dev/null
+++ b/app/src/androidTest/assets/riseup.net.json
@@ -0,0 +1,37 @@
+{
+ "api_uri": "https://api.black.riseup.net:443",
+ "api_version": "1",
+ "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494",
+ "ca_cert_uri": "https://black.riseup.net/ca.crt",
+ "default_language": "en",
+ "description": {
+ "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change."
+ },
+ "domain": "riseup.net",
+ "enrollment_policy": "open",
+ "languages": [
+ "en"
+ ],
+ "name": {
+ "en": "Riseup Networks"
+ },
+ "service": {
+ "allow_anonymous": false,
+ "allow_free": true,
+ "allow_limited_bandwidth": false,
+ "allow_paid": false,
+ "allow_registration": true,
+ "allow_unlimited_bandwidth": true,
+ "bandwidth_limit": 102400,
+ "default_service_level": 1,
+ "levels": {
+ "1": {
+ "description": "Please donate.",
+ "name": "free"
+ }
+ }
+ },
+ "services": [
+ "openvpn"
+ ]
+} \ No newline at end of file
diff --git a/app/src/androidTest/assets/riseup.net.pem b/app/src/androidTest/assets/riseup.net.pem
new file mode 100644
index 00000000..c890aff4
--- /dev/null
+++ b/app/src/androidTest/assets/riseup.net.pem
@@ -0,0 +1,32 @@
+-----BEGIN CERTIFICATE-----
+MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl
+dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE
+AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw
+NDI4MDAwMDAwWjBZMRgwFgYDVQQKDA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsM
+Emh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UEAwwXUmlzZXVwIE5ldHdvcmtzIFJv
+b3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC76J4ciMJ8Sg0m
+TP7DF2DT9zNe0Csk4myoMFC57rfJeqsAlJCv1XMzBmXrw8wq/9z7XHv6n/0sWU7a
+7cF2hLR33ktjwODlx7vorU39/lXLndo492ZBhXQtG1INMShyv+nlmzO6GT7ESfNE
+LliFitEzwIegpMqxCIHXFuobGSCWF4N0qLHkq/SYUMoOJ96O3hmPSl1kFDRMtWXY
+iw1SEKjUvpyDJpVs3NGxeLCaA7bAWhDY5s5Yb2fA1o8ICAqhowurowJpW7n5ZuLK
+5VNTlNy6nZpkjt1QycYvNycffyPOFm/Q/RKDlvnorJIrihPkyniV3YY5cGgP+Qkx
+HUOT0uLA6LHtzfiyaOqkXwc4b0ZcQD5Vbf6Prd20Ppt6ei0zazkUPwxld3hgyw58
+m/4UIjG3PInWTNf293GngK2Bnz8Qx9e/6TueMSAn/3JBLem56E0WtmbLVjvko+LF
+PM5xA+m0BmuSJtrD1MUCXMhqYTtiOvgLBlUm5zkNxALzG+cXB28k6XikXt6MRG7q
+hzIPG38zwkooM55yy5i1YfcIi5NjMH6A+t4IJxxwb67MSb6UFOwg5kFokdONZcwj
+shczHdG9gLKSBIvrKa03Nd3W2dF9hMbRu//STcQxOailDBQCnXXfAATj9pYzdY4k
+ha8VCAREGAKTDAex9oXf1yRuktES4QIDAQABo2AwXjAdBgNVHQ4EFgQUC4tdmLVu
+f9hwfK4AGliaet5KkcgwDgYDVR0PAQH/BAQDAgIEMAwGA1UdEwQFMAMBAf8wHwYD
+VR0jBBgwFoAUC4tdmLVuf9hwfK4AGliaet5KkcgwDQYJKoZIhvcNAQENBQADggIB
+AGzL+GRnYu99zFoy0bXJKOGCF5XUXP/3gIXPRDqQf5g7Cu/jYMID9dB3No4Zmf7v
+qHjiSXiS8jx1j/6/Luk6PpFbT7QYm4QLs1f4BlfZOti2KE8r7KRDPIecUsUXW6P/
+3GJAVYH/+7OjA39za9AieM7+H5BELGccGrM5wfl7JeEz8in+V2ZWDzHQO4hMkiTQ
+4ZckuaL201F68YpiItBNnJ9N5nHr1MRiGyApHmLXY/wvlrOpclh95qn+lG6/2jk7
+3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch
+Td5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf
+Xu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg
+tsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF
+tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ
+UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp
+0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO
+-----END CERTIFICATE----- \ No newline at end of file
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java
new file mode 100644
index 00000000..c7c6a86f
--- /dev/null
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java
@@ -0,0 +1,127 @@
+package se.leap.bitmaskclient.test;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.espresso.contrib.DrawerActions;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+
+import se.leap.bitmaskclient.MainActivity;
+import se.leap.bitmaskclient.Provider;
+import se.leap.bitmaskclient.testutils.TestSetupHelper;
+
+import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static android.support.test.espresso.Espresso.onData;
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.contrib.DrawerMatchers.isClosed;
+import static android.support.test.espresso.contrib.DrawerMatchers.isOpen;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static org.hamcrest.Matchers.anything;
+import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
+import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT;
+import static se.leap.bitmaskclient.R.id.aboutLayout;
+import static se.leap.bitmaskclient.R.id.accountList;
+import static se.leap.bitmaskclient.R.id.configuration_wizard_layout;
+import static se.leap.bitmaskclient.R.id.drawer_layout;
+import static se.leap.bitmaskclient.R.id.eipServiceFragment;
+import static se.leap.bitmaskclient.R.id.log_layout;
+import static se.leap.bitmaskclient.R.id.settingsList;
+
+/**
+ * Created by cyberta on 19.01.18.
+ */
+
+@RunWith(AndroidJUnit4.class)
+public class StartActivityDrawerTest {
+
+ Intent intent;
+ SharedPreferences preferences;
+ SharedPreferences.Editor preferencesEditor;
+
+ @Rule
+ public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
+ MainActivity.class,
+ true,
+ false); // Activity is not launched immediately
+
+ @Before
+ public void setUp() throws IOException {
+ intent = new Intent(ACTION_SHOW_VPN_FRAGMENT);
+ Context context = getInstrumentation().getTargetContext();
+
+ preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
+ preferencesEditor = preferences.edit();
+ preferencesEditor.putString(Provider.KEY, TestSetupHelper.getInputAsString(InstrumentationRegistry.getContext().getAssets().open("riseup.net.json")))
+ .putString(Provider.CA_CERT, TestSetupHelper.getInputAsString(InstrumentationRegistry.getContext().getAssets().open("riseup.net.pem")))
+ .commit();
+
+ }
+
+
+ @Test
+ public void testDisplayDrawer_isOpenUntilUserManuallyOpendDrawerOnce() {
+ preferencesEditor.putBoolean("navigation_drawer_learned", false).commit();
+ mActivityRule.launchActivity(intent);
+ onView(withId(drawer_layout)).check(matches(isOpen()));
+ onView(withId(drawer_layout)).perform(DrawerActions.close());
+ mActivityRule.finishActivity();
+
+ mActivityRule.launchActivity(intent);
+ onView(withId(drawer_layout)).check(matches(isOpen()));
+ onView(withId(drawer_layout)).perform(DrawerActions.close());
+ onView(withId(drawer_layout)).perform(DrawerActions.open());
+ mActivityRule.finishActivity();
+
+ mActivityRule.launchActivity(intent);
+ onView(withId(drawer_layout)).check(matches(isClosed()));
+ }
+
+ @Test
+ public void testClickProviderName_closeDrawerAndShowEipFragment() {
+ preferencesEditor.putBoolean("navigation_drawer_learned", false).commit();
+ mActivityRule.launchActivity(intent);
+
+ onData(anything()).inAdapterView(withId(accountList)).atPosition(0).perform(click());
+ onView(withId(drawer_layout)).check(matches(isClosed()));
+ onView(withId(eipServiceFragment)).check(matches(isDisplayed()));
+ }
+
+ @Test
+ public void testClickSwitchProvider_closeDrawerAndShowProviderListView() {
+ preferencesEditor.putBoolean("navigation_drawer_learned", false).commit();
+ mActivityRule.launchActivity(intent);
+
+ onData(anything()).inAdapterView(withId(settingsList)).atPosition(0).perform(click());
+ onView(withId(configuration_wizard_layout)).check(matches(isDisplayed()));
+ }
+
+ @Test
+ public void testClickLog_closeDrawerAndShowLogFragment() {
+ preferencesEditor.putBoolean("navigation_drawer_learned", false).commit();
+ mActivityRule.launchActivity(intent);
+
+ onData(anything()).inAdapterView(withId(settingsList)).atPosition(1).perform(click());
+ onView(withId(log_layout)).check(matches(isDisplayed()));
+ }
+
+ @Test
+ public void testClickAbout_closeDrawerAndShowAboutFragment() {
+ preferencesEditor.putBoolean("navigation_drawer_learned", false).commit();
+ mActivityRule.launchActivity(intent);
+
+ onData(anything()).inAdapterView(withId(settingsList)).atPosition(2).perform(click());
+ onView(withId(aboutLayout)).check(matches(isDisplayed()));
+ }
+}
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java
deleted file mode 100644
index 4c215360..00000000
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEIP.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Copyright (c) 2013, 2014, 2015 LEAP Encryption Access Project and contributers
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package se.leap.bitmaskclient.test;
-
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.test.ServiceTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-
-import se.leap.bitmaskclient.eip.EIP;
-
-import static se.leap.bitmaskclient.Constants.EIP_ACTION_CHECK_CERT_VALIDITY;
-import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE;
-import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
-
-/**
- * @author parmegv
- */
-public class TestEIP extends ServiceTestCase<EIP> {
-
- private Context context;
- private Intent intent;
- private SharedPreferences preferences;
-
- public TestEIP(Class<EIP> activityClass) {
- super(activityClass);
- context = getSystemContext();
- intent = new Intent(context, EIP.class);
- preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @MediumTest
- private void testCheckCertValidity() {
- testEmptyCertificate();
- testExpiredCertificate();
- // Wait for the service to start
- // Check result is OK.
- }
-
- private void testEmptyCertificate() {
- preferences.edit().putString(PROVIDER_VPN_CERTIFICATE, "").apply();
- startService(EIP_ACTION_CHECK_CERT_VALIDITY);
- }
-
- private void testExpiredCertificate() {
- String expired_certificate = "expired certificate";
- preferences.edit().putString(PROVIDER_VPN_CERTIFICATE, expired_certificate).apply();
- startService(EIP_ACTION_CHECK_CERT_VALIDITY);
- }
-
- private void startService(String action) {
- intent.setAction(action);
- startService(intent);
- }
-}
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java b/app/src/androidTest/legacy/BaseTestDashboardFragment.java
index e187d424..e187d424 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java
+++ b/app/src/androidTest/legacy/BaseTestDashboardFragment.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/ConnectionManager.java b/app/src/androidTest/legacy/ConnectionManager.java
index 6fb7d8a9..6fb7d8a9 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/ConnectionManager.java
+++ b/app/src/androidTest/legacy/ConnectionManager.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/FromAssets.java b/app/src/androidTest/legacy/FromAssets.java
index 6a4c1ee2..6a4c1ee2 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/FromAssets.java
+++ b/app/src/androidTest/legacy/FromAssets.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java b/app/src/androidTest/legacy/Screenshot.java
index ade28b73..ade28b73 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java
+++ b/app/src/androidTest/legacy/Screenshot.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestCalendarProvider.java b/app/src/androidTest/legacy/TestCalendarProvider.java
index 82ea8b59..82ea8b59 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestCalendarProvider.java
+++ b/app/src/androidTest/legacy/TestCalendarProvider.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConstants.java b/app/src/androidTest/legacy/TestConstants.java
index 6b4cdfb1..6b4cdfb1 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConstants.java
+++ b/app/src/androidTest/legacy/TestConstants.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestDashboardIntegration.java b/app/src/androidTest/legacy/TestDashboardIntegration.java
index ad2b4a00..ad2b4a00 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestDashboardIntegration.java
+++ b/app/src/androidTest/legacy/TestDashboardIntegration.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEipFragment.java b/app/src/androidTest/legacy/TestEipFragment.java
index 4227f19a..4227f19a 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestEipFragment.java
+++ b/app/src/androidTest/legacy/TestEipFragment.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java b/app/src/androidTest/legacy/TestGatewaysManager.java
index 02c521be..02c521be 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java
+++ b/app/src/androidTest/legacy/TestGatewaysManager.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestLeapSRPSession.java b/app/src/androidTest/legacy/TestLeapSRPSession.java
index 8d0df59b..8d0df59b 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestLeapSRPSession.java
+++ b/app/src/androidTest/legacy/TestLeapSRPSession.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java b/app/src/androidTest/legacy/TestProviderListActivity.java
index 4ab705e7..4ab705e7 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java
+++ b/app/src/androidTest/legacy/TestProviderListActivity.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java b/app/src/androidTest/legacy/TestUserStatusFragment.java
index d77b9796..d77b9796 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java
+++ b/app/src/androidTest/legacy/TestUserStatusFragment.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestVpnCertificateValidator.java b/app/src/androidTest/legacy/TestVpnCertificateValidator.java
index 70596c10..70596c10 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestVpnCertificateValidator.java
+++ b/app/src/androidTest/legacy/TestVpnCertificateValidator.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java b/app/src/androidTest/legacy/UserStatusTestController.java
index 3b0daf9a..3b0daf9a 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
+++ b/app/src/androidTest/legacy/UserStatusTestController.java
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/legacy/VpnTestController.java
index f6760161..4c6a6370 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
+++ b/app/src/androidTest/legacy/VpnTestController.java
@@ -6,6 +6,7 @@ import android.widget.Button;
import com.robotium.solo.Condition;
import com.robotium.solo.Solo;
+import de.blinkt.openvpn.activities.DisconnectVPN;
import mbanje.kurt.fabbutton.ProgressRingView;
import se.leap.bitmaskclient.Dashboard;
import se.leap.bitmaskclient.R;
diff --git a/app/src/main/res/layout-sw600dp-port/f_log.xml b/app/src/main/res/layout-sw600dp-port/f_log.xml
index da46450c..4ee64811 100644
--- a/app/src/main/res/layout-sw600dp-port/f_log.xml
+++ b/app/src/main/res/layout-sw600dp-port/f_log.xml
@@ -5,9 +5,30 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:padding="@dimen/activity_margin">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical"
+ android:padding="@dimen/activity_margin"
+ android:id="@+id/log_layout">
+
+ <LinearLayout
+ android:background="@drawable/white_rect"
+ android:elevation="1dp"
+ android:minWidth="300dp"
+ android:orientation="vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent">
+
+ <include layout="@layout/log_silders"/>
+
+ <include layout="@layout/vpnstatus"/>
+ </LinearLayout>
+
+ <ListView
+ android:id="@android:id/list"
+ android:transcriptMode="normal"
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"/>
</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout-sw600dp/f_log.xml b/app/src/main/res/layout-sw600dp/f_log.xml
index 9ad30208..ec66af07 100644
--- a/app/src/main/res/layout-sw600dp/f_log.xml
+++ b/app/src/main/res/layout-sw600dp/f_log.xml
@@ -5,12 +5,12 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
- android:padding="20dp" >
-
+ android:padding="20dp"
+ android:id="@+id/log_layout"
+ >
<LinearLayout
android:background="@drawable/white_rect"
diff --git a/app/src/main/res/layout-xlarge/about.xml b/app/src/main/res/layout-xlarge/about.xml
index 227da8b0..fdf823a9 100644
--- a/app/src/main/res/layout-xlarge/about.xml
+++ b/app/src/main/res/layout-xlarge/about.xml
@@ -1,6 +1,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/dashboardLayout"
+ android:id="@+id/aboutLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml
index 28ac3b9a..c99d83bc 100644
--- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml
+++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml
@@ -4,7 +4,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
- android:layout_marginStart="20dp">
+ android:layout_marginStart="20dp"
+ android:id="@+id/eipServiceFragment"
+ >
<TextView
android:id="@+id/eipLabel"
diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml
index 62e858cb..e26629ab 100644
--- a/app/src/main/res/layout/about.xml
+++ b/app/src/main/res/layout/about.xml
@@ -1,6 +1,6 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/dashboardLayout"
+ android:id="@+id/aboutLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
diff --git a/app/src/main/res/layout/drawer_main.xml b/app/src/main/res/layout/drawer_main.xml
index 20d826b3..41498617 100644
--- a/app/src/main/res/layout/drawer_main.xml
+++ b/app/src/main/res/layout/drawer_main.xml
@@ -24,12 +24,7 @@
android:id="@+id/mask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerInParent="true"
- android:layout_centerVertical="true"
app:srcCompat="@drawable/mask" />
-
-
</FrameLayout>
<RelativeLayout
diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml
index aa7ba514..497d2c0b 100644
--- a/app/src/main/res/layout/eip_service_fragment.xml
+++ b/app/src/main/res/layout/eip_service_fragment.xml
@@ -2,9 +2,10 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/relativeLayout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:id="@+id/eipServiceFragment"
+ >
<android.support.constraint.Guideline
android:id="@+id/guideline_horizontal_top"
diff --git a/app/src/main/res/layout/f_log.xml b/app/src/main/res/layout/f_log.xml
index 41c72d99..47a80e50 100644
--- a/app/src/main/res/layout/f_log.xml
+++ b/app/src/main/res/layout/f_log.xml
@@ -9,7 +9,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:padding="16dp">
+ android:padding="16dp"
+ android:id="@+id/log_layout"
+ >
<LinearLayout
android:elevation="1dp"
diff --git a/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
new file mode 100644
index 00000000..725924e6
--- /dev/null
+++ b/app/src/sharedTest/java/se.leap.bitmaskclient/testutils/TestSetupHelper.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2018 LEAP Encryption Access Project and contributers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package se.leap.bitmaskclient.testutils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * Created by cyberta on 08.10.17.
+ */
+
+public class TestSetupHelper {
+
+ public static String getInputAsString(InputStream fileAsInputStream) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(fileAsInputStream));
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+ while (line != null) {
+ sb.append(line);
+ line = br.readLine();
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java
index a9a5733d..84f38086 100644
--- a/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/ConfigHelperTest.java
@@ -6,9 +6,9 @@ import org.junit.Before;
import org.junit.Test;
import se.leap.bitmaskclient.testutils.MockSharedPreferences;
-import se.leap.bitmaskclient.testutils.TestSetupHelper;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED;
import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString;
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 f04ec0eb..c23e4f49 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/ProviderApiManagerTest.java
@@ -52,14 +52,14 @@ import static se.leap.bitmaskclient.ProviderAPI.RESULT_KEY;
import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.ERROR_CASE_UPDATED_CERTIFICATE;
import static se.leap.bitmaskclient.testutils.BackendMockResponses.BackendMockProvider.TestBackendErrorCase.NO_ERROR;
import static se.leap.bitmaskclient.testutils.TestSetupHelper.getInputAsString;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockBundle;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockClientGenerator;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockFingerprintForCertificate;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockIntent;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockProviderApiConnector;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockResources;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockResultReceiver;
-import static se.leap.bitmaskclient.testutils.TestSetupHelper.mockTextUtils;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockBundle;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockClientGenerator;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockFingerprintForCertificate;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockIntent;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockProviderApiConnector;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockResources;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockResultReceiver;
+import static se.leap.bitmaskclient.testutils.MockHelper.mockTextUtils;
/**
diff --git a/app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java
index f8f70eaf..8372c9bc 100644
--- a/app/src/test/java/se/leap/bitmaskclient/testutils/TestSetupHelper.java
+++ b/app/src/test/java/se/leap/bitmaskclient/testutils/MockHelper.java
@@ -1,20 +1,3 @@
-/**
- * Copyright (c) 2018 LEAP Encryption Access Project and contributers
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
package se.leap.bitmaskclient.testutils;
import android.content.Intent;
@@ -30,10 +13,8 @@ import org.json.JSONObject;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
@@ -65,25 +46,10 @@ import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
/**
- * Created by cyberta on 08.10.17.
+ * Created by cyberta on 29.01.18.
*/
-public class TestSetupHelper {
-
-
-
- public static String getInputAsString(InputStream fileAsInputStream) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(fileAsInputStream));
- StringBuilder sb = new StringBuilder();
- String line = br.readLine();
- while (line != null) {
- sb.append(line);
- line = br.readLine();
- }
-
- return sb.toString();
- }
-
+public class MockHelper {
@NonNull
public static Bundle mockBundle() {
final Map<String, Boolean> fakeBooleanBundle = new HashMap<>();
@@ -335,7 +301,6 @@ public class TestSetupHelper {
});
}
-
public static ResultReceiver mockResultReceiver(final int expectedResultCode, final Bundle expectedBundle) {
ResultReceiver resultReceiver = mock(ResultReceiver.class);
@@ -395,7 +360,7 @@ public class TestSetupHelper {
public static Resources mockResources(InputStream inputStream) throws IOException, JSONException {
Resources mockedResources = mock(Resources.class, RETURNS_DEEP_STUBS);
- JSONObject errorMessages = new JSONObject(getInputAsString(inputStream));
+ JSONObject errorMessages = new JSONObject(TestSetupHelper.getInputAsString(inputStream));
when(mockedResources.getString(R.string.warning_corrupted_provider_details)).
@@ -430,5 +395,4 @@ public class TestSetupHelper {
thenReturn(errorMessages.getString("warning_expired_provider_cert"));
return mockedResources;
}
-
}
diff --git a/docker/android-emulator/Dockerfile b/docker/android-emulator/Dockerfile
index bececd08..97150799 100644
--- a/docker/android-emulator/Dockerfile
+++ b/docker/android-emulator/Dockerfile
@@ -1,7 +1,7 @@
FROM 0xacab.org:4567/leap/bitmask_android/android-sdk:latest
MAINTAINER LEAP Encryption Access Project <info@leap.se>
-LABEL Description="Android SDK baseimage based on debian:stretch" Vendor="LEAP" Version="25"
+LABEL Description="Android SDK baseimage based on debian:stretch" Vendor="LEAP" Version="26"
# Make sure debconf doesn't complain about lack of interactivity
ENV DEBIAN_FRONTEND noninteractive
@@ -31,7 +31,8 @@ RUN apt-get update -qq && \
RUN echo y | sdkmanager "emulator"
# Install System Images for emulators
-RUN echo y | sdkmanager "system-images;android-26;google_apis;x86"
+RUN echo y | sdkmanager "system-images;android-27;google_apis;x86"
RUN echo y | sdkmanager "system-images;android-25;google_apis;x86_64"
-RUN echo y | sdkmanager "system-images;android-24;google_apis;x86_64"
RUN echo y | sdkmanager "system-images;android-23;google_apis;x86_64"
+
+RUN echo no | avdmanager create avd --force --name testApi27 --abi google_apis/x86 --package 'system-images;android-27;google_apis;x86' \ No newline at end of file
diff --git a/docker/android-sdk/Dockerfile b/docker/android-sdk/Dockerfile
index fbb63aa8..3218d369 100644
--- a/docker/android-sdk/Dockerfile
+++ b/docker/android-sdk/Dockerfile
@@ -59,14 +59,11 @@ RUN echo y | sdkmanager "platform-tools" # echo y to accept google licenses
RUN sdkmanager "extras;android;m2repository"
# Install Build Tools (Please keep in descending order)
-RUN sdkmanager "build-tools;26.0.0"
+RUN sdkmanager "build-tools;27.0.3"
RUN sdkmanager "build-tools;25.0.2"
-RUN sdkmanager "build-tools;25.0.0"
-RUN sdkmanager "build-tools;24.0.3"
RUN sdkmanager "build-tools;23.0.3"
# Install Target SDK Packages (Please keep in descending order)
-RUN sdkmanager "platforms;android-26"
+RUN sdkmanager "platforms;android-27"
RUN sdkmanager "platforms;android-25"
-RUN sdkmanager "platforms;android-24"
RUN sdkmanager "platforms;android-23"