Commit 3c2bc47d authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Make PlatformVerificationFlow::ChallengeCallback a base::OnceCallback

PlatformVerificationFlow::ChallengeCallback was previously unspecified
as to whether it was a base::OnceCallback or base::RepeatingCallback
(base::Callback aliases base::RepeatingCallback and should not be used).

Since it's really a base::OnceCallback, this CL changes it to be that
and adjusts the surrounding code appropriately.

Bug: 1007635
Change-Id: Idf531ef4e2048cc31ed4d6ce15559dd3543725f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321793Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Will Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#792735}
parent 61152320
...@@ -67,8 +67,9 @@ class AttestationDevicePolicyTest ...@@ -67,8 +67,9 @@ class AttestationDevicePolicyTest
nullptr, nullptr, chromeos::FakeCryptohomeClient::Get(), nullptr)); nullptr, nullptr, chromeos::FakeCryptohomeClient::Get(), nullptr));
verifier->ChallengePlatformKey( verifier->ChallengePlatformKey(
browser()->tab_strip_model()->GetActiveWebContents(), "fake_service_id", browser()->tab_strip_model()->GetActiveWebContents(), "fake_service_id",
"fake_challenge", base::Bind(&AttestationDevicePolicyTest::Callback, "fake_challenge",
base::Unretained(this))); base::BindOnce(&AttestationDevicePolicyTest::Callback,
base::Unretained(this)));
WaitForAsyncOperation(); WaitForAsyncOperation();
return result_; return result_;
} }
......
...@@ -115,11 +115,11 @@ class PlatformVerificationFlow ...@@ -115,11 +115,11 @@ class PlatformVerificationFlow
// signature. This key may be generated on demand and is not guaranteed to // signature. This key may be generated on demand and is not guaranteed to
// persist across multiple calls to this method. The browser does not check // persist across multiple calls to this method. The browser does not check
// the validity of |signature| or |platform_key_certificate|. // the validity of |signature| or |platform_key_certificate|.
typedef base::Callback<void(Result result, using ChallengeCallback =
base::OnceCallback<void(Result result,
const std::string& signed_data, const std::string& signed_data,
const std::string& signature, const std::string& signature,
const std::string& platform_key_certificate)> const std::string& platform_key_certificate)>;
ChallengeCallback;
// A constructor that uses the default implementation of all dependencies // A constructor that uses the default implementation of all dependencies
// including Delegate. // including Delegate.
...@@ -145,7 +145,7 @@ class PlatformVerificationFlow ...@@ -145,7 +145,7 @@ class PlatformVerificationFlow
void ChallengePlatformKey(content::WebContents* web_contents, void ChallengePlatformKey(content::WebContents* web_contents,
const std::string& service_id, const std::string& service_id,
const std::string& challenge, const std::string& challenge,
const ChallengeCallback& callback); ChallengeCallback callback);
void set_timeout_delay(const base::TimeDelta& timeout_delay) { void set_timeout_delay(const base::TimeDelta& timeout_delay) {
timeout_delay_ = timeout_delay; timeout_delay_ = timeout_delay;
...@@ -161,8 +161,8 @@ class PlatformVerificationFlow ...@@ -161,8 +161,8 @@ class PlatformVerificationFlow
ChallengeContext(content::WebContents* web_contents, ChallengeContext(content::WebContents* web_contents,
const std::string& service_id, const std::string& service_id,
const std::string& challenge, const std::string& challenge,
const ChallengeCallback& callback); ChallengeCallback callback);
ChallengeContext(const ChallengeContext& other); ChallengeContext(ChallengeContext&& other);
~ChallengeContext(); ~ChallengeContext();
content::WebContents* web_contents; content::WebContents* web_contents;
...@@ -176,7 +176,7 @@ class PlatformVerificationFlow ...@@ -176,7 +176,7 @@ class PlatformVerificationFlow
// Callback for attestation preparation. The arguments to ChallengePlatformKey // Callback for attestation preparation. The arguments to ChallengePlatformKey
// are in |context|, and |attestation_prepared| specifies whether attestation // are in |context|, and |attestation_prepared| specifies whether attestation
// has been prepared on this device. // has been prepared on this device.
void OnAttestationPrepared(const ChallengeContext& context, void OnAttestationPrepared(ChallengeContext context,
bool attestation_prepared); bool attestation_prepared);
// Initiates the flow to get a platform key certificate. The arguments to // Initiates the flow to get a platform key certificate. The arguments to
...@@ -184,9 +184,10 @@ class PlatformVerificationFlow ...@@ -184,9 +184,10 @@ class PlatformVerificationFlow
// for which to get a certificate. If |force_new_key| is true then any // for which to get a certificate. If |force_new_key| is true then any
// existing key for the same user and service will be ignored and a new key // existing key for the same user and service will be ignored and a new key
// will be generated and certified. // will be generated and certified.
void GetCertificate(const ChallengeContext& context, void GetCertificate(
const AccountId& account_id, scoped_refptr<base::RefCountedData<ChallengeContext>> context,
bool force_new_key); const AccountId& account_id,
bool force_new_key);
// A callback called when an attestation certificate request operation // A callback called when an attestation certificate request operation
// completes. The arguments to ChallengePlatformKey are in |context|. // completes. The arguments to ChallengePlatformKey are in |context|.
...@@ -197,16 +198,18 @@ class PlatformVerificationFlow ...@@ -197,16 +198,18 @@ class PlatformVerificationFlow
// a request to sign the challenge. If the operation timed out prior to this // a request to sign the challenge. If the operation timed out prior to this
// method being called, this method does nothing - notably, the callback is // method being called, this method does nothing - notably, the callback is
// not invoked. // not invoked.
void OnCertificateReady(const ChallengeContext& context, void OnCertificateReady(
const AccountId& account_id, scoped_refptr<base::RefCountedData<ChallengeContext>> context,
std::unique_ptr<base::OneShotTimer> timer, const AccountId& account_id,
AttestationStatus operation_status, std::unique_ptr<base::OneShotTimer> timer,
const std::string& certificate_chain); AttestationStatus operation_status,
const std::string& certificate_chain);
// A callback run after a constant delay to handle timeouts for lengthy // A callback run after a constant delay to handle timeouts for lengthy
// certificate requests. |context.callback| will be invoked with a TIMEOUT // certificate requests. |context.callback| will be invoked with a TIMEOUT
// result. // result.
void OnCertificateTimeout(const ChallengeContext& context); void OnCertificateTimeout(
scoped_refptr<base::RefCountedData<ChallengeContext>> context);
// A callback called when a challenge signing request has completed. The // A callback called when a challenge signing request has completed. The
// |certificate_chain| is the platform certificate chain for the key which // |certificate_chain| is the platform certificate chain for the key which
...@@ -217,7 +220,7 @@ class PlatformVerificationFlow ...@@ -217,7 +220,7 @@ class PlatformVerificationFlow
// challenge signing operation was successful. If it was successful, // challenge signing operation was successful. If it was successful,
// |response_data| holds the challenge response and the method will invoke // |response_data| holds the challenge response and the method will invoke
// |context.callback|. // |context.callback|.
void OnChallengeReady(const ChallengeContext& context, void OnChallengeReady(ChallengeContext context,
const AccountId& account_id, const AccountId& account_id,
const std::string& certificate_chain, const std::string& certificate_chain,
bool is_expiring_soon, bool is_expiring_soon,
......
...@@ -112,13 +112,15 @@ class PlatformVerificationFlowTest : public ::testing::Test { ...@@ -112,13 +112,15 @@ class PlatformVerificationFlowTest : public ::testing::Test {
&fake_delegate_); &fake_delegate_);
// Create callbacks for tests to use with verifier_. // Create callbacks for tests to use with verifier_.
callback_ = base::Bind(&PlatformVerificationFlowTest::FakeChallengeCallback,
base::Unretained(this));
settings_helper_.ReplaceDeviceSettingsProviderWithStub(); settings_helper_.ReplaceDeviceSettingsProviderWithStub();
settings_helper_.SetBoolean(kAttestationForContentProtectionEnabled, true); settings_helper_.SetBoolean(kAttestationForContentProtectionEnabled, true);
} }
PlatformVerificationFlow::ChallengeCallback CreateChallengeCallback() {
return base::BindOnce(&PlatformVerificationFlowTest::FakeChallengeCallback,
base::Unretained(this));
}
void ExpectAttestationFlow() { void ExpectAttestationFlow() {
// When consent is not given or the feature is disabled, it is important // When consent is not given or the feature is disabled, it is important
// that there are no calls to the attestation service. Thus, a test must // that there are no calls to the attestation service. Thus, a test must
...@@ -196,7 +198,6 @@ class PlatformVerificationFlowTest : public ::testing::Test { ...@@ -196,7 +198,6 @@ class PlatformVerificationFlowTest : public ::testing::Test {
bool sign_challenge_success_; bool sign_challenge_success_;
// Callback functions and data. // Callback functions and data.
PlatformVerificationFlow::ChallengeCallback callback_;
PlatformVerificationFlow::Result result_; PlatformVerificationFlow::Result result_;
std::string challenge_salt_; std::string challenge_salt_;
std::string challenge_signature_; std::string challenge_signature_;
...@@ -205,7 +206,8 @@ class PlatformVerificationFlowTest : public ::testing::Test { ...@@ -205,7 +206,8 @@ class PlatformVerificationFlowTest : public ::testing::Test {
TEST_F(PlatformVerificationFlowTest, Success) { TEST_F(PlatformVerificationFlowTest, Success) {
ExpectAttestationFlow(); ExpectAttestationFlow();
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(kTestSignedData, challenge_salt_); EXPECT_EQ(kTestSignedData, challenge_salt_);
...@@ -215,14 +217,16 @@ TEST_F(PlatformVerificationFlowTest, Success) { ...@@ -215,14 +217,16 @@ TEST_F(PlatformVerificationFlowTest, Success) {
TEST_F(PlatformVerificationFlowTest, NotPermittedByUser) { TEST_F(PlatformVerificationFlowTest, NotPermittedByUser) {
fake_delegate_.set_is_permitted_by_user(false); fake_delegate_.set_is_permitted_by_user(false);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::USER_REJECTED, result_); EXPECT_EQ(PlatformVerificationFlow::USER_REJECTED, result_);
} }
TEST_F(PlatformVerificationFlowTest, FeatureDisabledByPolicy) { TEST_F(PlatformVerificationFlowTest, FeatureDisabledByPolicy) {
settings_helper_.SetBoolean(kAttestationForContentProtectionEnabled, false); settings_helper_.SetBoolean(kAttestationForContentProtectionEnabled, false);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::POLICY_REJECTED, result_); EXPECT_EQ(PlatformVerificationFlow::POLICY_REJECTED, result_);
} }
...@@ -230,7 +234,8 @@ TEST_F(PlatformVerificationFlowTest, FeatureDisabledByPolicy) { ...@@ -230,7 +234,8 @@ TEST_F(PlatformVerificationFlowTest, FeatureDisabledByPolicy) {
TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToUnspeciedFailure) { TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToUnspeciedFailure) {
certificate_status_ = ATTESTATION_UNSPECIFIED_FAILURE; certificate_status_ = ATTESTATION_UNSPECIFIED_FAILURE;
ExpectAttestationFlow(); ExpectAttestationFlow();
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_); EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_);
} }
...@@ -238,7 +243,8 @@ TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToUnspeciedFailure) { ...@@ -238,7 +243,8 @@ TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToUnspeciedFailure) {
TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToBadRequestFailure) { TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToBadRequestFailure) {
certificate_status_ = ATTESTATION_SERVER_BAD_REQUEST_FAILURE; certificate_status_ = ATTESTATION_SERVER_BAD_REQUEST_FAILURE;
ExpectAttestationFlow(); ExpectAttestationFlow();
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_); EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_);
} }
...@@ -246,14 +252,16 @@ TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToBadRequestFailure) { ...@@ -246,14 +252,16 @@ TEST_F(PlatformVerificationFlowTest, NotVerifiedDueToBadRequestFailure) {
TEST_F(PlatformVerificationFlowTest, ChallengeSigningError) { TEST_F(PlatformVerificationFlowTest, ChallengeSigningError) {
sign_challenge_success_ = false; sign_challenge_success_ = false;
ExpectAttestationFlow(); ExpectAttestationFlow();
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::INTERNAL_ERROR, result_); EXPECT_EQ(PlatformVerificationFlow::INTERNAL_ERROR, result_);
} }
TEST_F(PlatformVerificationFlowTest, DBusFailure) { TEST_F(PlatformVerificationFlowTest, DBusFailure) {
fake_cryptohome_client_.SetServiceIsAvailable(false); fake_cryptohome_client_.SetServiceIsAvailable(false);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::INTERNAL_ERROR, result_); EXPECT_EQ(PlatformVerificationFlow::INTERNAL_ERROR, result_);
} }
...@@ -261,7 +269,8 @@ TEST_F(PlatformVerificationFlowTest, DBusFailure) { ...@@ -261,7 +269,8 @@ TEST_F(PlatformVerificationFlowTest, DBusFailure) {
TEST_F(PlatformVerificationFlowTest, Timeout) { TEST_F(PlatformVerificationFlowTest, Timeout) {
verifier_->set_timeout_delay(base::TimeDelta::FromSeconds(0)); verifier_->set_timeout_delay(base::TimeDelta::FromSeconds(0));
ExpectAttestationFlow(); ExpectAttestationFlow();
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::TIMEOUT, result_); EXPECT_EQ(PlatformVerificationFlow::TIMEOUT, result_);
} }
...@@ -277,7 +286,8 @@ TEST_F(PlatformVerificationFlowTest, ExpiredCert) { ...@@ -277,7 +286,8 @@ TEST_F(PlatformVerificationFlowTest, ExpiredCert) {
// that it does not pass through the certificate expiry check again. // that it does not pass through the certificate expiry check again.
ASSERT_TRUE(GetFakeCertificatePEM(base::TimeDelta::FromDays(-1), ASSERT_TRUE(GetFakeCertificatePEM(base::TimeDelta::FromDays(-1),
&fake_certificate_list_[2])); &fake_certificate_list_[2]));
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(fake_certificate_list_[1], certificate_); EXPECT_EQ(fake_certificate_list_[1], certificate_);
...@@ -297,7 +307,8 @@ TEST_F(PlatformVerificationFlowTest, ExpiredIntermediateCert) { ...@@ -297,7 +307,8 @@ TEST_F(PlatformVerificationFlowTest, ExpiredIntermediateCert) {
fake_certificate_list_[0] = leaf_cert + intermediate_cert; fake_certificate_list_[0] = leaf_cert + intermediate_cert;
ASSERT_TRUE(GetFakeCertificatePEM(base::TimeDelta::FromDays(90), ASSERT_TRUE(GetFakeCertificatePEM(base::TimeDelta::FromDays(90),
&fake_certificate_list_[1])); &fake_certificate_list_[1]));
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(fake_certificate_list_[1], certificate_); EXPECT_EQ(fake_certificate_list_[1], certificate_);
...@@ -312,9 +323,12 @@ TEST_F(PlatformVerificationFlowTest, AsyncRenewalMultipleHits) { ...@@ -312,9 +323,12 @@ TEST_F(PlatformVerificationFlowTest, AsyncRenewalMultipleHits) {
&fake_certificate_list_[0])); &fake_certificate_list_[0]));
std::fill(fake_certificate_list_.begin() + 1, fake_certificate_list_.end(), std::fill(fake_certificate_list_.begin() + 1, fake_certificate_list_.end(),
fake_certificate_list_[0]); fake_certificate_list_[0]);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); CreateChallengeCallback());
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(fake_certificate_list_[0], certificate_); EXPECT_EQ(fake_certificate_list_[0], certificate_);
...@@ -325,7 +339,8 @@ TEST_F(PlatformVerificationFlowTest, AsyncRenewalMultipleHits) { ...@@ -325,7 +339,8 @@ TEST_F(PlatformVerificationFlowTest, AsyncRenewalMultipleHits) {
TEST_F(PlatformVerificationFlowTest, CertificateNotPEM) { TEST_F(PlatformVerificationFlowTest, CertificateNotPEM) {
ExpectAttestationFlow(); ExpectAttestationFlow();
fake_certificate_list_.push_back("invalid_pem"); fake_certificate_list_.push_back("invalid_pem");
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(fake_certificate_list_[0], certificate_); EXPECT_EQ(fake_certificate_list_[0], certificate_);
...@@ -349,7 +364,8 @@ TEST_F(PlatformVerificationFlowTest, CertificateNotX509) { ...@@ -349,7 +364,8 @@ TEST_F(PlatformVerificationFlowTest, CertificateNotX509) {
"M1pXeFdXR1ZHWkZWaVJYQmFWa2QwCk5GSkdjRFlLVFVSc1JGcDZNRGxEWnowOUNnPT0K\n" "M1pXeFdXR1ZHWkZWaVJYQmFWa2QwCk5GSkdjRFlLVFVSc1JGcDZNRGxEWnowOUNnPT0K\n"
"-----END CERTIFICATE-----\n"; "-----END CERTIFICATE-----\n";
fake_certificate_list_.push_back(not_x509); fake_certificate_list_.push_back(not_x509);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_); EXPECT_EQ(PlatformVerificationFlow::SUCCESS, result_);
EXPECT_EQ(fake_certificate_list_[0], certificate_); EXPECT_EQ(fake_certificate_list_[0], certificate_);
...@@ -357,7 +373,8 @@ TEST_F(PlatformVerificationFlowTest, CertificateNotX509) { ...@@ -357,7 +373,8 @@ TEST_F(PlatformVerificationFlowTest, CertificateNotX509) {
TEST_F(PlatformVerificationFlowTest, UnsupportedMode) { TEST_F(PlatformVerificationFlowTest, UnsupportedMode) {
fake_delegate_.set_is_in_supported_mode(false); fake_delegate_.set_is_in_supported_mode(false);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_); EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_);
} }
...@@ -365,7 +382,8 @@ TEST_F(PlatformVerificationFlowTest, UnsupportedMode) { ...@@ -365,7 +382,8 @@ TEST_F(PlatformVerificationFlowTest, UnsupportedMode) {
TEST_F(PlatformVerificationFlowTest, AttestationNotPrepared) { TEST_F(PlatformVerificationFlowTest, AttestationNotPrepared) {
fake_cryptohome_client_.set_tpm_attestation_is_enrolled(false); fake_cryptohome_client_.set_tpm_attestation_is_enrolled(false);
fake_cryptohome_client_.set_tpm_attestation_is_prepared(false); fake_cryptohome_client_.set_tpm_attestation_is_prepared(false);
verifier_->ChallengePlatformKey(NULL, kTestID, kTestChallenge, callback_); verifier_->ChallengePlatformKey(nullptr, kTestID, kTestChallenge,
CreateChallengeCallback());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_); EXPECT_EQ(PlatformVerificationFlow::PLATFORM_NOT_VERIFIED, result_);
} }
......
...@@ -89,8 +89,8 @@ void PlatformVerificationImpl::ChallengePlatform( ...@@ -89,8 +89,8 @@ void PlatformVerificationImpl::ChallengePlatform(
platform_verification_flow_->ChallengePlatformKey( platform_verification_flow_->ChallengePlatformKey(
content::WebContents::FromRenderFrameHost(render_frame_host()), content::WebContents::FromRenderFrameHost(render_frame_host()),
service_id, challenge, service_id, challenge,
base::Bind(&PlatformVerificationImpl::OnPlatformChallenged, base::BindOnce(&PlatformVerificationImpl::OnPlatformChallenged,
weak_factory_.GetWeakPtr(), base::Passed(&callback))); weak_factory_.GetWeakPtr(), base::Passed(&callback)));
#else #else
// Not supported, so return failure. // Not supported, so return failure.
std::move(callback).Run(false, std::string(), std::string(), std::string()); std::move(callback).Run(false, std::string(), std::string(), std::string());
......
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