diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-23 00:00:19 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-23 00:09:18 +0200 |
commit | 558cc6befca479d33c20ca58f426bda486b5ee8f (patch) | |
tree | 11b1add5d551547d06a7b00c08b43fdb93f218df /OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui | |
parent | 4826e0a8c89e43401a3188d7a4d51cdbfd64c37a (diff) | |
download | open-keychain-558cc6befca479d33c20ca58f426bda486b5ee8f.tar.gz open-keychain-558cc6befca479d33c20ca58f426bda486b5ee8f.tar.bz2 open-keychain-558cc6befca479d33c20ca58f426bda486b5ee8f.zip |
instrument: adapt to new decrypt file dialog, and some minor fixes
Diffstat (limited to 'OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui')
2 files changed, 28 insertions, 5 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 ad9d52ef9..cfeb04328 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java @@ -52,7 +52,6 @@ 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.intent.matcher.IntentMatchers.hasAction; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasCategories; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra; @@ -140,8 +139,6 @@ public class AsymmetricFileOperationTests { handleOpenFileIntentKitKat(outputFile); onView(withId(R.id.decrypt_files)).perform(click()); - onView(withId(R.id.decrypt_files_action_decrypt)).perform(click()); - { // decrypt onView(withId(R.id.passphrase_passphrase)).perform(typeText("x")); onView(withText(R.string.btn_unlock)).perform(click()); diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscFileOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscFileOperationTests.java index bdd96b0f0..b519ed445 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscFileOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/MiscFileOperationTests.java @@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.TestHelpers; import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; import org.sufficientlysecure.keychain.service.PassphraseCacheService; +import org.sufficientlysecure.keychain.ui.util.Notify.Style; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; @@ -51,6 +52,7 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.hasItem; +import static org.sufficientlysecure.keychain.TestHelpers.checkSnackbar; import static org.sufficientlysecure.keychain.TestHelpers.getImageNames; import static org.sufficientlysecure.keychain.TestHelpers.importKeysFromResource; import static org.sufficientlysecure.keychain.TestHelpers.pickRandom; @@ -97,8 +99,6 @@ public class MiscFileOperationTests { handleOpenFileIntentKitKat(file); onView(withId(R.id.decrypt_files)).perform(click()); - onView(withId(R.id.decrypt_files_action_decrypt)).perform(click()); - { // decrypt // open context menu @@ -113,6 +113,17 @@ public class MiscFileOperationTests { } @Test + public void testDecryptEmptySelection() throws Exception { + + // decrypt any non-pgp file + handleOpenFileEmptyKitKat(); + onView(withId(R.id.decrypt_files)).perform(click()); + + checkSnackbar(Style.ERROR, R.string.no_file_selected); + + } + + @Test public void testDecryptNonPgpClipboard() throws Exception { // decrypt any non-pgp file @@ -135,6 +146,21 @@ public class MiscFileOperationTests { @TargetApi(VERSION_CODES.KITKAT) + private void handleOpenFileEmptyKitKat() { + Intent data = new Intent(); + data.setData(null); + + Intents.intending(allOf( + hasAction(Intent.ACTION_OPEN_DOCUMENT), + hasType("*/*"), + hasCategories(hasItem(Intent.CATEGORY_OPENABLE)) + // hasExtraWithKey(Intent.EXTRA_ALLOW_MULTIPLE) + )).respondWith( + new ActivityResult(Activity.RESULT_OK, data) + ); + } + + @TargetApi(VERSION_CODES.KITKAT) private void handleOpenFileIntentKitKat(File file) { Intent data = new Intent(); data.setData(Uri.fromFile(file)); |