aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/androidTest/java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/androidTest/java')
-rw-r--r--OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java2
-rw-r--r--OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java33
-rw-r--r--OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java15
3 files changed, 22 insertions, 28 deletions
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java
index 20ee6a8b1..5570b627f 100644
--- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java
+++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java
@@ -184,7 +184,7 @@ public class AsymmetricFileOperationTests {
handleSaveDecryptedFileIntent(savedFile, file.getName());
// save decrypted content
- onView(withText(R.string.btn_save)).perform(click());
+ onView(withText(R.string.btn_save_file)).perform(click());
checkSnackbar(Style.OK, R.string.file_saved);
assertThat("decrypted file has been saved", true, is(savedFile.exists()));
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java
index 6b226142c..cb3d2cb17 100644
--- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java
+++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java
@@ -32,15 +32,14 @@ import org.junit.runner.RunWith;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
+import org.sufficientlysecure.keychain.util.FileHelper;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
-import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.contrib.DrawerActions.openDrawer;
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
@@ -115,33 +114,13 @@ public class AsymmetricTextOperationTests {
onView(withId(R.id.passphrase_passphrase)).perform(typeText("x"));
onView(withText(R.string.btn_unlock)).perform(click());
-
onView(isRecyclerItemView(R.id.decrypted_files_list,
hasDescendant(withText(R.string.filename_unknown_text))))
- .check(matches(allOf(withEncryptionStatus(true), withSignatureNone())));
-
- }
-
- }
-
- @Test
- public void testTextEncryptDecryptFromKeyView() throws Exception {
-
- String cleartext = randomString(10, 30);
-
- pressBack();
-
- { // encrypt
-
- // navigate to edit key dialog
- onData(withKeyItemId(0x9D604D2F310716A3L))
- .inAdapterView(allOf(isAssignableFrom(AdapterView.class),
- isDescendantOfA(withId(R.id.key_list_list))))
- .perform(click());
- onView(withId(R.id.view_key_action_encrypt_text)).perform(click());
-
- // make sure the encrypt is correctly set
- onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1)));
+ .check(matches(allOf(
+ hasDescendant(withText(FileHelper.readableFileSize(cleartext.length()))),
+ withEncryptionStatus(true),
+ withSignatureNone()
+ )));
}
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java
index 96d69e833..7b4506986 100644
--- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java
+++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscCryptOperationTests.java
@@ -23,6 +23,9 @@ import java.io.File;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Instrumentation.ActivityResult;
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build.VERSION_CODES;
@@ -144,6 +147,18 @@ public class MiscCryptOperationTests {
}
@Test
+ public void testDecryptEmptyClipboard() throws Exception {
+
+ // decrypt any non-pgp file
+ ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
+ clipboard.setPrimaryClip(ClipData.newPlainText("", ""));
+
+ onView(withId(R.id.decrypt_from_clipboard)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.error_clipboard_empty);
+
+ }
+
+ @Test
public void testDecryptNonPgpClipboard() throws Exception {
// decrypt any non-pgp file