Cleanup FakeAccountManager.

- Remove unnecessary deps.

PiperOrigin-RevId: 591964328
This commit is contained in:
Francis Tsui
2023-12-18 11:41:24 -08:00
committed by Copybara-Service
parent 85091845a8
commit cf69c87d95
4 changed files with 5 additions and 54 deletions
@@ -26,7 +26,6 @@
#include "absl/status/status.h"
#include "absl/strings/escaping.h"
#include "fastpair/common/fast_pair_device.h"
#include "fastpair/common/fast_pair_prefs.h"
#include "fastpair/fast_pair_events.h"
#include "fastpair/fast_pair_seeker.h"
#include "fastpair/message_stream/fake_gatt_callbacks.h"
@@ -41,8 +40,6 @@
#include "internal/platform/logging.h"
#include "internal/platform/medium_environment.h"
#include "internal/platform/single_thread_executor.h"
#include "internal/platform/task_runner_impl.h"
#include "internal/test/google3_only/fake_authentication_manager.h"
namespace nearby {
namespace fastpair {
@@ -85,12 +82,7 @@ class FastPairRepositoryObserver : public FastPairRepository::Observer {
class FastPairSeekerImplTest : public testing::Test {
protected:
FastPairSeekerImplTest() {
task_runner_ = std::make_unique<TaskRunnerImpl>(1);
preferences_manager_ = std::make_unique<preferences::PreferencesManager>(
kFastPairPreferencesFilePath);
authentication_manager_ = std::make_unique<FakeAuthenticationManager>();
}
FastPairSeekerImplTest() = default;
void SetUp() override {
NEARBY_LOG_SET_SEVERITY(VERBOSE);
@@ -98,9 +90,7 @@ class FastPairSeekerImplTest : public testing::Test {
kModelId, absl::HexStringToBytes(kBobPublicKey));
repository_->SetResultOfIsDeviceSavedToAccount(
absl::NotFoundError("not found"));
account_manager_ = std::make_unique<FakeAccountManager>(
preferences_manager_.get(), prefs::kNearbyFastPairUsersName,
authentication_manager_.get(), task_runner_.get());
account_manager_ = std::make_unique<FakeAccountManager>();
AccountManager::Account account;
account.id = kTestAccountId;
account_manager_->SetAccount(account);
@@ -116,9 +106,6 @@ class FastPairSeekerImplTest : public testing::Test {
MediumEnvironmentStarter env_;
SingleThreadExecutor executor_;
std::unique_ptr<preferences::PreferencesManager> preferences_manager_;
std::unique_ptr<auth::AuthenticationManager> authentication_manager_;
std::unique_ptr<TaskRunner> task_runner_;
std::unique_ptr<FakeAccountManager> account_manager_;
FastPairDeviceRepository devices_{&executor_};
std::unique_ptr<FakeFastPairRepository> repository_;
@@ -34,7 +34,6 @@
#include "fastpair/common/account_key.h"
#include "fastpair/common/device_metadata.h"
#include "fastpair/common/fast_pair_device.h"
#include "fastpair/common/fast_pair_prefs.h"
#include "fastpair/common/fast_pair_version.h"
#include "fastpair/common/protocol.h"
#include "fastpair/crypto/decrypted_passkey.h"
@@ -54,8 +53,6 @@
#include "internal/platform/count_down_latch.h"
#include "internal/platform/medium_environment.h"
#include "internal/platform/single_thread_executor.h"
#include "internal/platform/task_runner_impl.h"
#include "internal/test/google3_only/fake_authentication_manager.h"
namespace nearby {
namespace fastpair {
@@ -137,18 +134,12 @@ class FastPairPairerImplTest : public testing::Test {
FastPairPairerImplTest() {
FastPairDataEncryptorImpl::Factory::SetFactoryForTesting(
&fake_data_encryptor_factory_);
task_runner_ = std::make_unique<TaskRunnerImpl>(1);
preferences_manager_ = std::make_unique<preferences::PreferencesManager>(
kFastPairPreferencesFilePath);
authentication_manager_ = std::make_unique<FakeAuthenticationManager>();
}
void SetUp() override {
env_.Start();
// Setups seeker device.
mediums_ = std::make_unique<Mediums>();
account_manager_ = std::make_unique<FakeAccountManager>(
preferences_manager_.get(), prefs::kNearbyFastPairUsersName,
authentication_manager_.get(), task_runner_.get());
account_manager_ = std::make_unique<FakeAccountManager>();
// Setups provider device.
adapter_provider_ = std::make_unique<BluetoothAdapter>();
@@ -384,9 +375,6 @@ class FastPairPairerImplTest : public testing::Test {
private:
MediumEnvironment& env_{MediumEnvironment::Instance()};
Mutex mutex_;
std::unique_ptr<preferences::PreferencesManager> preferences_manager_;
std::unique_ptr<auth::AuthenticationManager> authentication_manager_;
std::unique_ptr<TaskRunner> task_runner_;
std::unique_ptr<BluetoothClassicMedium> bt_provider_;
std::unique_ptr<BluetoothAdapter> adapter_provider_;
std::unique_ptr<GattServer> gatt_server_;
+1 -13
View File
@@ -24,7 +24,6 @@
#include "gtest/gtest.h"
#include "absl/functional/bind_front.h"
#include "fastpair//handshake/fast_pair_handshake_lookup.h"
#include "fastpair/common/fast_pair_prefs.h"
#include "fastpair/common/pair_failure.h"
#include "fastpair/crypto/decrypted_passkey.h"
#include "fastpair/crypto/decrypted_response.h"
@@ -42,8 +41,6 @@
#include "internal/platform/ble_v2.h"
#include "internal/platform/count_down_latch.h"
#include "internal/platform/medium_environment.h"
#include "internal/platform/task_runner_impl.h"
#include "internal/test/google3_only/fake_authentication_manager.h"
namespace nearby {
namespace fastpair {
@@ -180,19 +177,13 @@ class PairerBrokerImplTest : public testing::Test {
PairerBrokerImplTest() {
FastPairDataEncryptorImpl::Factory::SetFactoryForTesting(
&fake_data_encryptor_factory_);
task_runner_ = std::make_unique<TaskRunnerImpl>(1);
preferences_manager_ = std::make_unique<preferences::PreferencesManager>(
kFastPairPreferencesFilePath);
authentication_manager_ = std::make_unique<FakeAuthenticationManager>();
}
void SetUp() override {
env_.Start();
// Setups seeker device.
mediums_ = std::make_unique<Mediums>();
account_manager_ = std::make_unique<FakeAccountManager>(
preferences_manager_.get(), prefs::kNearbyFastPairUsersName,
authentication_manager_.get(), task_runner_.get());
account_manager_ = std::make_unique<FakeAccountManager>();
// Setups provider device.
adapter_provider_ = std::make_unique<BluetoothAdapter>();
@@ -416,9 +407,6 @@ class PairerBrokerImplTest : public testing::Test {
private:
MediumEnvironment& env_{MediumEnvironment::Instance()};
Mutex mutex_;
std::unique_ptr<preferences::PreferencesManager> preferences_manager_;
std::unique_ptr<auth::AuthenticationManager> authentication_manager_;
std::unique_ptr<TaskRunner> task_runner_;
std::unique_ptr<BluetoothClassicMedium> bt_provider_;
std::unique_ptr<BluetoothAdapter> adapter_provider_;
std::unique_ptr<GattServer> gatt_server_;
@@ -36,7 +36,6 @@
#include "fastpair/common/account_key.h"
#include "fastpair/common/device_metadata.h"
#include "fastpair/common/fast_pair_device.h"
#include "fastpair/common/fast_pair_prefs.h"
#include "fastpair/common/fast_pair_switches.h"
#include "fastpair/common/protocol.h"
#include "fastpair/proto/data.proto.h"
@@ -45,7 +44,6 @@
#include "fastpair/proto/proto_builder.h"
#include "fastpair/server_access/fast_pair_client.h"
#include "fastpair/server_access/fast_pair_http_notifier.h"
#include "internal/account/account_manager.h"
#include "internal/account/fake_account_manager.h"
#include "internal/auth/auth_status_util.h"
#include "internal/auth/authentication_manager.h"
@@ -55,9 +53,6 @@
#include "internal/network/http_status_code.h"
#include "internal/network/url.h"
#include "internal/platform/device_info.h"
#include "internal/platform/task_runner.h"
#include "internal/platform/task_runner_impl.h"
#include "internal/preferences/preferences_manager.h"
#include "internal/test/fake_device_info.h"
#include "internal/test/google3_only/fake_authentication_manager.h"
@@ -147,16 +142,11 @@ class FastPairClientImplTest : public ::testing::Test,
public FastPairHttpNotifier::Observer {
protected:
FastPairClientImplTest() {
preferences_manager_ = std::make_unique<preferences::PreferencesManager>(
kFastPairPreferencesFilePath);
authentication_manager_ = std::make_unique<FakeAuthenticationManager>();
AccountManager::Account account;
account.id = kTestAccountId;
account_manager_ = std::make_unique<FakeAccountManager>(
preferences_manager_.get(), prefs::kNearbyFastPairUsersName,
authentication_manager_.get(), task_runner_.get());
account_manager_ = std::make_unique<FakeAccountManager>();
account_manager_->SetAccount(account);
task_runner_ = std::make_unique<TaskRunnerImpl>(1);
device_info_ = std::make_unique<FakeDeviceInfo>();
}
@@ -235,12 +225,10 @@ class FastPairClientImplTest : public ::testing::Test,
std::optional<proto::UserDeleteDeviceRequest> delete_device_request_;
std::optional<proto::UserDeleteDeviceResponse> delete_device_response_;
std::unique_ptr<preferences::PreferencesManager> preferences_manager_;
std::unique_ptr<auth::AuthenticationManager> authentication_manager_;
std::unique_ptr<FakeAccountManager> account_manager_;
std::unique_ptr<FastPairClient> fast_pair_client_;
std::unique_ptr<DeviceInfo> device_info_;
std::unique_ptr<TaskRunner> task_runner_;
::testing::NiceMock<MockHttpClient>* http_client_;
std::unique_ptr<MockHttpClient> mock_http_client_;
FastPairHttpNotifier notifier_;