| Index: components/cryptauth/cryptauth_device_manager_unittest.cc
|
| diff --git a/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc b/components/cryptauth/cryptauth_device_manager_unittest.cc
|
| similarity index 94%
|
| rename from components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc
|
| rename to components/cryptauth/cryptauth_device_manager_unittest.cc
|
| index d5c71218634bdf0d1054a3e81ea591757fe7ac12..77a051d0d295b8bf213fc10999dceb9464b50c85 100644
|
| --- a/components/proximity_auth/cryptauth/cryptauth_device_manager_unittest.cc
|
| +++ b/components/cryptauth/cryptauth_device_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_device_manager.h"
|
| +#include "components/cryptauth/cryptauth_device_manager.h"
|
|
|
| #include <stddef.h>
|
|
|
| @@ -14,12 +14,12 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/test/simple_test_clock.h"
|
| +#include "components/cryptauth/fake_cryptauth_gcm_manager.h"
|
| +#include "components/cryptauth/mock_cryptauth_client.h"
|
| +#include "components/cryptauth/mock_sync_scheduler.h"
|
| +#include "components/cryptauth/pref_names.h"
|
| #include "components/prefs/scoped_user_pref_update.h"
|
| #include "components/prefs/testing_pref_service.h"
|
| -#include "components/proximity_auth/cryptauth/fake_cryptauth_gcm_manager.h"
|
| -#include "components/proximity_auth/cryptauth/mock_cryptauth_client.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"
|
|
|
| @@ -29,7 +29,7 @@ using ::testing::NiceMock;
|
| using ::testing::Return;
|
| using ::testing::SaveArg;
|
|
|
| -namespace proximity_auth {
|
| +namespace cryptauth {
|
| namespace {
|
|
|
| // The initial "Now" time for testing.
|
| @@ -154,12 +154,12 @@ class TestCryptAuthDeviceManager : public CryptAuthDeviceManager {
|
|
|
| } // namespace
|
|
|
| -class ProximityAuthCryptAuthDeviceManagerTest
|
| +class CryptAuthDeviceManagerTest
|
| : public testing::Test,
|
| public CryptAuthDeviceManager::Observer,
|
| public MockCryptAuthClientFactory::Observer {
|
| protected:
|
| - ProximityAuthCryptAuthDeviceManagerTest()
|
| + CryptAuthDeviceManagerTest()
|
| : clock_(new base::SimpleTestClock()),
|
| client_factory_(new MockCryptAuthClientFactory(
|
| MockCryptAuthClientFactory::MockType::MAKE_STRICT_MOCKS)),
|
| @@ -167,7 +167,7 @@ class ProximityAuthCryptAuthDeviceManagerTest
|
| client_factory_->AddObserver(this);
|
| }
|
|
|
| - ~ProximityAuthCryptAuthDeviceManagerTest() {
|
| + ~CryptAuthDeviceManagerTest() {
|
| client_factory_->RemoveObserver(this);
|
| }
|
|
|
| @@ -304,10 +304,10 @@ class ProximityAuthCryptAuthDeviceManagerTest
|
|
|
| CryptAuthClient::ErrorCallback error_callback_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ProximityAuthCryptAuthDeviceManagerTest);
|
| + DISALLOW_COPY_AND_ASSIGN(CryptAuthDeviceManagerTest);
|
| };
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, RegisterPrefs) {
|
| +TEST_F(CryptAuthDeviceManagerTest, RegisterPrefs) {
|
| TestingPrefServiceSimple pref_service;
|
| CryptAuthDeviceManager::RegisterPrefs(pref_service.registry());
|
| EXPECT_TRUE(pref_service.FindPreference(
|
| @@ -319,7 +319,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, RegisterPrefs) {
|
| pref_service.FindPreference(prefs::kCryptAuthDeviceSyncUnlockKeys));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, GetSyncState) {
|
| +TEST_F(CryptAuthDeviceManagerTest, GetSyncState) {
|
| device_manager_->Start();
|
|
|
| ON_CALL(*sync_scheduler(), GetStrategy())
|
| @@ -344,7 +344,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, GetSyncState) {
|
| EXPECT_FALSE(device_manager_->IsSyncInProgress());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, InitWithDefaultPrefs) {
|
| +TEST_F(CryptAuthDeviceManagerTest, 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);
|
| @@ -366,7 +366,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, InitWithDefaultPrefs) {
|
| EXPECT_EQ(0u, device_manager.unlock_keys().size());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, InitWithExistingPrefs) {
|
| +TEST_F(CryptAuthDeviceManagerTest, InitWithExistingPrefs) {
|
| EXPECT_CALL(
|
| *sync_scheduler(),
|
| Start(clock_->Now() - base::Time::FromDoubleT(kLastSyncTimeSeconds),
|
| @@ -384,7 +384,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, InitWithExistingPrefs) {
|
| EXPECT_TRUE(unlock_keys[0].unlock_key());
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncSucceedsForFirstTime) {
|
| +TEST_F(CryptAuthDeviceManagerTest, SyncSucceedsForFirstTime) {
|
| pref_service_.ClearPref(prefs::kCryptAuthDeviceSyncLastSyncTimeSeconds);
|
| device_manager_->Start();
|
|
|
| @@ -405,7 +405,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncSucceedsForFirstTime) {
|
| pref_service_);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, ForceSync) {
|
| +TEST_F(CryptAuthDeviceManagerTest, ForceSync) {
|
| device_manager_->Start();
|
|
|
| EXPECT_CALL(*sync_scheduler(), ForceSync());
|
| @@ -426,7 +426,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, ForceSync) {
|
| pref_service_);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) {
|
| +TEST_F(CryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) {
|
| device_manager_->Start();
|
| EXPECT_FALSE(pref_service_.GetBoolean(
|
| prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure));
|
| @@ -473,7 +473,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, ForceSyncFailsThenSucceeds) {
|
| prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, PeriodicSyncFailsThenSucceeds) {
|
| +TEST_F(CryptAuthDeviceManagerTest, PeriodicSyncFailsThenSucceeds) {
|
| device_manager_->Start();
|
| base::Time old_sync_time = device_manager_->GetLastSyncTime();
|
|
|
| @@ -512,7 +512,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, PeriodicSyncFailsThenSucceeds) {
|
| prefs::kCryptAuthDeviceSyncIsRecoveringFromFailure));
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncSameDevice) {
|
| +TEST_F(CryptAuthDeviceManagerTest, SyncSameDevice) {
|
| device_manager_->Start();
|
| auto original_unlock_keys = device_manager_->unlock_keys();
|
|
|
| @@ -540,7 +540,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncSameDevice) {
|
| original_unlock_keys, device_manager_->unlock_keys(), pref_service_);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncEmptyDeviceList) {
|
| +TEST_F(CryptAuthDeviceManagerTest, SyncEmptyDeviceList) {
|
| cryptauth::GetMyDevicesResponse empty_response;
|
|
|
| device_manager_->Start();
|
| @@ -558,7 +558,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncEmptyDeviceList) {
|
| pref_service_);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncTwoUnlockKeys) {
|
| +TEST_F(CryptAuthDeviceManagerTest, SyncTwoUnlockKeys) {
|
| cryptauth::GetMyDevicesResponse response(get_my_devices_response_);
|
| cryptauth::ExternalDeviceInfo unlock_key2;
|
| unlock_key2.set_public_key("new public key");
|
| @@ -587,7 +587,7 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncTwoUnlockKeys) {
|
| expected_unlock_keys, device_manager_->unlock_keys(), pref_service_);
|
| }
|
|
|
| -TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncOnGCMPushMessage) {
|
| +TEST_F(CryptAuthDeviceManagerTest, SyncOnGCMPushMessage) {
|
| device_manager_->Start();
|
|
|
| EXPECT_CALL(*sync_scheduler(), ForceSync());
|
| @@ -606,4 +606,4 @@ TEST_F(ProximityAuthCryptAuthDeviceManagerTest, SyncOnGCMPushMessage) {
|
| pref_service_);
|
| }
|
|
|
| -} // namespace proximity_auth
|
| +} // namespace cryptauth
|
|
|