@Test public void textPlainWithAutocrypt_withOpenPgpApi() throws Exception { setUpWithOpenPgpApi(); MimeMessage message = new MimeMessage(); message.setUid("msguid"); message.setHeader("Content-Type", "text/plain"); when(autocryptOperations.hasAutocryptHeader(message)).thenReturn(true); when(autocryptOperations.addAutocryptPeerUpdateToIntentIfPresent(same(message), any(Intent.class))).thenReturn(true); MessageCryptoCallback messageCryptoCallback = mock(MessageCryptoCallback.class); messageCryptoHelper.asyncStartOrResumeProcessingMessage(message, messageCryptoCallback, null, null, false); ArgumentCaptor<MessageCryptoAnnotations> captor = ArgumentCaptor.forClass(MessageCryptoAnnotations.class); verify(messageCryptoCallback).onCryptoOperationsFinished(captor.capture()); MessageCryptoAnnotations annotations = captor.getValue(); assertTrue(annotations.isEmpty()); verifyNoMoreInteractions(messageCryptoCallback); ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(same(message), intentCaptor.capture()); verify(openPgpApi).executeApiAsync(same(intentCaptor.getValue()), same((InputStream) null), same((OutputStream) null), any(IOpenPgpCallback.class)); }
public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly) { if (this.currentMessage != null) { reattachCallback(message, callback); return; } this.messageAnnotations = new MessageCryptoAnnotations(); this.state = State.START; this.currentMessage = message; this.cachedOpenPgpDecryptionResult = cachedOpenPgpDecryptionResult; this.cachedSMimeDecryptionResult = cachedSMimeDecryptionResult; this.callback = callback; this.processSignedOnly = processSignedOnly; nextStep(); }
MessageCryptoHelper { public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly) { if (this.currentMessage != null) { reattachCallback(message, callback); return; } this.messageAnnotations = new MessageCryptoAnnotations(); this.state = State.START; this.currentMessage = message; this.cachedOpenPgpDecryptionResult = cachedOpenPgpDecryptionResult; this.cachedSMimeDecryptionResult = cachedSMimeDecryptionResult; this.callback = callback; this.processSignedOnly = processSignedOnly; nextStep(); } }
MessageCryptoHelper { public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly) { if (this.currentMessage != null) { reattachCallback(message, callback); return; } this.messageAnnotations = new MessageCryptoAnnotations(); this.state = State.START; this.currentMessage = message; this.cachedOpenPgpDecryptionResult = cachedOpenPgpDecryptionResult; this.cachedSMimeDecryptionResult = cachedSMimeDecryptionResult; this.callback = callback; this.processSignedOnly = processSignedOnly; nextStep(); } MessageCryptoHelper(Context context, OpenPgpApiFactory openPgpApiFactory, SMimeApiFactory sMimeApiFactory,
            AutocryptOperations autocryptOperations); }
MessageCryptoHelper { public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly) { if (this.currentMessage != null) { reattachCallback(message, callback); return; } this.messageAnnotations = new MessageCryptoAnnotations(); this.state = State.START; this.currentMessage = message; this.cachedOpenPgpDecryptionResult = cachedOpenPgpDecryptionResult; this.cachedSMimeDecryptionResult = cachedSMimeDecryptionResult; this.callback = callback; this.processSignedOnly = processSignedOnly; nextStep(); } MessageCryptoHelper(Context context, OpenPgpApiFactory openPgpApiFactory, SMimeApiFactory sMimeApiFactory,
            AutocryptOperations autocryptOperations); boolean isConfiguredForOutdatedCryptoProvider(); boolean isConfiguredForOutdatedOpenPgpProvider(); boolean isConfiguredForOutdatedSMimeProvider(); void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback,
            OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly); void cancelIfRunning(); void onActivityResult(int requestCode, int resultCode, Intent data); void detachCallback(); }
MessageCryptoHelper { public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly) { if (this.currentMessage != null) { reattachCallback(message, callback); return; } this.messageAnnotations = new MessageCryptoAnnotations(); this.state = State.START; this.currentMessage = message; this.cachedOpenPgpDecryptionResult = cachedOpenPgpDecryptionResult; this.cachedSMimeDecryptionResult = cachedSMimeDecryptionResult; this.callback = callback; this.processSignedOnly = processSignedOnly; nextStep(); } MessageCryptoHelper(Context context, OpenPgpApiFactory openPgpApiFactory, SMimeApiFactory sMimeApiFactory,
            AutocryptOperations autocryptOperations); boolean isConfiguredForOutdatedCryptoProvider(); boolean isConfiguredForOutdatedOpenPgpProvider(); boolean isConfiguredForOutdatedSMimeProvider(); void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback,
            OpenPgpDecryptionResult cachedOpenPgpDecryptionResult, SMimeDecryptionResult cachedSMimeDecryptionResult, boolean processSignedOnly); void cancelIfRunning(); void onActivityResult(int requestCode, int resultCode, Intent data); void detachCallback();  }