| Index: components/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| diff --git a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc b/components/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| similarity index 92%
|
| rename from components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| rename to components/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| index 915d7257ea1edf929da12f6f5bbf6691b251c212..8c6a46644270266ce806c9a1637d6e9a475a105f 100644
|
| --- a/components/proximity_auth/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| +++ b/components/cryptauth/cryptauth_enrollment_manager_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h"
|
| +#include "components/cryptauth/cryptauth_enrollment_manager.h"
|
|
|
| #include <utility>
|
|
|
| @@ -13,12 +13,12 @@
|
| #include "base/test/simple_test_clock.h"
|
| #include "base/time/clock.h"
|
| #include "base/time/time.h"
|
| +#include "components/cryptauth/cryptauth_enroller.h"
|
| +#include "components/cryptauth/fake_cryptauth_gcm_manager.h"
|
| +#include "components/cryptauth/fake_secure_message_delegate.h"
|
| +#include "components/cryptauth/mock_sync_scheduler.h"
|
| +#include "components/cryptauth/pref_names.h"
|
| #include "components/prefs/testing_pref_service.h"
|
| -#include "components/proximity_auth/cryptauth/cryptauth_enroller.h"
|
| -#include "components/proximity_auth/cryptauth/fake_cryptauth_gcm_manager.h"
|
| -#include "components/proximity_auth/cryptauth/fake_secure_message_delegate.h"
|
| -#include "components/proximity_auth/cryptauth/mock_sync_scheduler.h"
|
| -#include "components/proximity_auth/cryptauth/pref_names.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -27,7 +27,7 @@ using ::testing::NiceMock;
|
| using ::testing::Return;
|
| using ::testing::SaveArg;
|
|
|
| -namespace proximity_auth {
|
| +namespace cryptauth {
|
|
|
| namespace {
|
|
|
| @@ -141,11 +141,11 @@ class TestCryptAuthEnrollmentManager : public CryptAuthEnrollmentManager {
|
|
|
| } // namespace
|
|
|
| -class ProximityAuthCryptAuthEnrollmentManagerTest
|
| +class CryptAuthEnrollmentManagerTest
|
| : public testing::Test,
|
| public CryptAuthEnrollmentManager::Observer {
|
| protected:
|
| - ProximityAuthCryptAuthEnrollmentManagerTest()
|
| + CryptAuthEnrollmentManagerTest()
|
| : public_key_(kUserPublicKey),
|
| clock_(new base::SimpleTestClock()),
|
| enroller_factory_(new MockCryptAuthEnrollerFactory()),
|
| @@ -261,10 +261,10 @@ class ProximityAuthCryptAuthEnrollmentManagerTest
|
|
|
| TestCryptAuthEnrollmentManager enrollment_manager_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ProximityAuthCryptAuthEnrollmentManagerTest);
|
| + DISALLOW_COPY_AND_ASSIGN(CryptAuthEnrollmentManagerTest);
|
| };
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, RegisterPrefs) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, RegisterPrefs) {
|
| TestingPrefServiceSimple pref_service;
|
| CryptAuthEnrollmentManager::RegisterPrefs(pref_service.registry());
|
| EXPECT_TRUE(pref_service.FindPreference(
|
| @@ -274,7 +274,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, RegisterPrefs) {
|
| EXPECT_TRUE(pref_service.FindPreference(prefs::kCryptAuthEnrollmentReason));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, GetEnrollmentState) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, GetEnrollmentState) {
|
| enrollment_manager_.Start();
|
|
|
| ON_CALL(*sync_scheduler(), GetStrategy())
|
| @@ -299,7 +299,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, GetEnrollmentState) {
|
| EXPECT_FALSE(enrollment_manager_.IsEnrollmentInProgress());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithDefaultPrefs) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, InitWithDefaultPrefs) {
|
| std::unique_ptr<base::SimpleTestClock> clock(new base::SimpleTestClock());
|
| clock->SetNow(base::Time::FromDoubleT(kInitialTimeNowSeconds));
|
| base::TimeDelta elapsed_time = clock->Now() - base::Time::FromDoubleT(0);
|
| @@ -321,7 +321,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithDefaultPrefs) {
|
| EXPECT_TRUE(enrollment_manager.GetLastEnrollmentTime().is_null());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithExistingPrefs) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, InitWithExistingPrefs) {
|
| EXPECT_CALL(
|
| *sync_scheduler(),
|
| Start(clock_->Now() - base::Time::FromDoubleT(kLastEnrollmentTimeSeconds),
|
| @@ -333,7 +333,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithExistingPrefs) {
|
| enrollment_manager_.GetLastEnrollmentTime());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithExpiredEnrollment) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, InitWithExpiredEnrollment) {
|
| pref_service_.SetUserPref(
|
| prefs::kCryptAuthEnrollmentLastEnrollmentTimeSeconds,
|
| new base::FundamentalValue(kLastExpiredEnrollmentTimeSeconds));
|
| @@ -349,7 +349,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, InitWithExpiredEnrollment) {
|
| enrollment_manager_.GetLastEnrollmentTime());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, ForceEnrollment) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, ForceEnrollment) {
|
| enrollment_manager_.Start();
|
|
|
| EXPECT_CALL(*sync_scheduler(), ForceSync());
|
| @@ -365,7 +365,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, ForceEnrollment) {
|
| EXPECT_EQ(clock_->Now(), enrollment_manager_.GetLastEnrollmentTime());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest,
|
| +TEST_F(CryptAuthEnrollmentManagerTest,
|
| EnrollmentFailsThenSucceeds) {
|
| enrollment_manager_.Start();
|
| base::Time old_enrollment_time = enrollment_manager_.GetLastEnrollmentTime();
|
| @@ -395,7 +395,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest,
|
| prefs::kCryptAuthEnrollmentIsRecoveringFromFailure));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest,
|
| +TEST_F(CryptAuthEnrollmentManagerTest,
|
| EnrollmentSucceedsForFirstTime) {
|
| // Initialize |enrollment_manager_|.
|
| ON_CALL(*sync_scheduler(), GetStrategy())
|
| @@ -436,7 +436,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest,
|
| EXPECT_EQ(private_key_, enrollment_manager_.GetUserPrivateKey());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, GCMRegistrationFails) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, GCMRegistrationFails) {
|
| // Initialize |enrollment_manager_|.
|
| ON_CALL(*sync_scheduler(), GetStrategy())
|
| .WillByDefault(Return(SyncScheduler::Strategy::PERIODIC_REFRESH));
|
| @@ -455,7 +455,7 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, GCMRegistrationFails) {
|
| gcm_manager_.CompleteRegistration(std::string());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, ReenrollOnGCMPushMessage) {
|
| +TEST_F(CryptAuthEnrollmentManagerTest, ReenrollOnGCMPushMessage) {
|
| enrollment_manager_.Start();
|
|
|
| // Simulate receiving a GCM push message, forcing the device to re-enroll.
|
| @@ -467,4 +467,4 @@ TEST_F(ProximityAuthCryptAuthEnrollmentManagerTest, ReenrollOnGCMPushMessage) {
|
| completion_callback.Run(true);
|
| }
|
|
|
| -} // namespace proximity_auth
|
| +} // namespace cryptauth
|
|
|