diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-22 13:43:52 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-22 13:44:14 +0200 |
commit | 2e8fb9cbddec54660f7a68f45a35f95c5b0abefc (patch) | |
tree | 93d95587958a1ef0a100a64a0b530897e52eef18 /OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java | |
parent | 804a58e779e8bbb5c8c2d53211626dcfd5556ed7 (diff) | |
download | open-keychain-2e8fb9cbddec54660f7a68f45a35f95c5b0abefc.tar.gz open-keychain-2e8fb9cbddec54660f7a68f45a35f95c5b0abefc.tar.bz2 open-keychain-2e8fb9cbddec54660f7a68f45a35f95c5b0abefc.zip |
instrument: restructure some tests, add bad clipboard data test
Diffstat (limited to 'OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java')
-rw-r--r-- | OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java deleted file mode 100644 index 40cdbd4eb..000000000 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptKeyCompletionViewTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2015 Vincent Breitmoser <look@my.amazin.horse> - * - * 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 org.sufficientlysecure.keychain; - - -import android.app.Activity; -import android.content.Intent; -import android.support.test.espresso.action.ViewActions; -import android.support.test.espresso.matcher.RootMatchers; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import android.test.suitebuilder.annotation.LargeTest; -import android.view.KeyEvent; -import android.widget.AdapterView; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.sufficientlysecure.keychain.ui.EncryptTextActivity; - -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.action.ViewActions.typeText; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -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.withId; -import static org.hamcrest.CoreMatchers.allOf; -import static org.sufficientlysecure.keychain.TestHelpers.importKeysFromResource; -import static org.sufficientlysecure.keychain.actions.CustomActions.tokenEncryptViewAddToken; -import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyItemId; -import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyToken; - - -@RunWith(AndroidJUnit4.class) -@LargeTest -public class EncryptKeyCompletionViewTest { - - @Rule - public final ActivityTestRule<EncryptTextActivity> mActivity - = new ActivityTestRule<>(EncryptTextActivity.class); - - @Test - public void testTextEncryptDecryptFromToken() throws Exception { - - Intent intent = new Intent(); - intent.putExtra(EncryptTextActivity.EXTRA_ENCRYPTION_KEY_IDS, new long[] { 0x9D604D2F310716A3L }); - Activity activity = mActivity.launchActivity(intent); - - // import these two, make sure they're there - importKeysFromResource(activity, "x.sec.asc"); - - // check if the element passed in from intent - onView(withId(R.id.recipient_list)).check(matches(withKeyToken(0x9D604D2F310716A3L))); - onView(withId(R.id.recipient_list)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); - - // type X, select from list, check if it's there - onView(withId(R.id.recipient_list)).perform(typeText("x")); - onData(withKeyItemId(0x9D604D2F310716A3L)).inRoot(RootMatchers.isPlatformPopup()) - .inAdapterView(allOf(isAssignableFrom(AdapterView.class), - hasDescendant(withId(R.id.key_list_item_name)))).perform(click()); - onView(withId(R.id.recipient_list)).check(matches(withKeyToken(0x9D604D2F310716A3L))); - onView(withId(R.id.recipient_list)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); - onView(withId(R.id.recipient_list)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); - - // add directly, check if it's there - onView(withId(R.id.recipient_list)).perform(tokenEncryptViewAddToken(0x9D604D2F310716A3L)); - onView(withId(R.id.recipient_list)).check(matches(withKeyToken(0x9D604D2F310716A3L))); - onView(withId(R.id.recipient_list)).perform(ViewActions.pressKey(KeyEvent.KEYCODE_DEL)); - - } - -} |