Commit ebf7b226 authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

Prefix unit tests in device_sync with "DeviceSync"

Add the prefix "DeviceSync" to all unit tests in the
chromeos/service/device_sync directory so all tests can be run with
--gtest-filter="DeviceSync*".

Bug: 899080
Change-Id: I0ed1124daa853da2c4ebecd2ec229dbcf5fea7bf
Reviewed-on: https://chromium-review.googlesource.com/c/1495796Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636569}
parent c2cae7d5
......@@ -98,9 +98,9 @@ void SaveResultConstRef(T* out, const T& result) {
} // namespace
class CryptAuthClientTest : public testing::Test {
class DeviceSyncCryptAuthClientTest : public testing::Test {
protected:
CryptAuthClientTest()
DeviceSyncCryptAuthClientTest()
: api_call_flow_(new StrictMock<MockCryptAuthApiCallFlow>()),
serialized_request_(std::string()) {
shared_factory_ =
......@@ -171,7 +171,7 @@ class CryptAuthClientTest : public testing::Test {
CryptAuthApiCallFlow::ErrorCallback flow_error_callback_;
};
TEST_F(CryptAuthClientTest, GetMyDevicesSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, GetMyDevicesSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"getmydevices?alt=proto");
......@@ -216,7 +216,7 @@ TEST_F(CryptAuthClientTest, GetMyDevicesSuccess) {
EXPECT_TRUE(result_proto.devices(1).unlockable());
}
TEST_F(CryptAuthClientTest, GetMyDevicesFailure) {
TEST_F(DeviceSyncCryptAuthClientTest, GetMyDevicesFailure) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"getmydevices?alt=proto");
......@@ -235,7 +235,7 @@ TEST_F(CryptAuthClientTest, GetMyDevicesFailure) {
EXPECT_EQ(NetworkRequestError::kInternalServerError, error);
}
TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"findeligibleunlockdevices?alt=proto");
......@@ -283,7 +283,7 @@ TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesSuccess) {
result_proto.ineligible_devices(0).reasons(0));
}
TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
TEST_F(DeviceSyncCryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"findeligibleunlockdevices?alt=proto");
......@@ -304,7 +304,7 @@ TEST_F(CryptAuthClientTest, FindEligibleUnlockDevicesFailure) {
EXPECT_EQ(NetworkRequestError::kAuthenticationError, error);
}
TEST_F(CryptAuthClientTest, FindEligibleForPromotionSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, FindEligibleForPromotionSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"findeligibleforpromotion?alt=proto");
......@@ -327,7 +327,7 @@ TEST_F(CryptAuthClientTest, FindEligibleForPromotionSuccess) {
FinishApiCallFlow(&response_proto);
}
TEST_F(CryptAuthClientTest, SendDeviceSyncTickleSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, SendDeviceSyncTickleSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"senddevicesynctickle?alt=proto");
......@@ -350,7 +350,7 @@ TEST_F(CryptAuthClientTest, SendDeviceSyncTickleSuccess) {
FinishApiCallFlow(&response_proto);
}
TEST_F(CryptAuthClientTest, ToggleEasyUnlockSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, ToggleEasyUnlockSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"toggleeasyunlock?alt=proto");
......@@ -379,7 +379,7 @@ TEST_F(CryptAuthClientTest, ToggleEasyUnlockSuccess) {
FinishApiCallFlow(&response_proto);
}
TEST_F(CryptAuthClientTest, SetupEnrollmentSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, SetupEnrollmentSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/enrollment/"
"setup?alt=proto");
......@@ -429,7 +429,7 @@ TEST_F(CryptAuthClientTest, SetupEnrollmentSuccess) {
EXPECT_EQ("ephemeral_key", result_proto.infos(0).server_ephemeral_key());
}
TEST_F(CryptAuthClientTest, FinishEnrollmentSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, FinishEnrollmentSuccess) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/enrollment/"
"finish?alt=proto");
......@@ -465,7 +465,7 @@ TEST_F(CryptAuthClientTest, FinishEnrollmentSuccess) {
EXPECT_EQ("OK", result_proto.status());
}
TEST_F(CryptAuthClientTest, SyncKeysSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, SyncKeysSuccess) {
ExpectRequest(
"https://cryptauthenrollment.testgoogleapis.com/v1:syncKeys?alt=proto");
......@@ -497,7 +497,7 @@ TEST_F(CryptAuthClientTest, SyncKeysSuccess) {
EXPECT_EQ(kRandomSessionId, result_proto.random_session_id());
}
TEST_F(CryptAuthClientTest, EnrollKeysSuccess) {
TEST_F(DeviceSyncCryptAuthClientTest, EnrollKeysSuccess) {
ExpectRequest(
"https://cryptauthenrollment.testgoogleapis.com/v1:enrollKeys?alt=proto");
......@@ -535,7 +535,7 @@ TEST_F(CryptAuthClientTest, EnrollKeysSuccess) {
result_proto.enroll_single_key_responses(0).certificate(0).common_name());
}
TEST_F(CryptAuthClientTest, FetchAccessTokenFailure) {
TEST_F(DeviceSyncCryptAuthClientTest, FetchAccessTokenFailure) {
NetworkRequestError error;
client_->GetMyDevices(
cryptauth::GetMyDevicesRequest(),
......@@ -549,7 +549,7 @@ TEST_F(CryptAuthClientTest, FetchAccessTokenFailure) {
EXPECT_EQ(NetworkRequestError::kAuthenticationError, error);
}
TEST_F(CryptAuthClientTest, ParseResponseProtoFailure) {
TEST_F(DeviceSyncCryptAuthClientTest, ParseResponseProtoFailure) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"getmydevices?alt=proto");
......@@ -568,7 +568,8 @@ TEST_F(CryptAuthClientTest, ParseResponseProtoFailure) {
EXPECT_EQ(NetworkRequestError::kResponseMalformed, error);
}
TEST_F(CryptAuthClientTest, MakeSecondRequestBeforeFirstRequestSucceeds) {
TEST_F(DeviceSyncCryptAuthClientTest,
MakeSecondRequestBeforeFirstRequestSucceeds) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"getmydevices?alt=proto");
......@@ -607,7 +608,8 @@ TEST_F(CryptAuthClientTest, MakeSecondRequestBeforeFirstRequestSucceeds) {
EXPECT_EQ(kPublicKey1, result_proto.devices(0).public_key());
}
TEST_F(CryptAuthClientTest, MakeSecondRequestAfterFirstRequestSucceeds) {
TEST_F(DeviceSyncCryptAuthClientTest,
MakeSecondRequestAfterFirstRequestSucceeds) {
// Make first request successfully.
{
ExpectRequest(
......@@ -643,7 +645,7 @@ TEST_F(CryptAuthClientTest, MakeSecondRequestAfterFirstRequestSucceeds) {
}
}
TEST_F(CryptAuthClientTest, DeviceClassifierIsSet) {
TEST_F(DeviceSyncCryptAuthClientTest, DeviceClassifierIsSet) {
ExpectRequest(
"https://www.testgoogleapis.com/cryptauth/v1/deviceSync/"
"getmydevices?alt=proto");
......@@ -674,7 +676,7 @@ TEST_F(CryptAuthClientTest, DeviceClassifierIsSet) {
DeviceTypeStringToEnum(device_classifier.device_type()));
}
TEST_F(CryptAuthClientTest, GetAccessTokenUsed) {
TEST_F(DeviceSyncCryptAuthClientTest, GetAccessTokenUsed) {
EXPECT_TRUE(client_->GetAccessTokenUsed().empty());
ExpectRequest(
......
......@@ -19,14 +19,14 @@ const char kFakePrivateKey[] = "fake-private-key";
} // namespace
TEST(CryptAuthKeyBundleTest, CreateKeyBundle) {
TEST(DeviceSyncCryptAuthKeyBundleTest, CreateKeyBundle) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
EXPECT_EQ(bundle.name(), CryptAuthKeyBundle::Name::kUserKeyPair);
EXPECT_TRUE(bundle.handle_to_key_map().empty());
EXPECT_FALSE(bundle.key_directive());
}
TEST(CryptAuthKeyBundleTest, SetKeyDirective) {
TEST(DeviceSyncCryptAuthKeyBundleTest, SetKeyDirective) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
cryptauthv2::KeyDirective key_directive;
bundle.set_key_directive(key_directive);
......@@ -35,7 +35,7 @@ TEST(CryptAuthKeyBundleTest, SetKeyDirective) {
key_directive.SerializeAsString());
}
TEST(CryptAuthKeyBundleTest, AddKey) {
TEST(DeviceSyncCryptAuthKeyBundleTest, AddKey) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256, kFakeSymmetricKeyHandle);
......@@ -48,7 +48,7 @@ TEST(CryptAuthKeyBundleTest, AddKey) {
EXPECT_EQ(it->second, key);
}
TEST(CryptAuthKeyBundleTest, AddKey_Inactive) {
TEST(DeviceSyncCryptAuthKeyBundleTest, AddKey_Inactive) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256,
......@@ -71,7 +71,7 @@ TEST(CryptAuthKeyBundleTest, AddKey_Inactive) {
CryptAuthKey::Status::kInactive);
}
TEST(CryptAuthKeyBundleTest, AddKey_ActiveKeyDeactivatesOthers) {
TEST(DeviceSyncCryptAuthKeyBundleTest, AddKey_ActiveKeyDeactivatesOthers) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256,
......@@ -94,7 +94,7 @@ TEST(CryptAuthKeyBundleTest, AddKey_ActiveKeyDeactivatesOthers) {
CryptAuthKey::Status::kActive);
}
TEST(CryptAuthKeyBundleTest, AddKey_ReplaceKeyWithSameHandle) {
TEST(DeviceSyncCryptAuthKeyBundleTest, AddKey_ReplaceKeyWithSameHandle) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256, "same-handle");
......@@ -110,7 +110,7 @@ TEST(CryptAuthKeyBundleTest, AddKey_ReplaceKeyWithSameHandle) {
asymmetric_key);
}
TEST(CryptAuthKeyBundleTest, GetActiveKey_DoesNotExist) {
TEST(DeviceSyncCryptAuthKeyBundleTest, GetActiveKey_DoesNotExist) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
EXPECT_FALSE(bundle.GetActiveKey());
......@@ -121,7 +121,7 @@ TEST(CryptAuthKeyBundleTest, GetActiveKey_DoesNotExist) {
EXPECT_FALSE(bundle.GetActiveKey());
}
TEST(CryptAuthKeyBundleTest, GetActiveKey_Exists) {
TEST(DeviceSyncCryptAuthKeyBundleTest, GetActiveKey_Exists) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......@@ -136,7 +136,7 @@ TEST(CryptAuthKeyBundleTest, GetActiveKey_Exists) {
EXPECT_EQ(*bundle.GetActiveKey(), asymmetric_key);
}
TEST(CryptAuthKeyBundleTest, SetActiveKey_InactiveToActive) {
TEST(DeviceSyncCryptAuthKeyBundleTest, SetActiveKey_InactiveToActive) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......@@ -158,7 +158,7 @@ TEST(CryptAuthKeyBundleTest, SetActiveKey_InactiveToActive) {
CryptAuthKey::Status::kInactive);
}
TEST(CryptAuthKeyBundleTest, SetActiveKey_ActiveToActive) {
TEST(DeviceSyncCryptAuthKeyBundleTest, SetActiveKey_ActiveToActive) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......@@ -180,7 +180,7 @@ TEST(CryptAuthKeyBundleTest, SetActiveKey_ActiveToActive) {
CryptAuthKey::Status::kActive);
}
TEST(CryptAuthKeyBundleTest, DeactivateKeys) {
TEST(DeviceSyncCryptAuthKeyBundleTest, DeactivateKeys) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......@@ -202,7 +202,7 @@ TEST(CryptAuthKeyBundleTest, DeactivateKeys) {
CryptAuthKey::Status::kInactive);
}
TEST(CryptAuthKeyBundleTest, DeleteKey) {
TEST(DeviceSyncCryptAuthKeyBundleTest, DeleteKey) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......@@ -214,7 +214,7 @@ TEST(CryptAuthKeyBundleTest, DeleteKey) {
EXPECT_TRUE(bundle.handle_to_key_map().empty());
}
TEST(CryptAuthKeyBundleTest, ToAndFromDictionary_Trivial) {
TEST(DeviceSyncCryptAuthKeyBundleTest, ToAndFromDictionary_Trivial) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
base::Optional<CryptAuthKeyBundle> bundle_from_dict =
CryptAuthKeyBundle::FromDictionary(bundle.AsDictionary());
......@@ -222,7 +222,7 @@ TEST(CryptAuthKeyBundleTest, ToAndFromDictionary_Trivial) {
EXPECT_EQ(*bundle_from_dict, bundle);
}
TEST(CryptAuthKeyBundleTest, ToAndFromDictionary) {
TEST(DeviceSyncCryptAuthKeyBundleTest, ToAndFromDictionary) {
CryptAuthKeyBundle bundle(CryptAuthKeyBundle::Name::kUserKeyPair);
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256,
......
......@@ -72,10 +72,10 @@ class FakeSecureMessageDelegateFactory
} // namespace
class CryptAuthKeyCreatorImplTest : public testing::Test {
class DeviceSyncCryptAuthKeyCreatorImplTest : public testing::Test {
protected:
CryptAuthKeyCreatorImplTest() = default;
~CryptAuthKeyCreatorImplTest() override = default;
DeviceSyncCryptAuthKeyCreatorImplTest() = default;
~DeviceSyncCryptAuthKeyCreatorImplTest() override = default;
void SetUp() override {
fake_secure_message_delegate_factory_ =
......@@ -116,10 +116,10 @@ class CryptAuthKeyCreatorImplTest : public testing::Test {
std::unique_ptr<CryptAuthKeyCreator> key_creator_;
DISALLOW_COPY_AND_ASSIGN(CryptAuthKeyCreatorImplTest);
DISALLOW_COPY_AND_ASSIGN(DeviceSyncCryptAuthKeyCreatorImplTest);
};
TEST_F(CryptAuthKeyCreatorImplTest, AsymmetricKeyCreation) {
TEST_F(DeviceSyncCryptAuthKeyCreatorImplTest, AsymmetricKeyCreation) {
base::flat_map<CryptAuthKeyBundle::Name, CryptAuthKeyCreator::CreateKeyData>
keys_to_create = {
{CryptAuthKeyBundle::Name::kUserKeyPair,
......@@ -145,7 +145,7 @@ TEST_F(CryptAuthKeyCreatorImplTest, AsymmetricKeyCreation) {
base::nullopt /* expected_client_ephemeral_dh */));
}
TEST_F(CryptAuthKeyCreatorImplTest, SymmetricKeyCreation) {
TEST_F(DeviceSyncCryptAuthKeyCreatorImplTest, SymmetricKeyCreation) {
base::flat_map<CryptAuthKeyBundle::Name, CryptAuthKeyCreator::CreateKeyData>
keys_to_create = {
{CryptAuthKeyBundle::Name::kUserKeyPair,
......
......@@ -71,10 +71,10 @@ class FakeSecureMessageDelegateFactory
} // namespace
class CryptAuthKeyProofComputerImplTest : public testing::Test {
class DeviceSyncCryptAuthKeyProofComputerImplTest : public testing::Test {
protected:
CryptAuthKeyProofComputerImplTest() = default;
~CryptAuthKeyProofComputerImplTest() override = default;
DeviceSyncCryptAuthKeyProofComputerImplTest() = default;
~DeviceSyncCryptAuthKeyProofComputerImplTest() override = default;
void SetUp() override {
fake_secure_message_delegate_factory_ =
......@@ -143,10 +143,11 @@ class CryptAuthKeyProofComputerImplTest : public testing::Test {
std::unique_ptr<CryptAuthKeyProofComputer> key_proof_computer_;
DISALLOW_COPY_AND_ASSIGN(CryptAuthKeyProofComputerImplTest);
DISALLOW_COPY_AND_ASSIGN(DeviceSyncCryptAuthKeyProofComputerImplTest);
};
TEST_F(CryptAuthKeyProofComputerImplTest, SuccessfulKeyProofComputation) {
TEST_F(DeviceSyncCryptAuthKeyProofComputerImplTest,
SuccessfulKeyProofComputation) {
std::vector<std::pair<CryptAuthKey, std::string>> key_payload_pairs = {
{CryptAuthKey(kFakePublicKeyMaterial, kFakePrivateKeyMaterial,
CryptAuthKey::Status::kActive, cryptauthv2::KeyType::P256),
......
......@@ -13,11 +13,11 @@ namespace chromeos {
namespace device_sync {
class CryptAuthKeyRegistryImplTest : public testing::Test {
class DeviceSyncCryptAuthKeyRegistryImplTest : public testing::Test {
protected:
CryptAuthKeyRegistryImplTest() = default;
DeviceSyncCryptAuthKeyRegistryImplTest() = default;
~CryptAuthKeyRegistryImplTest() override = default;
~DeviceSyncCryptAuthKeyRegistryImplTest() override = default;
void SetUp() override {
CryptAuthKeyRegistryImpl::RegisterPrefs(pref_service_.registry());
......@@ -42,10 +42,10 @@ class CryptAuthKeyRegistryImplTest : public testing::Test {
std::unique_ptr<CryptAuthKeyRegistry> key_registry_;
DISALLOW_COPY_AND_ASSIGN(CryptAuthKeyRegistryImplTest);
DISALLOW_COPY_AND_ASSIGN(DeviceSyncCryptAuthKeyRegistryImplTest);
};
TEST_F(CryptAuthKeyRegistryImplTest, GetActiveKey_NoActiveKey) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, GetActiveKey_NoActiveKey) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
......@@ -55,7 +55,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, GetActiveKey_NoActiveKey) {
key_registry()->GetActiveKey(CryptAuthKeyBundle::Name::kUserKeyPair));
}
TEST_F(CryptAuthKeyRegistryImplTest, GetActiveKey) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, GetActiveKey) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
CryptAuthKey asym_key("public-key", "private-key",
......@@ -72,7 +72,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, GetActiveKey) {
EXPECT_EQ(asym_key, *key);
}
TEST_F(CryptAuthKeyRegistryImplTest, AddKey) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, AddKey) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256, "sym-handle");
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
......@@ -117,7 +117,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, AddKey) {
VerifyPrefValue(expected_dict);
}
TEST_F(CryptAuthKeyRegistryImplTest, SetActiveKey) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, SetActiveKey) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
CryptAuthKey asym_key("public-key", "private-key",
......@@ -149,7 +149,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, SetActiveKey) {
VerifyPrefValue(expected_dict);
}
TEST_F(CryptAuthKeyRegistryImplTest, DeactivateKeys) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, DeactivateKeys) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
CryptAuthKey asym_key("public-key", "private-key",
......@@ -176,7 +176,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, DeactivateKeys) {
VerifyPrefValue(expected_dict);
}
TEST_F(CryptAuthKeyRegistryImplTest, DeleteKey) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, DeleteKey) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
CryptAuthKey asym_key("public-key", "private-key",
......@@ -208,7 +208,7 @@ TEST_F(CryptAuthKeyRegistryImplTest, DeleteKey) {
VerifyPrefValue(expected_dict);
}
TEST_F(CryptAuthKeyRegistryImplTest, SetKeyDirective) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest, SetKeyDirective) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
......@@ -237,7 +237,8 @@ TEST_F(CryptAuthKeyRegistryImplTest, SetKeyDirective) {
VerifyPrefValue(expected_dict);
}
TEST_F(CryptAuthKeyRegistryImplTest, ConstructorPopulatesBundlesUsingPref) {
TEST_F(DeviceSyncCryptAuthKeyRegistryImplTest,
ConstructorPopulatesBundlesUsingPref) {
CryptAuthKey sym_key("symmetric-key", CryptAuthKey::Status::kInactive,
cryptauthv2::KeyType::RAW256, "sym-handle");
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
......
......@@ -25,7 +25,7 @@ const char kFakePrivateKeyBase64[] = "ZmFrZS1wcml2YXRlLWtleQ==";
} // namespace
TEST(CryptAuthKeyTest, CreateSymmetricKey) {
TEST(DeviceSyncCryptAuthKeyTest, CreateSymmetricKey) {
CryptAuthKey key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256);
......@@ -42,7 +42,7 @@ TEST(CryptAuthKeyTest, CreateSymmetricKey) {
EXPECT_EQ(key_given_handle.handle(), kFakeHandle);
}
TEST(CryptAuthKeyTest, CreateAsymmetricKey) {
TEST(DeviceSyncCryptAuthKeyTest, CreateAsymmetricKey) {
CryptAuthKey key(kFakePublicKey, kFakePrivateKey,
CryptAuthKey::Status::kActive, cryptauthv2::KeyType::P256);
......@@ -60,7 +60,7 @@ TEST(CryptAuthKeyTest, CreateAsymmetricKey) {
EXPECT_EQ(key_given_handle.handle(), kFakeHandle);
}
TEST(CryptAuthKeyTest, SymmetricKeyAsDictionary) {
TEST(DeviceSyncCryptAuthKeyTest, SymmetricKeyAsDictionary) {
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256, kFakeHandle);
......@@ -73,7 +73,7 @@ TEST(CryptAuthKeyTest, SymmetricKeyAsDictionary) {
EXPECT_EQ(symmetric_key.AsSymmetricKeyDictionary(), dict);
}
TEST(CryptAuthKeyTest, AsymmetricKeyAsDictionary) {
TEST(DeviceSyncCryptAuthKeyTest, AsymmetricKeyAsDictionary) {
CryptAuthKey asymmetric_key(kFakePublicKey, kFakePrivateKey,
CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::P256, kFakeHandle);
......@@ -88,7 +88,7 @@ TEST(CryptAuthKeyTest, AsymmetricKeyAsDictionary) {
EXPECT_EQ(asymmetric_key.AsAsymmetricKeyDictionary(), dict);
}
TEST(CryptAuthKeyTest, SymmetricKeyFromDictionary) {
TEST(DeviceSyncCryptAuthKeyTest, SymmetricKeyFromDictionary) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -101,7 +101,7 @@ TEST(CryptAuthKeyTest, SymmetricKeyFromDictionary) {
cryptauthv2::KeyType::RAW256, kFakeHandle));
}
TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary) {
TEST(DeviceSyncCryptAuthKeyTest, AsymmetricKeyFromDictionary) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -116,7 +116,7 @@ TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary) {
cryptauthv2::KeyType::P256, kFakeHandle));
}
TEST(CryptAuthKeyTest, KeyFromDictionary_MissingHandle) {
TEST(DeviceSyncCryptAuthKeyTest, KeyFromDictionary_MissingHandle) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
dict.SetKey("type", base::Value(cryptauthv2::KeyType::RAW256));
......@@ -125,7 +125,7 @@ TEST(CryptAuthKeyTest, KeyFromDictionary_MissingHandle) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, KeyFromDictionary_MissingStatus) {
TEST(DeviceSyncCryptAuthKeyTest, KeyFromDictionary_MissingStatus) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("type", base::Value(cryptauthv2::KeyType::RAW256));
......@@ -134,7 +134,7 @@ TEST(CryptAuthKeyTest, KeyFromDictionary_MissingStatus) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, KeyFromDictionary_MissingType) {
TEST(DeviceSyncCryptAuthKeyTest, KeyFromDictionary_MissingType) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -143,7 +143,8 @@ TEST(CryptAuthKeyTest, KeyFromDictionary_MissingType) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, SymmetricKeyFromDictionary_MissingSymmetricKey) {
TEST(DeviceSyncCryptAuthKeyTest,
SymmetricKeyFromDictionary_MissingSymmetricKey) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -152,7 +153,7 @@ TEST(CryptAuthKeyTest, SymmetricKeyFromDictionary_MissingSymmetricKey) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary_MissingPublicKey) {
TEST(DeviceSyncCryptAuthKeyTest, AsymmetricKeyFromDictionary_MissingPublicKey) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -162,7 +163,8 @@ TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary_MissingPublicKey) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary_MissingPrivateKey) {
TEST(DeviceSyncCryptAuthKeyTest,
AsymmetricKeyFromDictionary_MissingPrivateKey) {
base::Value dict(base::Value::Type::DICTIONARY);
dict.SetKey("handle", base::Value(kFakeHandle));
dict.SetKey("status", base::Value(CryptAuthKey::Status::kActive));
......@@ -172,7 +174,7 @@ TEST(CryptAuthKeyTest, AsymmetricKeyFromDictionary_MissingPrivateKey) {
EXPECT_FALSE(CryptAuthKey::FromDictionary(dict));
}
TEST(CryptAuthKeyTest, Equality) {
TEST(DeviceSyncCryptAuthKeyTest, Equality) {
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256);
CryptAuthKey asymmetric_key(kFakePublicKey, kFakePrivateKey,
......@@ -187,7 +189,7 @@ TEST(CryptAuthKeyTest, Equality) {
cryptauthv2::KeyType::P256));
}
TEST(CryptAuthKeyTest, NotEquality) {
TEST(DeviceSyncCryptAuthKeyTest, NotEquality) {
CryptAuthKey symmetric_key(kFakeSymmetricKey, CryptAuthKey::Status::kActive,
cryptauthv2::KeyType::RAW256);
CryptAuthKey asymmetric_key(kFakePublicKey, kFakePrivateKey,
......
......@@ -347,11 +347,11 @@ SyncKeysResponse BuildSyncKeysResponse(
} // namespace
class CryptAuthV2EnrollerImplTest
class DeviceSyncCryptAuthV2EnrollerImplTest
: public testing::Test,
public MockCryptAuthClientFactory::Observer {
protected:
CryptAuthV2EnrollerImplTest()
DeviceSyncCryptAuthV2EnrollerImplTest()
: client_factory_(std::make_unique<MockCryptAuthClientFactory>(
MockCryptAuthClientFactory::MockType::MAKE_NICE_MOCKS)),
fake_cryptauth_key_creator_factory_(
......@@ -365,7 +365,7 @@ class CryptAuthV2EnrollerImplTest
client_factory_->AddObserver(this);
}
~CryptAuthV2EnrollerImplTest() override {
~DeviceSyncCryptAuthV2EnrollerImplTest() override {
client_factory_->RemoveObserver(this);
}
......@@ -392,11 +392,12 @@ class CryptAuthV2EnrollerImplTest
// MockCryptAuthClientFactory::Observer:
void OnCryptAuthClientCreated(MockCryptAuthClient* client) override {
ON_CALL(*client, SyncKeys(testing::_, testing::_, testing::_))
.WillByDefault(Invoke(this, &CryptAuthV2EnrollerImplTest::OnSyncKeys));
.WillByDefault(
Invoke(this, &DeviceSyncCryptAuthV2EnrollerImplTest::OnSyncKeys));
ON_CALL(*client, EnrollKeys(testing::_, testing::_, testing::_))
.WillByDefault(
Invoke(this, &CryptAuthV2EnrollerImplTest::OnEnrollKeys));
Invoke(this, &DeviceSyncCryptAuthV2EnrollerImplTest::OnEnrollKeys));
ON_CALL(*client, GetAccessTokenUsed())
.WillByDefault(testing::Return(kAccessTokenUsed));
......@@ -408,7 +409,8 @@ class CryptAuthV2EnrollerImplTest
client_directive_policy_reference) {
enroller()->Enroll(
client_metadata, client_app_metadata, client_directive_policy_reference,
base::BindOnce(&CryptAuthV2EnrollerImplTest::OnEnrollmentComplete,
base::BindOnce(
&DeviceSyncCryptAuthV2EnrollerImplTest::OnEnrollmentComplete,
base::Unretained(this)));
}
......@@ -554,10 +556,10 @@ class CryptAuthV2EnrollerImplTest
std::unique_ptr<CryptAuthV2Enroller> enroller_;
DISALLOW_COPY_AND_ASSIGN(CryptAuthV2EnrollerImplTest);
DISALLOW_COPY_AND_ASSIGN(DeviceSyncCryptAuthV2EnrollerImplTest);
};
TEST_F(CryptAuthV2EnrollerImplTest, SuccessfulEnrollment) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, SuccessfulEnrollment) {
// Seed key registry.
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
kOldActiveAsymmetricKey);
......@@ -660,7 +662,8 @@ TEST_F(CryptAuthV2EnrollerImplTest, SuccessfulEnrollment) {
*key_registry()->GetKeyBundle(bundle_name));
}
TEST_F(CryptAuthV2EnrollerImplTest, SuccessfulEnrollment_NoKeysCreated) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
SuccessfulEnrollment_NoKeysCreated) {
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
kOldActiveAsymmetricKey);
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
......@@ -696,7 +699,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, SuccessfulEnrollment_NoKeysCreated) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_ServerOverloaded) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_ServerOverloaded) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -711,7 +714,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_ServerOverloaded) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_MissingSessionId) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_MissingSessionId) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -727,7 +730,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_MissingSessionId) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_MissingClientDirective) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_MissingClientDirective) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -743,7 +746,8 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_MissingClientDirective) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidSyncSingleKeyResponsesSize) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_InvalidSyncSingleKeyResponsesSize) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -759,7 +763,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidSyncSingleKeyResponsesSize) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidKeyActions_Size) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_InvalidKeyActions_Size) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -778,7 +782,8 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidKeyActions_Size) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidKeyActions_NoActiveKey) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_InvalidKeyActions_NoActiveKey) {
key_registry()->AddEnrolledKey(CryptAuthKeyBundle::Name::kUserKeyPair,
kOldActiveAsymmetricKey);
......@@ -803,7 +808,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_InvalidKeyActions_NoActiveKey) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest,
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_InvalidKeyCreationInstructions_UnsupportedKeyType) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -824,7 +829,7 @@ TEST_F(CryptAuthV2EnrollerImplTest,
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest,
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_InvalidKeyCreationInstructions_NoServerDiffieHellman) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -847,7 +852,7 @@ TEST_F(CryptAuthV2EnrollerImplTest,
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_SyncKeysApiCall) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_SyncKeysApiCall) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -860,7 +865,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_SyncKeysApiCall) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_EnrollKeysApiCall) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest, Failure_EnrollKeysApiCall) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -889,7 +894,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_EnrollKeysApiCall) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest,
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_Timeout_WaitingForSyncKeysResponse) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -905,7 +910,8 @@ TEST_F(CryptAuthV2EnrollerImplTest,
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest, Failure_Timeout_WaitingForKeyCreation) {
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_Timeout_WaitingForKeyCreation) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -928,7 +934,7 @@ TEST_F(CryptAuthV2EnrollerImplTest, Failure_Timeout_WaitingForKeyCreation) {
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest,
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_Timeout_WaitingForKeyProofComputation) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......@@ -960,7 +966,7 @@ TEST_F(CryptAuthV2EnrollerImplTest,
enrollment_result());
}
TEST_F(CryptAuthV2EnrollerImplTest,
TEST_F(DeviceSyncCryptAuthV2EnrollerImplTest,
Failure_Timeout_WaitingForEnrollKeysResponse) {
CallEnroll(GetSampleClientMetadata(), GetSampleClientAppMetadata(),
GetSamplePreviousClientDirectivePolicyReference());
......
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