Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2944)

Unified Diff: chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
index 5219c167014e0bb8737eb9a89303788bba690a09..1599299fa326768c0279c1f915fbdae5b1099bf5 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys_private/enterprise_platform_keys_private_api_unittest.cc
@@ -23,6 +23,7 @@
#include "chromeos/attestation/attestation_constants.h"
#include "chromeos/attestation/mock_attestation_flow.h"
#include "chromeos/cryptohome/async_method_caller.h"
+#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/cryptohome/mock_async_method_caller.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/mock_cryptohome_client.h"
@@ -74,7 +75,7 @@ class FakeBoolDBusMethod {
void RegisterKeyCallbackTrue(
chromeos::attestation::AttestationKeyType key_type,
- const std::string& user_id,
+ const cryptohome::Identification& user_id,
const std::string& key_name,
const cryptohome::AsyncMethodCaller::Callback& callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -84,7 +85,7 @@ void RegisterKeyCallbackTrue(
void RegisterKeyCallbackFalse(
chromeos::attestation::AttestationKeyType key_type,
- const std::string& user_id,
+ const cryptohome::Identification& user_id,
const std::string& key_name,
const cryptohome::AsyncMethodCaller::Callback& callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -94,7 +95,7 @@ void RegisterKeyCallbackFalse(
void SignChallengeCallbackTrue(
chromeos::attestation::AttestationKeyType key_type,
- const std::string& user_id,
+ const cryptohome::Identification& user_id,
const std::string& key_name,
const std::string& domain,
const std::string& device_id,
@@ -108,7 +109,7 @@ void SignChallengeCallbackTrue(
void SignChallengeCallbackFalse(
chromeos::attestation::AttestationKeyType key_type,
- const std::string& user_id,
+ const cryptohome::Identification& user_id,
const std::string& key_name,
const std::string& domain,
const std::string& device_id,
@@ -122,7 +123,7 @@ void SignChallengeCallbackFalse(
void GetCertificateCallbackTrue(
chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const std::string& user_id,
+ const AccountId& account_id,
const std::string& request_origin,
bool force_new_key,
const chromeos::attestation::AttestationFlow::CertificateCallback&
@@ -134,7 +135,7 @@ void GetCertificateCallbackTrue(
void GetCertificateCallbackFalse(
chromeos::attestation::AttestationCertificateProfile certificate_profile,
- const std::string& user_id,
+ const AccountId& account_id,
const std::string& request_origin,
bool force_new_key,
const chromeos::attestation::AttestationFlow::CertificateCallback&
@@ -305,10 +306,12 @@ TEST_F(EPKPChallengeMachineKeyTest, Success) {
_, _, _, _))
.Times(1);
// SignEnterpriseChallenge must be called exactly once.
- EXPECT_CALL(mock_async_method_caller_,
- TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_DEVICE, "", "attest-ent-machine",
- "google.com", "device_id", _, "challenge", _))
+ EXPECT_CALL(
+ mock_async_method_caller_,
+ TpmAttestationSignEnterpriseChallenge(
+ chromeos::attestation::KEY_DEVICE,
+ cryptohome::Identification(EmptyAccountId()), "attest-ent-machine",
+ "google.com", "device_id", _, "challenge", _))
.Times(1);
scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult(
@@ -464,17 +467,19 @@ TEST_F(EPKPChallengeUserKeyTest, Success) {
chromeos::attestation::PROFILE_ENTERPRISE_USER_CERTIFICATE,
_, _, _, _))
.Times(1);
+ const AccountId account_id = AccountId::FromUserEmail(kUserEmail);
// SignEnterpriseChallenge must be called exactly once.
EXPECT_CALL(mock_async_method_caller_,
TpmAttestationSignEnterpriseChallenge(
- chromeos::attestation::KEY_USER, kUserEmail,
- "attest-ent-user", kUserEmail, "device_id", _,
+ chromeos::attestation::KEY_USER,
+ cryptohome::Identification(account_id), "attest-ent-user",
+ cryptohome::Identification(account_id).id(), "device_id", _,
"challenge", _))
.Times(1);
// RegisterKey must be called exactly once.
EXPECT_CALL(mock_async_method_caller_,
TpmAttestationRegisterKey(chromeos::attestation::KEY_USER,
- kUserEmail,
+ cryptohome::Identification(account_id),
"attest-ent-user", _))
.Times(1);

Powered by Google App Engine
This is Rietveld 408576698