• Jun Choi's avatar
    Move FidoDiscovery::Start() invocation · 02ad4da0
    Jun Choi authored
    Currently FidoDiscovery::Start() is called in the constructor of
    FidoRequestHandlerBase class. This potentially leads to crash in
    authenticator_impl_unittest.cc when FakeU2fDevice is used. When
    FakeU2fDevice is used, the device is added in a synchronous manner as
    soon as discovery starts. This leads to invocation of
    FidoRequestHandlerBase::DeviceAdded() which then calls
    CreateTaskForNewDevice() which is a pure abstract function. This has
    been a non-issue until now as may unit tests does not actually call
    AuthenticatorImpl::{MakeCredential, GetAssertion}() and because
    AuthenticatorImpl constructor we used in unit tests has empty |protocols_|
    field. This should be changed as we add more end to end tests in future.
    
    Thus this CL moves invocation of FidoDiscovery::Start() from base class
    constructor to constructor of implementing class and add hid transport to
    AuthenticatorImpl::protocols_ in constructor.
    
    Bug: 798573
    Change-Id: Iaca4978dd06233f670b44b52a30ec192b5f2cb51
    Reviewed-on: https://chromium-review.googlesource.com/1032258
    Commit-Queue: Jun Choi <hongjunchoi@chromium.org>
    Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#555939}
    02ad4da0
fido_request_handler_base.cc 2.69 KB