Commit 88e00e57 authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

webauthn: use the already in-scope |AuthenticatorStatus| directly.

Change-Id: I58d9c9025e238c0ff6824f0e5b39e299a7a86272
Reviewed-on: https://chromium-review.googlesource.com/961789
Commit-Queue: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543206}
parent bc2c5f12
...@@ -364,8 +364,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) { ...@@ -364,8 +364,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
TestMakeCredentialCallback cb; TestMakeCredentialCallback cb;
authenticator->MakeCredential(std::move(options), cb.callback()); authenticator->MakeCredential(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN, EXPECT_EQ(AuthenticatorStatus::INVALID_DOMAIN, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// These instances pass the origin and relying party checks and return at // These instances pass the origin and relying party checks and return at
...@@ -384,8 +383,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) { ...@@ -384,8 +383,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
TestMakeCredentialCallback cb; TestMakeCredentialCallback cb;
authenticator->MakeCredential(std::move(options), cb.callback()); authenticator->MakeCredential(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_SUPPORTED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
} }
...@@ -402,8 +400,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialNoSupportedAlgorithm) { ...@@ -402,8 +400,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialNoSupportedAlgorithm) {
TestMakeCredentialCallback cb; TestMakeCredentialCallback cb;
authenticator->MakeCredential(std::move(options), cb.callback()); authenticator->MakeCredential(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_SUPPORTED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// Test that service returns NOT_SUPPORTED_ERROR if user verification is // Test that service returns NOT_SUPPORTED_ERROR if user verification is
...@@ -419,8 +416,7 @@ TEST_F(AuthenticatorImplTest, GetAssertionUserVerification) { ...@@ -419,8 +416,7 @@ TEST_F(AuthenticatorImplTest, GetAssertionUserVerification) {
TestGetAssertionCallback cb; TestGetAssertionCallback cb;
authenticator->GetAssertion(std::move(options), cb.callback()); authenticator->GetAssertion(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_SUPPORTED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// Test that service returns NOT_SUPPORTED_ERROR if user verification is // Test that service returns NOT_SUPPORTED_ERROR if user verification is
...@@ -437,8 +433,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialUserVerification) { ...@@ -437,8 +433,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialUserVerification) {
TestMakeCredentialCallback cb; TestMakeCredentialCallback cb;
authenticator->MakeCredential(std::move(options), cb.callback()); authenticator->MakeCredential(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_SUPPORTED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// Test that service returns NOT_SUPPORTED_ERROR if resident key is // Test that service returns NOT_SUPPORTED_ERROR if resident key is
...@@ -454,8 +449,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialResidentKey) { ...@@ -454,8 +449,7 @@ TEST_F(AuthenticatorImplTest, MakeCredentialResidentKey) {
TestMakeCredentialCallback cb; TestMakeCredentialCallback cb;
authenticator->MakeCredential(std::move(options), cb.callback()); authenticator->MakeCredential(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_SUPPORTED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// Parses its arguments as JSON and expects that all the keys in the first are // Parses its arguments as JSON and expects that all the keys in the first are
...@@ -552,8 +546,7 @@ TEST_F(AuthenticatorImplTest, TestMakeCredentialTimeout) { ...@@ -552,8 +546,7 @@ TEST_F(AuthenticatorImplTest, TestMakeCredentialTimeout) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1)); task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// Verify behavior for various combinations of origins and RP IDs. // Verify behavior for various combinations of origins and RP IDs.
...@@ -574,8 +567,7 @@ TEST_F(AuthenticatorImplTest, GetAssertionOriginAndRpIds) { ...@@ -574,8 +567,7 @@ TEST_F(AuthenticatorImplTest, GetAssertionOriginAndRpIds) {
TestGetAssertionCallback cb; TestGetAssertionCallback cb;
authenticator->GetAssertion(std::move(options), cb.callback()); authenticator->GetAssertion(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN, EXPECT_EQ(AuthenticatorStatus::INVALID_DOMAIN, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
} }
...@@ -626,8 +618,7 @@ TEST_F(AuthenticatorImplTest, AppIdExtension) { ...@@ -626,8 +618,7 @@ TEST_F(AuthenticatorImplTest, AppIdExtension) {
TestGetAssertionCallback cb; TestGetAssertionCallback cb;
authenticator->GetAssertion(std::move(options), cb.callback()); authenticator->GetAssertion(std::move(options), cb.callback());
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN, EXPECT_EQ(AuthenticatorStatus::INVALID_DOMAIN, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
// TODO(agl): test positive cases once a mock U2F device exists. // TODO(agl): test positive cases once a mock U2F device exists.
...@@ -665,7 +656,6 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionTimeout) { ...@@ -665,7 +656,6 @@ TEST_F(AuthenticatorImplTest, TestGetAssertionTimeout) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1)); task_runner->FastForwardBy(base::TimeDelta::FromMinutes(1));
cb.WaitForCallback(); cb.WaitForCallback();
EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, EXPECT_EQ(AuthenticatorStatus::NOT_ALLOWED_ERROR, cb.GetResponseStatus());
cb.GetResponseStatus());
} }
} // namespace content } // namespace content
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