use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.
the class TCTokenHandler method killUserConsent.
public static void killUserConsent() {
// kill any open dialog
DynamicContext ctx = DynamicContext.getInstance(TR03112Keys.INSTANCE_KEY);
Object navObj = ctx.get(TR03112Keys.OPEN_USER_CONSENT_NAVIGATOR);
if (navObj instanceof UserConsentNavigator) {
UserConsentNavigator nav = (UserConsentNavigator) navObj;
nav.close();
}
}
use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.
the class EacNavigatorFactoryTest method testGivenCorrectValuesThenCreateFromShouldBeCorrect.
@Test
public void testGivenCorrectValuesThenCreateFromShouldBeCorrect() {
final List<Step> expectedSteps = createInitialSteps();
new Expectations() {
{
ucd.getDialogType();
result = "EAC";
ucd.getSteps();
result = expectedSteps;
}
};
EacNavigatorFactory sut = new EacNavigatorFactory();
final UserConsentNavigator result = sut.createFrom(ucd);
assertNotNull(result);
assertTrue(result.hasNext());
}
use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.
the class PinEntryDialog method show.
public ResultStatus show() throws CryptokiException {
UserConsentNavigator ucr = gui.obtainNavigator(createUserConsentDescription());
ExecutionEngine exec = new ExecutionEngine(ucr);
ResultStatus result = exec.process();
return result;
}
use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.
the class InsertCardDialog method show.
/**
* Shows this InsertCardDialog dialog.
*
* @return The ConnectionHandle of the inserted card or null if no card was inserted.
*/
public List<ConnectionHandleType> show() {
List<ConnectionHandleType> availableCards = checkAlreadyAvailable();
if (!availableCards.isEmpty()) {
return availableCards;
} else {
InsertCardStepAction insertCardAction = new InsertCardStepAction(STEP_ID, cardStates, cardNameAndType.values());
evDispatcher.add(insertCardAction, EventType.CARD_RECOGNIZED);
UserConsentNavigator ucr = gui.obtainNavigator(createInsertCardUserConsent(insertCardAction));
ExecutionEngine exec = new ExecutionEngine(ucr);
// run gui
ResultStatus status = exec.process();
if (status == ResultStatus.CANCEL) {
return null;
}
evDispatcher.del(insertCardAction);
return insertCardAction.getResponse();
}
}
use of org.openecard.gui.UserConsentNavigator in project open-ecard by ecsec.
the class InstantReturnTest method testInstantReturn.
// TODO: make Selenium test which really proves, that the GUI works correctly
/**
* Test if the GUI closes itself after executing an action with instantreturn set.
* There is no way to determine whether the GUI is displayed at all. This check must be part of a Selenium test.
*/
@Test(enabled = true)
public void testInstantReturn() {
// create wait action
WaitAction action = new WaitAction("step1", DIFF_TIME);
// create GUI
UserConsentNavigator nav = createNavigator(action);
ExecutionEngine exec = new ExecutionEngine(nav);
exec.process();
// eliminate most of the GUI overhead by retrieving start time from action
long startTime = action.getStartTime();
long stopTime = System.currentTimeMillis();
long act = stopTime - startTime;
long diff = act - DIFF_TIME;
String msg = "Display time of dialog differs " + diff + "ms from reference value (" + VARIANCE + "ms allowed).";
assertTrue(diff <= VARIANCE, msg);
}
Aggregations