Commit 90e8e718 authored by Balazs Engedy's avatar Balazs Engedy Committed by Commit Bot

Add error screen for no available transports.

Bug: 847985, 849323
Change-Id: I818ab8eabac6dbb96edceefa5d28f6d28031d15f
Reviewed-on: https://chromium-review.googlesource.com/1181574Reviewed-by: default avatarJun Choi <hongjunchoi@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584611}
parent 8e5097cb
...@@ -52,6 +52,11 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf( ...@@ -52,6 +52,11 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
sheet_view = std::make_unique<AuthenticatorRequestSheetView>( sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorTimeoutErrorModel>(dialog_model)); std::make_unique<AuthenticatorTimeoutErrorModel>(dialog_model));
break; break;
case Step::kErrorNoAvailableTransports:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorNoAvailableTransportsErrorModel>(
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>(
......
...@@ -41,6 +41,9 @@ class AuthenticatorDialogTest : public DialogBrowserTest { ...@@ -41,6 +41,9 @@ 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 == "no_available_transports") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorNoAvailableTransports);
} else if (name == "timeout") { } else if (name == "timeout") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorTimedOut); AuthenticatorRequestDialogModel::Step::kErrorTimedOut);
...@@ -103,6 +106,11 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_timeout) { ...@@ -103,6 +106,11 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_timeout) {
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest,
InvokeUi_no_available_transports) {
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();
} }
......
...@@ -172,6 +172,33 @@ base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const { ...@@ -172,6 +172,33 @@ base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_TIMEOUT_DESCRIPTION); return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_TIMEOUT_DESCRIPTION);
} }
// AuthenticatorNoAvailableTransportsErrorModel -------------------------------
bool AuthenticatorNoAvailableTransportsErrorModel::IsBackButtonVisible() const {
return false;
}
base::string16
AuthenticatorNoAvailableTransportsErrorModel::GetCancelButtonLabel() const {
return l10n_util::GetStringUTF16(IDS_CLOSE);
}
gfx::ImageSkia*
AuthenticatorNoAvailableTransportsErrorModel::GetStepIllustration() const {
return GetImage(IDR_WEBAUTHN_ILLUSTRATION_ERROR_TIMEOUT_1X);
}
base::string16 AuthenticatorNoAvailableTransportsErrorModel::GetStepTitle()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_TITLE);
}
base::string16
AuthenticatorNoAvailableTransportsErrorModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_ERROR_NO_TRANSPORTS_DESCRIPTION);
}
// AuthenticatorBlePowerOnManualSheetModel ------------------------------------ // AuthenticatorBlePowerOnManualSheetModel ------------------------------------
gfx::ImageSkia* AuthenticatorBlePowerOnManualSheetModel::GetStepIllustration() gfx::ImageSkia* AuthenticatorBlePowerOnManualSheetModel::GetStepIllustration()
......
...@@ -109,6 +109,20 @@ class AuthenticatorTimeoutErrorModel : public AuthenticatorSheetModelBase { ...@@ -109,6 +109,20 @@ class AuthenticatorTimeoutErrorModel : public AuthenticatorSheetModelBase {
base::string16 GetStepDescription() const override; base::string16 GetStepDescription() const override;
}; };
class AuthenticatorNoAvailableTransportsErrorModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
bool IsBackButtonVisible() const override;
base::string16 GetCancelButtonLabel() const override;
gfx::ImageSkia* GetStepIllustration() const override;
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
class AuthenticatorBlePowerOnManualSheetModel class AuthenticatorBlePowerOnManualSheetModel
: public AuthenticatorSheetModelBase { : public AuthenticatorSheetModelBase {
public: public:
......
...@@ -116,9 +116,11 @@ void AuthenticatorRequestDialogModel:: ...@@ -116,9 +116,11 @@ void AuthenticatorRequestDialogModel::
if (most_likely_transport) { if (most_likely_transport) {
StartGuidedFlowForTransport( StartGuidedFlowForTransport(
ToAuthenticatorTransport(*most_likely_transport)); ToAuthenticatorTransport(*most_likely_transport));
} else { } else if (!transport_availability_.available_transports.empty()) {
// TODO(engedy): Show error screen if no transport available at all. DCHECK_GE(transport_availability_.available_transports.size(), 2u);
SetCurrentStep(Step::kTransportSelection); SetCurrentStep(Step::kTransportSelection);
} else {
SetCurrentStep(Step::kErrorNoAvailableTransports);
} }
} }
......
...@@ -35,6 +35,7 @@ class AuthenticatorRequestDialogModel { ...@@ -35,6 +35,7 @@ class AuthenticatorRequestDialogModel {
kWelcomeScreen, kWelcomeScreen,
kTransportSelection, kTransportSelection,
kErrorTimedOut, kErrorTimedOut,
kErrorNoAvailableTransports,
kCompleted, kCompleted,
// Universal Serial Bus (USB). // Universal Serial Bus (USB).
......
...@@ -94,8 +94,7 @@ TEST_F(AuthenticatorRequestDialogModelTest, TransportAutoSelection) { ...@@ -94,8 +94,7 @@ TEST_F(AuthenticatorRequestDialogModelTest, TransportAutoSelection) {
{{}, {{},
FidoTransportProtocol::kNearFieldCommunication, FidoTransportProtocol::kNearFieldCommunication,
false, false,
// TODO: Update this when the error screen is implemented. Step::kErrorNoAvailableTransports},
Step::kTransportSelection},
}; };
for (const auto& test_case : kTestCases) { for (const auto& test_case : kTestCases) {
......
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