Commit 86e9b65d authored by Balazs Engedy's avatar Balazs Engedy Committed by Commit Bot

Add key not/already registered error screens for WebAuthn.

The screens are never shown for now outside of tests.

Also rename the `error_timeout` illustration to just `error`, as it is
now used for all kinds of errors, not just timeouts.

Bug: 847985, 849323
Change-Id: Ieb73254c20948c5cdffb7513249cbae61980e1a2
TBR: dschuyler@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/1185008Reviewed-by: default avatarJun Choi <hongjunchoi@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585434}
parent e71f8ef1
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<include name="IDR_WEBAUTHN_ILLUSTRATION_BLE_TAP_1X" file="resources\webauthn\ble_tap.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_BLE_TAP_1X" file="resources\webauthn\ble_tap.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_BLE_PIN_1X" file="resources\webauthn\ble_pin.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_BLE_PIN_1X" file="resources\webauthn\ble_pin.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_ERROR_BLUETOOTH_1X" file="resources\webauthn\error_bt.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_ERROR_BLUETOOTH_1X" file="resources\webauthn\error_bt.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_ERROR_TIMEOUT_1X" file="resources\webauthn\error_timeout.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_ERROR_1X" file="resources\webauthn\error.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_PHONE_1X" file="resources\webauthn\phone.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_PHONE_1X" file="resources\webauthn\phone.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_USB_1X" file="resources\webauthn\usb.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_USB_1X" file="resources\webauthn\usb.png" type="BINDATA" />
<include name="IDR_WEBAUTHN_ILLUSTRATION_WELCOME_1X" file="resources\webauthn\welcome.png" type="BINDATA" /> <include name="IDR_WEBAUTHN_ILLUSTRATION_WELCOME_1X" file="resources\webauthn\welcome.png" type="BINDATA" />
......
...@@ -57,6 +57,15 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf( ...@@ -57,6 +57,15 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
std::make_unique<AuthenticatorNoAvailableTransportsErrorModel>( std::make_unique<AuthenticatorNoAvailableTransportsErrorModel>(
dialog_model)); dialog_model));
break; break;
case Step::kErrorKeyNotRegistered:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorNotRegisteredErrorModel>(dialog_model));
break;
case Step::kErrorKeyAlreadyRegistered:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorAlreadyRegisteredErrorModel>(
dialog_model));
break;
case Step::kBlePowerOnManual: case Step::kBlePowerOnManual:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>( sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBlePowerOnManualSheetModel>( std::make_unique<AuthenticatorBlePowerOnManualSheetModel>(
......
...@@ -42,12 +42,18 @@ class AuthenticatorDialogTest : public DialogBrowserTest { ...@@ -42,12 +42,18 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
} else if (name == "activate_usb") { } else if (name == "activate_usb") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kUsbInsertAndActivate); AuthenticatorRequestDialogModel::Step::kUsbInsertAndActivate);
} else if (name == "timeout") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorTimedOut);
} else if (name == "no_available_transports") { } else if (name == "no_available_transports") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorNoAvailableTransports); AuthenticatorRequestDialogModel::Step::kErrorNoAvailableTransports);
} else if (name == "timeout") { } else if (name == "key_not_registered") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorTimedOut); AuthenticatorRequestDialogModel::Step::kErrorKeyNotRegistered);
} else if (name == "key_already_registered") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorKeyAlreadyRegistered);
} else if (name == "ble_power_on_manual") { } else if (name == "ble_power_on_manual") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBlePowerOnManual); AuthenticatorRequestDialogModel::Step::kBlePowerOnManual);
...@@ -112,6 +118,15 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, ...@@ -112,6 +118,15 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest,
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_key_not_registered) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest,
InvokeUi_key_already_registered) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_power_on_manual) { IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_power_on_manual) {
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
......
...@@ -170,7 +170,7 @@ base::string16 AuthenticatorInsertAndActivateUsbSheetModel::GetStepDescription() ...@@ -170,7 +170,7 @@ base::string16 AuthenticatorInsertAndActivateUsbSheetModel::GetStepDescription()
// AuthenticatorTimeoutErrorModel --------------------------------------------- // AuthenticatorTimeoutErrorModel ---------------------------------------------
gfx::ImageSkia* AuthenticatorTimeoutErrorModel::GetStepIllustration() const { gfx::ImageSkia* AuthenticatorTimeoutErrorModel::GetStepIllustration() const {
return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_TIMEOUT_1X); return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_1X);
} }
base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const { base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const {
...@@ -194,7 +194,7 @@ AuthenticatorNoAvailableTransportsErrorModel::GetCancelButtonLabel() const { ...@@ -194,7 +194,7 @@ AuthenticatorNoAvailableTransportsErrorModel::GetCancelButtonLabel() const {
gfx::ImageSkia* gfx::ImageSkia*
AuthenticatorNoAvailableTransportsErrorModel::GetStepIllustration() const { AuthenticatorNoAvailableTransportsErrorModel::GetStepIllustration() const {
return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_TIMEOUT_1X); return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_1X);
} }
base::string16 AuthenticatorNoAvailableTransportsErrorModel::GetStepTitle() base::string16 AuthenticatorNoAvailableTransportsErrorModel::GetStepTitle()
...@@ -208,6 +208,72 @@ AuthenticatorNoAvailableTransportsErrorModel::GetStepDescription() const { ...@@ -208,6 +208,72 @@ AuthenticatorNoAvailableTransportsErrorModel::GetStepDescription() const {
IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_DESCRIPTION); IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_DESCRIPTION);
} }
// AuthenticatorNotRegisteredErrorModel ---------------------------------------
gfx::ImageSkia* AuthenticatorNotRegisteredErrorModel::GetStepIllustration()
const {
return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_1X);
}
base::string16 AuthenticatorNotRegisteredErrorModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_WRONG_KEY_SIGN_TITLE);
}
base::string16 AuthenticatorNotRegisteredErrorModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_ERROR_WRONG_KEY_SIGN_DESCRIPTION);
}
bool AuthenticatorNotRegisteredErrorModel::IsAcceptButtonVisible() const {
return true;
}
bool AuthenticatorNotRegisteredErrorModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorNotRegisteredErrorModel::GetAcceptButtonLabel()
const {
// TODO(engedy): This should use a separate string resource.
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLUETOOTH_POWER_ON_MANUAL_NEXT);
}
void AuthenticatorNotRegisteredErrorModel::OnAccept() {}
// AuthenticatorAlreadyRegisteredErrorModel -----------------------------------
gfx::ImageSkia* AuthenticatorAlreadyRegisteredErrorModel::GetStepIllustration()
const {
return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_1X);
}
base::string16 AuthenticatorAlreadyRegisteredErrorModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_WRONG_KEY_REGISTER_TITLE);
}
base::string16 AuthenticatorAlreadyRegisteredErrorModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_ERROR_WRONG_KEY_REGISTER_DESCRIPTION);
}
bool AuthenticatorAlreadyRegisteredErrorModel::IsAcceptButtonVisible() const {
return true;
}
bool AuthenticatorAlreadyRegisteredErrorModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorAlreadyRegisteredErrorModel::GetAcceptButtonLabel()
const {
// TODO(engedy): This should use a separate string resource.
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLUETOOTH_POWER_ON_MANUAL_NEXT);
}
void AuthenticatorAlreadyRegisteredErrorModel::OnAccept() {}
// AuthenticatorBlePowerOnManualSheetModel ------------------------------------ // AuthenticatorBlePowerOnManualSheetModel ------------------------------------
gfx::ImageSkia* AuthenticatorBlePowerOnManualSheetModel::GetStepIllustration() gfx::ImageSkia* AuthenticatorBlePowerOnManualSheetModel::GetStepIllustration()
......
...@@ -125,6 +125,38 @@ class AuthenticatorNoAvailableTransportsErrorModel ...@@ -125,6 +125,38 @@ class AuthenticatorNoAvailableTransportsErrorModel
base::string16 GetStepDescription() const override; base::string16 GetStepDescription() const override;
}; };
class AuthenticatorNotRegisteredErrorModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
gfx::ImageSkia* GetStepIllustration() const override;
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
void OnAccept() override;
};
class AuthenticatorAlreadyRegisteredErrorModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
gfx::ImageSkia* GetStepIllustration() const override;
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
void OnAccept() override;
};
class AuthenticatorBlePowerOnManualSheetModel class AuthenticatorBlePowerOnManualSheetModel
: public AuthenticatorSheetModelBase { : public AuthenticatorSheetModelBase {
public: public:
......
...@@ -36,6 +36,8 @@ class AuthenticatorRequestDialogModel { ...@@ -36,6 +36,8 @@ class AuthenticatorRequestDialogModel {
kTransportSelection, kTransportSelection,
kErrorTimedOut, kErrorTimedOut,
kErrorNoAvailableTransports, kErrorNoAvailableTransports,
kErrorKeyNotRegistered,
kErrorKeyAlreadyRegistered,
kCompleted, kCompleted,
// Universal Serial Bus (USB). // Universal Serial Bus (USB).
......
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