Commit 682b6b47 authored by Martin Kreichgauer's avatar Martin Kreichgauer Committed by Commit Bot

settings UI: fix security key biometric enrollment cancel button disable state

Fix a typo when setting the property to control whether the dialog's cancel
button should be disabled. This lead to the cancel button being disabled in
certain states where it should have been enabled instead.

Bug: 974046
Change-Id: I1ad70ce61e68f45d1998b9837b02137256c2d2aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900571
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Auto-Submit: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714665}
parent 5b9b3f3e
...@@ -132,13 +132,13 @@ Polymer({ ...@@ -132,13 +132,13 @@ Polymer({
switch (this.dialogPage_) { switch (this.dialogPage_) {
case 'initial': case 'initial':
this.cancelButtonVisible_ = true; this.cancelButtonVisible_ = true;
this.cancelButtonDisabled = false; this.cancelButtonDisabled_ = false;
this.confirmButtonVisible_ = false; this.confirmButtonVisible_ = false;
this.doneButtonVisible_ = false; this.doneButtonVisible_ = false;
break; break;
case 'pinPrompt': case 'pinPrompt':
this.cancelButtonVisible_ = true; this.cancelButtonVisible_ = true;
this.cancelButtonDisabled = false; this.cancelButtonDisabled_ = false;
this.confirmButtonVisible_ = true; this.confirmButtonVisible_ = true;
this.confirmButtonDisabled_ = false; this.confirmButtonDisabled_ = false;
this.doneButtonVisible_ = false; this.doneButtonVisible_ = false;
...@@ -150,7 +150,7 @@ Polymer({ ...@@ -150,7 +150,7 @@ Polymer({
break; break;
case 'enroll': case 'enroll':
this.cancelButtonVisible_ = true; this.cancelButtonVisible_ = true;
this.cancelButtonDisabled = false; this.cancelButtonDisabled_ = false;
this.confirmButtonVisible_ = false; this.confirmButtonVisible_ = false;
this.doneButtonVisible_ = false; this.doneButtonVisible_ = false;
break; break;
......
...@@ -884,4 +884,41 @@ suite('SecurityKeysBioEnrollment', function() { ...@@ -884,4 +884,41 @@ suite('SecurityKeysBioEnrollment', function() {
await uiReady; await uiReady;
assertShown(allDivs, dialog, 'enrollments'); assertShown(allDivs, dialog, 'enrollments');
}); });
test('EnrollCancel', async function() {
// Simulate starting an enrollment and then cancelling it.
browserProxy.setResponseFor('enumerateEnrollments', Promise.resolve([]));
let enrollResolver = new PromiseResolver;
browserProxy.setResponseFor('startEnrolling', enrollResolver.promise);
document.body.appendChild(dialog);
await browserProxy.whenCalled('startBioEnroll');
dialog.dialogPage_ = 'enrollments';
// Forcibly disable the cancel button to ensure showing the dialog page
// re-enables it.
dialog.cancelButtonDisabled_ = true;
dialog.cancelButtonVisible_ = false;
let uiReady =
test_util.eventToPromise('bio-enroll-dialog-ready-for-testing', dialog);
dialog.$.addButton.click();
await browserProxy.whenCalled('startEnrolling');
await uiReady;
assertShown(allDivs, dialog, 'enroll');
assert(dialog.$.cancelButton.disabled == false);
assert(dialog.$.cancelButton.hidden == false);
uiReady =
test_util.eventToPromise('bio-enroll-dialog-ready-for-testing', dialog);
dialog.$.cancelButton.click();
await browserProxy.whenCalled('cancelEnrollment');
enrollResolver.resolve({code: Ctap2Status.ERR_KEEPALIVE_CANCEL});
await browserProxy.whenCalled('enumerateEnrollments');
await uiReady;
assertShown(allDivs, dialog, 'enrollments');
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment