Search in sources :

Example 1 with OtrClient

use of com.waz.api.OtrClient in project wire-android by wireapp.

the class SingleOtrClientFragmentTest method launchFragmentWithParametersAndClickVerify_shouldUpdateOtrClient.

@Test
public void launchFragmentWithParametersAndClickVerify_shouldUpdateOtrClient() {
    User mockUser = mock(User.class);
    OtrClient mockOtrClient = mock(OtrClient.class);
    setupMocksForOtherOtrClient(mockUser, mockOtrClient);
    when(mockOtrClient.getVerified()).thenReturn(Verification.UNVERIFIED);
    attachFragment(SingleOtrClientFragment.newInstance(mockOtrClient, mockUser), SingleOtrClientFragment.TAG);
    onView(otrSwitchWithId(R.id.os__single_otr_client__verify)).perform(click());
    verify(mockOtrClient).setVerified(true);
}
Also used : User(com.waz.api.User) OtrClient(com.waz.api.OtrClient) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Example 2 with OtrClient

use of com.waz.api.OtrClient in project wire-android by wireapp.

the class SingleOtrClientFragmentTest method launchFragmentWithParametersAndClickShowMyFingerprint_shouldCallController.

@Test
public void launchFragmentWithParametersAndClickShowMyFingerprint_shouldCallController() {
    User mockUser = mock(User.class);
    OtrClient mockOtrClient = mock(OtrClient.class);
    setupMocksForOtherOtrClient(mockUser, mockOtrClient);
    when(mockOtrClient.getVerified()).thenReturn(Verification.UNVERIFIED);
    attachFragment(SingleOtrClientFragment.newInstance(mockOtrClient, mockUser), SingleOtrClientFragment.TAG);
    onView(withId(R.id.ttv__single_otr_client__my_fingerprint)).perform(click());
    verify(activity.getControllerFactory().getConversationScreenController()).showCurrentOtrClient();
}
Also used : User(com.waz.api.User) OtrClient(com.waz.api.OtrClient) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Example 3 with OtrClient

use of com.waz.api.OtrClient in project wire-android by wireapp.

the class SingleOtrClientFragmentTest method launchFragmentWithParametersAndClickResetSession_shouldCallOtrClientResetSession.

//@Test
// Pending AN-XXX
public void launchFragmentWithParametersAndClickResetSession_shouldCallOtrClientResetSession() {
    User mockUser = mock(User.class);
    OtrClient mockOtrClient = mock(OtrClient.class);
    setupMocksForOtherOtrClient(mockUser, mockOtrClient);
    when(mockOtrClient.getVerified()).thenReturn(Verification.UNVERIFIED);
    attachFragment(SingleOtrClientFragment.newInstance(mockOtrClient, mockUser), SingleOtrClientFragment.TAG);
    onView(withId(R.id.ttv__single_otr_client__reset)).perform(click());
    verify(mockOtrClient).resetSession(any(OtrClient.ResetCallback.class));
}
Also used : User(com.waz.api.User) OtrClient(com.waz.api.OtrClient)

Example 4 with OtrClient

use of com.waz.api.OtrClient in project wire-android by wireapp.

the class SingleOtrClientFragmentTest method launchFragmentWithParameters_shouldDisplayDisplayNameInText.

@Test
public void launchFragmentWithParameters_shouldDisplayDisplayNameInText() {
    User mockUser = mock(User.class);
    OtrClient mockOtrClient = mock(OtrClient.class);
    setupMocksForOtherOtrClient(mockUser, mockOtrClient);
    attachFragment(SingleOtrClientFragment.newInstance(mockOtrClient, mockUser), SingleOtrClientFragment.TAG);
    String text = activity.getString(R.string.otr__participant__single_device__description, DEFAULT_DISPLAY_NAME);
    onView(withId(R.id.ttv__single_otr_client__description)).check(hasText(text));
}
Also used : User(com.waz.api.User) OtrClient(com.waz.api.OtrClient) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Example 5 with OtrClient

use of com.waz.api.OtrClient in project wire-android by wireapp.

the class DevicesPreferences method updateOtrDevices.

private void updateOtrDevices() {
    PreferenceGroup otherOtrClientPreferenceGroup = (PreferenceGroup) findPreference(getString(R.string.pref_devices_other_devices_category_key));
    if (otherOtrClientPreferenceGroup == null) {
        return;
    }
    otherOtrClientPreferenceGroup.removeAll();
    if (otherClients == null) {
        return;
    }
    for (int i = 0; i < otherClients.size(); i++) {
        OtrClient otrClient = otherClients.get(i);
        addClientToGroup(otrClient, otherOtrClientPreferenceGroup);
    }
    if (otherClients.size() > 0) {
        addDeviceWarning(otherOtrClientPreferenceGroup);
        otherOtrClientPreferenceGroup.setTitle(getString(R.string.pref_devices_other_devices_category_title));
    } else {
        otherOtrClientPreferenceGroup.setTitle("");
    }
}
Also used : PreferenceGroup(android.support.v7.preference.PreferenceGroup) OtrClient(com.waz.api.OtrClient)

Aggregations

OtrClient (com.waz.api.OtrClient)11 User (com.waz.api.User)8 FragmentTest (com.waz.zclient.testutils.FragmentTest)5 Test (org.junit.Test)5 Preference (android.support.v7.preference.Preference)2 PreferenceGroup (android.support.v7.preference.PreferenceGroup)2 PreferenceManager (android.support.v7.preference.PreferenceManager)2 PreferenceScreen (android.support.v7.preference.PreferenceScreen)2 Self (com.waz.api.Self)2 SuppressLint (android.annotation.SuppressLint)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1 View (android.view.View)1 AbsListView (android.widget.AbsListView)1 TextView (android.widget.TextView)1 Fingerprint (com.waz.api.Fingerprint)1 IConversation (com.waz.api.IConversation)1 InitListener (com.waz.api.InitListener)1 Message (com.waz.api.Message)1 Subscriber (com.waz.api.Subscriber)1 ZMessagingApi (com.waz.api.ZMessagingApi)1