Commit 70fc0cf0 authored by Martin Kreichgauer's avatar Martin Kreichgauer Committed by Commit Bot

Reland "fido: make AuthenticatorTestBase set the MOCK_TIME TaskEnvironment trait"

This reverts commit 02303ee2.

Reason for revert: Original CL did not cause the test failure

Original change's description:
> Revert "fido: make AuthenticatorTestBase set the MOCK_TIME TaskEnvironment trait"
> 
> This reverts commit f55cd37e.
> 
> Reason for revert: The tests testAuthenticatorImplGetAssertionBridge_resultCanceled and testAuthenticatorImplGetAssertionBridgeWithUvmRequestedWithUvmResponded_success in org.chromium.chrome.browser.webauth.Fido2CredentialRequestTest consistently fail on android-pie-x86-rel since https://ci.chromium.org/p/chromium/builders/ci/android-pie-x86-rel/1498.
> This CL is the only one that touches authenticator_impl around that time. Revert it to see if it can fix the failure
> 
> Original change's description:
> > fido: make AuthenticatorTestBase set the MOCK_TIME TaskEnvironment trait
> > 
> > This allows us to get rid of base::Timer injection into
> > AuthenticatorCommon, which tests used to wait for requests to time out.
> > 
> > Also get remove a number of superfluous RunUntilIdle() calls, and of
> > calls to OverrideLastCommittedOrigin() where SimulateNavigation() would
> > suffice.
> > 
> > Change-Id: I8cb4980d51efe43f59d828cde5f34ce67d38d928
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2299630
> > Auto-Submit: Martin Kreichgauer <martinkr@google.com>
> > Reviewed-by: Jared Saul <jsaul@google.com>
> > Reviewed-by: Adam Langley <agl@chromium.org>
> > Commit-Queue: Martin Kreichgauer <martinkr@google.com>
> > Cr-Commit-Position: refs/heads/master@{#788885}
> 
> TBR=agl@chromium.org,jsaul@google.com,martinkr@google.com
> 
> Change-Id: I47c8796582f40f1946811b5eca4ae3cdfe5aac0f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303030
> Reviewed-by: Haiyang Pan <hypan@google.com>
> Commit-Queue: Haiyang Pan <hypan@google.com>
> Cr-Commit-Position: refs/heads/master@{#789079}

TBR=agl@chromium.org,jsaul@google.com,martinkr@google.com,hypan@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: I0a07662127df43624d7fa69c165d2503107514aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303567Reviewed-by: default avatarHaiyang Pan <hypan@google.com>
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#789304}
parent 5e05c54e
......@@ -7,7 +7,6 @@
#include <string>
#include <utility>
#include "base/timer/timer.h"
#include "content/browser/webauth/authenticator_common.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
......@@ -18,20 +17,12 @@ namespace content {
InternalAuthenticatorImpl::InternalAuthenticatorImpl(
RenderFrameHost* render_frame_host)
: InternalAuthenticatorImpl(render_frame_host,
std::make_unique<AuthenticatorCommon>(
render_frame_host,
std::make_unique<base::OneShotTimer>())) {}
InternalAuthenticatorImpl::InternalAuthenticatorImpl(
RenderFrameHost* render_frame_host,
std::unique_ptr<AuthenticatorCommon> authenticator_common)
: WebContentsObserver(WebContents::FromRenderFrameHost(render_frame_host)),
render_frame_host_(render_frame_host),
effective_origin_(render_frame_host->GetLastCommittedOrigin()),
authenticator_common_(std::move(authenticator_common)) {
authenticator_common_(
std::make_unique<AuthenticatorCommon>(render_frame_host)) {
DCHECK(render_frame_host_);
DCHECK(authenticator_common_);
// Disabling WebAuthn modal dialogs to avoid conflict with Autofill's own
// modal dialogs. Since WebAuthn is designed for websites, rather than browser
// components, the UI can be confusing for users in the case for Autofill.
......
......@@ -57,14 +57,6 @@ class InternalAuthenticatorImpl : public autofill::InternalAuthenticator,
private:
friend class InternalAuthenticatorImplTest;
// By being able to set AuthenticatorCommon, this constructor permits setting
// the connector and timer for testing. Using this constructor will also empty
// out the protocol set, since no device discovery will take place during
// tests.
InternalAuthenticatorImpl(
RenderFrameHost* render_frame_host,
std::unique_ptr<AuthenticatorCommon> authenticator_common);
AuthenticatorCommon* get_authenticator_common_for_testing() {
return authenticator_common_.get();
}
......
......@@ -534,15 +534,11 @@ base::flat_set<device::FidoTransportProtocol> GetAvailableTransports(
} // namespace
AuthenticatorCommon::AuthenticatorCommon(
RenderFrameHost* render_frame_host,
std::unique_ptr<base::OneShotTimer> timer)
AuthenticatorCommon::AuthenticatorCommon(RenderFrameHost* render_frame_host)
: render_frame_host_(render_frame_host),
security_checker_(static_cast<RenderFrameHostImpl*>(render_frame_host)
->GetWebAuthRequestSecurityChecker()),
timer_(std::move(timer)) {
->GetWebAuthRequestSecurityChecker()) {
DCHECK(render_frame_host_);
DCHECK(timer_);
// Disable the back-forward cache for any document that makes WebAuthn
// requests. Pages using privacy-sensitive APIs are generally exempt from
// back-forward cache for now as a precaution.
......
......@@ -16,6 +16,7 @@
#include "base/containers/span.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/public/browser/authenticator_request_client_delegate.h"
#include "content/public/browser/web_contents_observer.h"
......@@ -67,9 +68,7 @@ CONTENT_EXPORT extern const char kGetType[];
// Common code for any WebAuthn Authenticator interfaces.
class CONTENT_EXPORT AuthenticatorCommon {
public:
// Permits setting timer for testing.
AuthenticatorCommon(RenderFrameHost* render_frame_host,
std::unique_ptr<base::OneShotTimer>);
explicit AuthenticatorCommon(RenderFrameHost* render_frame_host);
virtual ~AuthenticatorCommon();
// This is not-quite an implementation of blink::mojom::Authenticator. The
......@@ -183,7 +182,8 @@ class CONTENT_EXPORT AuthenticatorCommon {
url::Origin caller_origin_;
std::string relying_party_id_;
scoped_refptr<WebAuthRequestSecurityChecker> security_checker_;
std::unique_ptr<base::OneShotTimer> timer_;
std::unique_ptr<base::OneShotTimer> timer_ =
std::make_unique<base::OneShotTimer>();
base::Optional<device::AuthenticatorSelectionCriteria>
authenticator_selection_criteria_;
base::Optional<std::string> app_id_;
......
......@@ -17,10 +17,9 @@
namespace content {
AuthenticatorImpl::AuthenticatorImpl(RenderFrameHost* render_frame_host)
: AuthenticatorImpl(render_frame_host,
std::make_unique<AuthenticatorCommon>(
: AuthenticatorImpl(
render_frame_host,
std::make_unique<base::OneShotTimer>())) {}
std::make_unique<AuthenticatorCommon>(render_frame_host)) {}
AuthenticatorImpl::AuthenticatorImpl(
RenderFrameHost* render_frame_host,
......
......@@ -46,9 +46,8 @@ class CONTENT_EXPORT AuthenticatorImpl : public blink::mojom::Authenticator,
public:
explicit AuthenticatorImpl(RenderFrameHost* render_frame_host);
// By being able to set AuthenticatorCommon, this constructor permits setting
// the timer for testing. Using this constructor will also empty out the
// protocol set, since no device discovery will take place during tests.
// Constructs an AuthenticatorImpl with an injected AuthenticatorCommon for
// testing.
AuthenticatorImpl(RenderFrameHost* render_frame_host,
std::unique_ptr<AuthenticatorCommon> authenticator_common);
~AuthenticatorImpl() override;
......
......@@ -109,12 +109,7 @@ using InterestingFailureReason =
using FailureReasonCallbackReceiver =
::device::test::TestCallbackReceiver<InterestingFailureReason>;
typedef struct {
const char* origin;
// Either a relying party ID or a U2F AppID.
const char* claimed_authority;
AuthenticatorStatus expected_status;
} OriginClaimedAuthorityPair;
constexpr base::TimeDelta kTestTimeout = base::TimeDelta::FromMinutes(1);
// The size of credential IDs returned by GetTestCredentials().
constexpr size_t kTestCredentialIdLength = 32u;
......@@ -140,6 +135,13 @@ constexpr char kTestSignClientDataJsonString[] =
R"({"challenge":"aHE0loIi7BcgLkJQX47SsWriLxa7BbiMJdueYCZF8UE","origin":)"
R"("https://a.google.com", "type":"webauthn.get"})";
typedef struct {
const char* origin;
// Either a relying party ID or a U2F AppID.
const char* claimed_authority;
AuthenticatorStatus expected_status;
} OriginClaimedAuthorityPair;
constexpr OriginClaimedAuthorityPair kValidRelyingPartyTestCases[] = {
{"http://localhost", "localhost", AuthenticatorStatus::SUCCESS},
{"https://myawesomedomain", "myawesomedomain",
......@@ -394,7 +396,9 @@ device::AuthenticatorData AuthDataFromMakeCredentialResponse(
class AuthenticatorTestBase : public content::RenderViewHostTestHarness {
protected:
AuthenticatorTestBase() = default;
AuthenticatorTestBase()
: RenderViewHostTestHarness(
base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
~AuthenticatorTestBase() override = default;
void SetUp() override {
......@@ -453,25 +457,6 @@ class AuthenticatorImplTest : public AuthenticatorTestBase {
return authenticator;
}
mojo::Remote<blink::mojom::Authenticator> ConnectToAuthenticator(
std::unique_ptr<base::OneShotTimer> timer) {
authenticator_impl_ = std::make_unique<AuthenticatorImpl>(
main_rfh(),
std::make_unique<AuthenticatorCommon>(main_rfh(), std::move(timer)));
mojo::Remote<blink::mojom::Authenticator> authenticator;
authenticator_impl_->Bind(authenticator.BindNewPipeAndPassReceiver());
return authenticator;
}
mojo::Remote<blink::mojom::Authenticator> ConstructAuthenticatorWithTimer(
scoped_refptr<base::TestMockTimeTaskRunner> task_runner) {
// Set up a timer for testing.
auto timer =
std::make_unique<base::OneShotTimer>(task_runner->GetMockTickClock());
timer->SetTaskRunner(task_runner);
return ConnectToAuthenticator(std::move(timer));
}
url::Origin GetTestOrigin() {
const GURL test_relying_party_url(kTestOrigin1);
CHECK(test_relying_party_url.is_valid());
......@@ -693,9 +678,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialURLs) {
// verification is required for U2F devices.
TEST_F(AuthenticatorImplTest, MakeCredentialUserVerification) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
......@@ -705,9 +688,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialUserVerification) {
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
}
......@@ -716,9 +697,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialUserVerification) {
// key is requested on create().
TEST_F(AuthenticatorImplTest, MakeCredentialResidentKey) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
......@@ -727,9 +706,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialResidentKey) {
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::RESIDENT_CREDENTIALS_UNSUPPORTED,
callback_receiver.status());
......@@ -741,9 +718,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialResidentKey) {
// platform authenticator is requested for U2F devices.
TEST_F(AuthenticatorImplTest, MakeCredentialPlatformAuthenticator) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
......@@ -753,9 +728,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialPlatformAuthenticator) {
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
}
......@@ -811,15 +784,11 @@ TEST_F(AuthenticatorImplTest, TestMakeCredentialTimeout) {
GetTestPublicKeyCredentialCreationOptions();
TestMakeCredentialCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
}
......@@ -911,14 +880,8 @@ TEST_F(AuthenticatorImplTest, AppIdExtensionValues) {
// Verify that a request coming from Cryptotoken bypasses origin checks.
TEST_F(AuthenticatorImplTest, CryptotokenBypass) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
{
OverrideLastCommittedOrigin(main_rfh(),
url::Origin::Create(GURL(kCryptotokenOrigin)));
SimulateNavigation(GURL(kCryptotokenOrigin));
// First, verify that the Cryptotoken request succeeds with the appid.
PublicKeyCredentialRequestOptionsPtr options =
GetTestPublicKeyCredentialRequestOptions();
......@@ -931,6 +894,7 @@ TEST_F(AuthenticatorImplTest, CryptotokenBypass) {
options->appid = kTestOrigin1;
TestGetAssertionCallback callback_receiver;
auto authenticator = ConnectToAuthenticator();
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
callback_receiver.WaitForCallback();
......@@ -942,8 +906,7 @@ TEST_F(AuthenticatorImplTest, CryptotokenBypass) {
{
ResetVirtualDevice();
OverrideLastCommittedOrigin(
main_rfh(), url::Origin::Create(GURL(kTestExtensionOrigin)));
SimulateNavigation(GURL(kTestExtensionOrigin));
// Next, verify that other extensions cannot bypass the origin checks.
PublicKeyCredentialRequestOptionsPtr options =
GetTestPublicKeyCredentialRequestOptions();
......@@ -956,6 +919,7 @@ TEST_F(AuthenticatorImplTest, CryptotokenBypass) {
options->appid = kTestOrigin1;
TestGetAssertionCallback callback_receiver;
auto authenticator = ConnectToAuthenticator();
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
callback_receiver.WaitForCallback();
......@@ -989,9 +953,7 @@ TEST_F(AuthenticatorImplTest, CryptoTokenMakeCredentialCtap2Device) {
device::ProtocolVersion::kCtap2);
SimulateNavigation(GURL(kCryptotokenOrigin));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
options->relying_party.id = kTestOrigin1;
......@@ -999,8 +961,7 @@ TEST_F(AuthenticatorImplTest, CryptoTokenMakeCredentialCtap2Device) {
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
......@@ -1016,9 +977,7 @@ TEST_F(AuthenticatorImplTest, CryptoTokenMakeCredentialDualProtocolDevice) {
virtual_device_factory_->SetCtap2Config(config);
SimulateNavigation(GURL(kCryptotokenOrigin));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
options->relying_party.id = kTestOrigin1;
......@@ -1070,13 +1029,10 @@ TEST_F(AuthenticatorImplTest, CryptoTokenGetAssertionCtap2Device) {
options->appid = kTestOrigin1;
TestGetAssertionCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
authenticator->GetAssertion(std::move(options), callback_receiver.callback());
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
......@@ -1110,12 +1066,8 @@ TEST_F(AuthenticatorImplTest, CryptoTokenGetAssertionDualProtocolDevice) {
// Test that Cryptotoken requests should only be dispatched to USB
// authenticators.
TEST_F(AuthenticatorImplTest, CryptotokenUsbOnly) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
SimulateNavigation(GURL(kCryptotokenOrigin));
for (const bool is_cryptotoken_request : {false, true}) {
// caBLE and platform discoveries cannot be instantiated through
// VirtualFidoDeviceFactory, so we don't test them here.
for (const device::FidoTransportProtocol transport :
......@@ -1123,13 +1075,7 @@ TEST_F(AuthenticatorImplTest, CryptotokenUsbOnly) {
device::FidoTransportProtocol::kBluetoothLowEnergy,
device::FidoTransportProtocol::kNearFieldCommunication}) {
SCOPED_TRACE(::testing::Message()
<< "is_cryptotoken_request=" << is_cryptotoken_request
<< ", transport=" << device::ToString(transport));
OverrideLastCommittedOrigin(
main_rfh(),
url::Origin::Create(GURL(is_cryptotoken_request ? kCryptotokenOrigin
: kTestOrigin1)));
<< "transport=" << device::ToString(transport));
ResetVirtualDevice();
virtual_device_factory_->SetSupportedProtocol(
......@@ -1139,18 +1085,18 @@ TEST_F(AuthenticatorImplTest, CryptotokenUsbOnly) {
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
auto authenticator = ConnectToAuthenticator();
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
if (transport == device::FidoTransportProtocol::kUsbHumanInterfaceDevice) {
callback_receiver.WaitForCallback();
EXPECT_EQ(
!is_cryptotoken_request ||
transport ==
device::FidoTransportProtocol::kUsbHumanInterfaceDevice
? AuthenticatorStatus::SUCCESS
: AuthenticatorStatus::NOT_ALLOWED_ERROR,
EXPECT_EQ(AuthenticatorStatus::SUCCESS, callback_receiver.status());
} else {
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR,
callback_receiver.status());
}
}
......@@ -1159,9 +1105,7 @@ TEST_F(AuthenticatorImplTest, CryptotokenUsbOnly) {
// Verify that a credential registered with U2F can be used via webauthn.
TEST_F(AuthenticatorImplTest, AppIdExtension) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
{
// First, test that the appid extension isn't echoed at all when not
......@@ -1348,14 +1292,10 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionTimeout) {
GetTestPublicKeyCredentialRequestOptions();
TestGetAssertionCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
authenticator->GetAssertion(std::move(options), callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
}
......@@ -1456,9 +1396,7 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionU2fDeviceBackwardsCompatibility) {
PublicKeyCredentialRequestOptionsPtr options =
GetTestPublicKeyCredentialRequestOptions();
TestGetAssertionCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
// Inject credential ID to the virtual device so that successful sign in is
// possible.
ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration(
......@@ -1466,7 +1404,6 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionU2fDeviceBackwardsCompatibility) {
authenticator->GetAssertion(std::move(options), callback_receiver.callback());
// Trigger timer.
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::SUCCESS, callback_receiver.status());
}
......@@ -1478,14 +1415,10 @@ TEST_F(AuthenticatorImplTest, GetAssertionWithEmptyAllowCredentials) {
options->allow_credentials.clear();
TestGetAssertionCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
authenticator->GetAssertion(std::move(options), callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::RESIDENT_CREDENTIALS_UNSUPPORTED,
callback_receiver.status());
......@@ -1595,9 +1528,7 @@ TEST_F(AuthenticatorImplTest, InvalidResponse) {
virtual_device_factory_->mutable_state()->simulate_invalid_response = true;
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
{
PublicKeyCredentialRequestOptionsPtr options =
......@@ -1605,9 +1536,7 @@ TEST_F(AuthenticatorImplTest, InvalidResponse) {
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR,
callback_receiver.status());
......@@ -1619,9 +1548,7 @@ TEST_F(AuthenticatorImplTest, InvalidResponse) {
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
// Trigger timer.
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR,
callback_receiver.status());
......@@ -1674,15 +1601,12 @@ TEST_F(AuthenticatorImplTest, GetAssertionResponseWithAttestedCredentialData) {
options->allow_credentials[0].id(), kTestRelyingPartyId));
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options), callback_receiver.callback());
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
}
......@@ -2686,12 +2610,7 @@ TEST_F(AuthenticatorContentBrowserClientTest, IsUVPAAOverride) {
TEST_F(AuthenticatorContentBrowserClientTest,
CryptotokenBypassesAttestationConsentPrompt) {
SimulateNavigation(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
OverrideLastCommittedOrigin(main_rfh(),
url::Origin::Create(GURL(kCryptotokenOrigin)));
SimulateNavigation(GURL(kCryptotokenOrigin));
virtual_device_factory_->SetSupportedProtocol(device::ProtocolVersion::kU2f);
PublicKeyCredentialCreationOptionsPtr options =
......@@ -2702,6 +2621,7 @@ TEST_F(AuthenticatorContentBrowserClientTest,
options->attestation = device::AttestationConveyancePreference::kDirect;
test_client_.attestation_consent = AttestationConsent::DENIED;
auto authenticator = ConnectToAuthenticator();
TestMakeCredentialCallback callback_receiver;
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
......@@ -2788,9 +2708,8 @@ class FakeAuthenticatorCommon : public AuthenticatorCommon {
public:
explicit FakeAuthenticatorCommon(
RenderFrameHost* render_frame_host,
std::unique_ptr<base::OneShotTimer> timer,
std::unique_ptr<MockAuthenticatorRequestDelegateObserver> mock_delegate)
: AuthenticatorCommon(render_frame_host, std::move(timer)),
: AuthenticatorCommon(render_frame_host),
mock_delegate_(std::move(mock_delegate)) {}
~FakeAuthenticatorCommon() override = default;
......@@ -2818,25 +2737,14 @@ class AuthenticatorImplRequestDelegateTest : public AuthenticatorImplTest {
}
mojo::Remote<blink::mojom::Authenticator> ConnectToFakeAuthenticator(
std::unique_ptr<MockAuthenticatorRequestDelegateObserver> delegate,
std::unique_ptr<base::OneShotTimer> timer) {
std::unique_ptr<MockAuthenticatorRequestDelegateObserver> delegate) {
authenticator_impl_ = std::make_unique<AuthenticatorImpl>(
main_rfh(), std::make_unique<FakeAuthenticatorCommon>(
main_rfh(), std::move(timer), std::move(delegate)));
main_rfh(), std::move(delegate)));
mojo::Remote<blink::mojom::Authenticator> authenticator;
authenticator_impl_->Bind(authenticator.BindNewPipeAndPassReceiver());
return authenticator;
}
mojo::Remote<blink::mojom::Authenticator> ConstructFakeAuthenticatorWithTimer(
std::unique_ptr<MockAuthenticatorRequestDelegateObserver> delegate,
scoped_refptr<base::TestMockTimeTaskRunner> task_runner) {
// Set up a timer for testing.
auto timer =
std::make_unique<base::OneShotTimer>(task_runner->GetMockTickClock());
timer->SetTaskRunner(task_runner);
return ConnectToFakeAuthenticator(std::move(delegate), std::move(timer));
}
};
TEST_F(AuthenticatorImplRequestDelegateTest,
......@@ -2854,14 +2762,11 @@ TEST_F(AuthenticatorImplRequestDelegateTest,
PublicKeyCredentialRequestOptionsPtr options =
GetTestPublicKeyCredentialRequestOptions();
TestGetAssertionCallback callback_receiver;
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto mock_delegate =
std::make_unique<MockAuthenticatorRequestDelegateObserver>();
auto* const mock_delegate_ptr = mock_delegate.get();
auto authenticator = ConstructFakeAuthenticatorWithTimer(
std::move(mock_delegate), task_runner);
auto authenticator = ConnectToFakeAuthenticator(std::move(mock_delegate));
auto mock_usb_device = device::MockFidoDevice::MakeCtap();
mock_usb_device->StubGetId();
......@@ -2905,17 +2810,13 @@ TEST_F(AuthenticatorImplRequestDelegateTest, FailureReasonForTimeout) {
auto mock_delegate = std::make_unique<
::testing::NiceMock<MockAuthenticatorRequestDelegateObserver>>(
failure_reason_receiver.callback());
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructFakeAuthenticatorWithTimer(
std::move(mock_delegate), task_runner);
auto authenticator = ConnectToFakeAuthenticator(std::move(mock_delegate));
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(GetTestPublicKeyCredentialRequestOptions(),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback_receiver.WaitForCallback();
EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, callback_receiver.status());
......@@ -2934,10 +2835,7 @@ TEST_F(AuthenticatorImplRequestDelegateTest,
auto mock_delegate = std::make_unique<
::testing::NiceMock<MockAuthenticatorRequestDelegateObserver>>(
failure_reason_receiver.callback());
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructFakeAuthenticatorWithTimer(
std::move(mock_delegate), task_runner);
auto authenticator = ConnectToFakeAuthenticator(std::move(mock_delegate));
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
......@@ -2967,10 +2865,7 @@ TEST_F(AuthenticatorImplRequestDelegateTest,
auto mock_delegate = std::make_unique<
::testing::NiceMock<MockAuthenticatorRequestDelegateObserver>>(
failure_reason_receiver.callback());
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructFakeAuthenticatorWithTimer(
std::move(mock_delegate), task_runner);
auto authenticator = ConnectToFakeAuthenticator(std::move(mock_delegate));
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(GetTestPublicKeyCredentialRequestOptions(),
......@@ -3098,7 +2993,6 @@ TEST_F(AuthenticatorImplTest, MakeCredentialWithLargeExcludeList) {
ConnectToAuthenticator();
authenticator->MakeCredential(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
callback_receiver.WaitForCallback();
EXPECT_EQ(callback_receiver.status(),
has_excluded_credential ? AuthenticatorStatus::CREDENTIAL_EXCLUDED
......@@ -3135,7 +3029,6 @@ TEST_F(AuthenticatorImplTest, GetAssertionWithLargeAllowList) {
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
callback_receiver.WaitForCallback();
EXPECT_EQ(callback_receiver.status(),
has_allowed_credential ? AuthenticatorStatus::SUCCESS
......@@ -3175,7 +3068,6 @@ TEST_F(AuthenticatorImplTest, GetAssertionSingleElementAllowListDoesNotProbe) {
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
callback_receiver.WaitForCallback();
EXPECT_EQ(callback_receiver.status(), AuthenticatorStatus::SUCCESS);
......@@ -3215,7 +3107,6 @@ TEST_F(AuthenticatorImplTest, GetAssertionSingleBatchListDoesNotProbe) {
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
callback_receiver.WaitForCallback();
EXPECT_EQ(callback_receiver.status(),
......@@ -3230,10 +3121,7 @@ TEST_F(AuthenticatorImplTest, OptionalCredentialInAssertionResponse) {
// whether an authenticator returns credential information when the allowlist
// only has a single entry.
NavigateAndCommit(GURL(kTestOrigin1));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
mojo::Remote<blink::mojom::Authenticator> authenticator =
ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
for (const auto behavior :
{device::VirtualCtap2Device::Config::IncludeCredential::ONLY_IF_NEEDED,
......@@ -3283,9 +3171,8 @@ TEST_F(AuthenticatorImplTest, OptionalCredentialInAssertionResponse) {
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(std::move(options),
callback_receiver.callback());
base::RunLoop().RunUntilIdle();
if (should_timeout) {
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(5));
task_environment()->FastForwardBy(kTestTimeout);
}
callback_receiver.WaitForCallback();
......@@ -3357,7 +3244,6 @@ TEST_F(AuthenticatorImplTest, NoUnexpectedAuthenticatorExtensions) {
TestMakeCredentialCallback create_callback;
authenticator->MakeCredential(GetTestPublicKeyCredentialCreationOptions(),
create_callback.callback());
base::RunLoop().RunUntilIdle();
create_callback.WaitForCallback();
EXPECT_EQ(create_callback.status(), AuthenticatorStatus::NOT_ALLOWED_ERROR);
......@@ -3369,7 +3255,6 @@ TEST_F(AuthenticatorImplTest, NoUnexpectedAuthenticatorExtensions) {
TestGetAssertionCallback assertion_callback;
authenticator->GetAssertion(std::move(assertion_options),
assertion_callback.callback());
base::RunLoop().RunUntilIdle();
assertion_callback.WaitForCallback();
EXPECT_EQ(assertion_callback.status(),
AuthenticatorStatus::NOT_ALLOWED_ERROR);
......@@ -3389,7 +3274,6 @@ TEST_F(AuthenticatorImplTest, NoUnexpectedClientExtensions) {
TestMakeCredentialCallback create_callback;
authenticator->MakeCredential(GetTestPublicKeyCredentialCreationOptions(),
create_callback.callback());
base::RunLoop().RunUntilIdle();
create_callback.WaitForCallback();
EXPECT_EQ(create_callback.status(), AuthenticatorStatus::SUCCESS);
......@@ -3401,7 +3285,6 @@ TEST_F(AuthenticatorImplTest, NoUnexpectedClientExtensions) {
TestGetAssertionCallback assertion_callback;
authenticator->GetAssertion(std::move(assertion_options),
assertion_callback.callback());
base::RunLoop().RunUntilIdle();
assertion_callback.WaitForCallback();
EXPECT_EQ(assertion_callback.status(), AuthenticatorStatus::SUCCESS);
}
......@@ -3420,7 +3303,6 @@ TEST_F(AuthenticatorImplTest, AndroidClientDataExtension) {
TestMakeCredentialCallback create_callback;
authenticator->MakeCredential(GetTestPublicKeyCredentialCreationOptions(),
create_callback.callback());
base::RunLoop().RunUntilIdle();
create_callback.WaitForCallback();
EXPECT_EQ(create_callback.status(), AuthenticatorStatus::SUCCESS);
......@@ -3431,7 +3313,6 @@ TEST_F(AuthenticatorImplTest, AndroidClientDataExtension) {
TestGetAssertionCallback assertion_callback;
authenticator->GetAssertion(std::move(assertion_options),
assertion_callback.callback());
base::RunLoop().RunUntilIdle();
assertion_callback.WaitForCallback();
EXPECT_EQ(assertion_callback.status(), AuthenticatorStatus::SUCCESS);
}
......@@ -3451,7 +3332,6 @@ TEST_F(AuthenticatorImplTest, UnsolicitedAndroidClientDataExtensionReponse) {
TestMakeCredentialCallback create_callback;
authenticator->MakeCredential(GetTestPublicKeyCredentialCreationOptions(),
create_callback.callback());
base::RunLoop().RunUntilIdle();
create_callback.WaitForCallback();
EXPECT_EQ(create_callback.status(), AuthenticatorStatus::NOT_ALLOWED_ERROR);
......@@ -3463,7 +3343,6 @@ TEST_F(AuthenticatorImplTest, UnsolicitedAndroidClientDataExtensionReponse) {
TestGetAssertionCallback assertion_callback;
authenticator->GetAssertion(std::move(assertion_options),
assertion_callback.callback());
base::RunLoop().RunUntilIdle();
assertion_callback.WaitForCallback();
EXPECT_EQ(assertion_callback.status(),
AuthenticatorStatus::NOT_ALLOWED_ERROR);
......@@ -3507,7 +3386,6 @@ TEST_F(AuthenticatorImplTest, ExcludeListBatching) {
options->exclude_credentials = std::move(test_credentials);
TestMakeCredentialCallback callback;
authenticator->MakeCredential(std::move(options), callback.callback());
base::RunLoop().RunUntilIdle();
callback.WaitForCallback();
EXPECT_EQ(callback.status(), authenticator_has_excluded_credential
......@@ -3542,7 +3420,6 @@ TEST_F(AuthenticatorImplTest, GetPublicKey) {
GetTestPublicKeyCredentialParameters(static_cast<int32_t>(test.algo));
TestMakeCredentialCallback callback;
authenticator->MakeCredential(std::move(options), callback.callback());
base::RunLoop().RunUntilIdle();
callback.WaitForCallback();
ASSERT_EQ(callback.status(), AuthenticatorStatus::SUCCESS);
......@@ -3572,29 +3449,24 @@ TEST_F(AuthenticatorImplTest, ResetDiscoveryFactoryOverride) {
// This is a regression test for crbug.com/1087158.
NavigateAndCommit(GURL(kTestOrigin1));
base::RunLoop run_loop;
// Make the entire discovery factory disappear mid-request.
bool was_called = false;
virtual_device_factory_->SetSupportedProtocol(
device::ProtocolVersion::kCtap2);
virtual_device_factory_->mutable_state()->simulate_press_callback =
base::BindLambdaForTesting([&](device::VirtualFidoDevice* device) {
run_loop.QuitClosure().Run();
was_called = true;
ResetVirtualDevice();
return false;
});
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
mojo::Remote<blink::mojom::Authenticator> authenticator =
ConstructAuthenticatorWithTimer(task_runner);
auto authenticator = ConnectToAuthenticator();
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
TestMakeCredentialCallback callback;
authenticator->MakeCredential(std::move(options), callback.callback());
// Reset the FidoDiscoveryFactory while the request is processing, then let it
// time out.
run_loop.Run();
ResetVirtualDevice();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
task_environment()->FastForwardBy(kTestTimeout);
callback.WaitForCallback();
EXPECT_EQ(callback.status(), AuthenticatorStatus::NOT_ALLOWED_ERROR);
......@@ -4396,11 +4268,8 @@ TEST_F(InternalUVAuthenticatorImplTest, MakeCredentialFallBackToPin) {
}
TEST_F(InternalUVAuthenticatorImplTest, MakeCredentialCryptotoken) {
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto authenticator = ConstructAuthenticatorWithTimer(task_runner);
OverrideLastCommittedOrigin(main_rfh(),
url::Origin::Create(GURL(kCryptotokenOrigin)));
SimulateNavigation(GURL(kCryptotokenOrigin));
auto authenticator = ConnectToAuthenticator();
for (const auto fingerprints_enrolled : {false, true}) {
SCOPED_TRACE(::testing::Message()
......@@ -4558,10 +4427,7 @@ TEST_F(InternalUVAuthenticatorImplTest, GetAssertionFallbackToPIN) {
}
TEST_F(InternalUVAuthenticatorImplTest, GetAssertionCryptotoken) {
mojo::Remote<blink::mojom::Authenticator> authenticator =
ConnectToAuthenticator();
OverrideLastCommittedOrigin(main_rfh(),
url::Origin::Create(GURL(kCryptotokenOrigin)));
SimulateNavigation(GURL(kCryptotokenOrigin));
ASSERT_TRUE(virtual_device_factory_->mutable_state()->InjectRegistration(
get_credential_options()->allow_credentials[0].id(),
kTestRelyingPartyId));
......@@ -4571,6 +4437,7 @@ TEST_F(InternalUVAuthenticatorImplTest, GetAssertionCryptotoken) {
<< "fingerprints_enrolled=" << fingerprints_enrolled);
virtual_device_factory_->mutable_state()->fingerprints_enrolled =
fingerprints_enrolled;
auto authenticator = ConnectToAuthenticator();
TestGetAssertionCallback callback_receiver;
authenticator->GetAssertion(
get_credential_options(device::UserVerificationRequirement::kPreferred),
......@@ -5783,7 +5650,7 @@ class InternalAuthenticatorImplTest : public AuthenticatorTestBase {
void TearDown() override {
// The |RenderFrameHost| must outlive |AuthenticatorImpl|.
internal_authenticator_impl_.reset();
content::RenderViewHostTestHarness::TearDown();
AuthenticatorTestBase::TearDown();
}
void NavigateAndCommit(const GURL& url) {
......@@ -5800,26 +5667,6 @@ class InternalAuthenticatorImplTest : public AuthenticatorTestBase {
return internal_authenticator_impl_.get();
}
InternalAuthenticatorImpl* ConnectToAuthenticator(
const url::Origin& effective_origin_url,
std::unique_ptr<base::OneShotTimer> timer) {
internal_authenticator_impl_.reset(new InternalAuthenticatorImpl(
main_rfh(),
std::make_unique<AuthenticatorCommon>(main_rfh(), std::move(timer))));
internal_authenticator_impl_->SetEffectiveOrigin(effective_origin_url);
return internal_authenticator_impl_.get();
}
InternalAuthenticatorImpl* ConstructAuthenticatorWithTimer(
const url::Origin& effective_origin_url,
scoped_refptr<base::TestMockTimeTaskRunner> task_runner) {
// Set up a timer for testing.
auto timer =
std::make_unique<base::OneShotTimer>(task_runner->GetMockTickClock());
timer->SetTaskRunner(task_runner);
return ConnectToAuthenticator(effective_origin_url, std::move(timer));
}
protected:
std::unique_ptr<InternalAuthenticatorImpl> internal_authenticator_impl_;
};
......@@ -5858,10 +5705,8 @@ TEST_F(InternalAuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
std::string(test_case.origin));
NavigateAndCommit(GURL("https://this.isthewrong.origin"));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto* authenticator = ConstructAuthenticatorWithTimer(
url::Origin::Create(GURL(test_case.origin)), task_runner);
auto* authenticator =
GetAuthenticator(url::Origin::Create(GURL(test_case.origin)));
PublicKeyCredentialCreationOptionsPtr options =
GetTestPublicKeyCredentialCreationOptions();
options->relying_party.id = test_case.claimed_authority;
......@@ -5912,10 +5757,8 @@ TEST_F(InternalAuthenticatorImplTest, GetAssertionOriginAndRpIds) {
std::string(test_case.origin));
NavigateAndCommit(GURL("https://this.isthewrong.origin"));
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
base::Time::Now(), base::TimeTicks::Now());
auto* authenticator = ConstructAuthenticatorWithTimer(
url::Origin::Create(GURL(test_case.origin)), task_runner);
InternalAuthenticatorImpl* authenticator =
GetAuthenticator(url::Origin::Create(GURL(test_case.origin)));
PublicKeyCredentialRequestOptionsPtr options =
GetTestPublicKeyCredentialRequestOptions();
options->relying_party_id = test_case.claimed_authority;
......
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