Commit 5e7a75ea authored by Jeremy Klein's avatar Jeremy Klein Committed by Commit Bot

Use MultideviceSetupClient to fetch tether hosts.

This will limit Magic Tether hosts to devices that have gone through
Better Together Setup.

Bug: 870072
Change-Id: I9fe120f4b8d07f831ebe84aeb28267ff379f2e82
Reviewed-on: https://chromium-review.googlesource.com/1180473Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Jeremy Klein <jlklein@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584617}
parent d1f9ed88
...@@ -158,7 +158,8 @@ TetherService::TetherService( ...@@ -158,7 +158,8 @@ TetherService::TetherService(
tether_host_fetcher_( tether_host_fetcher_(
chromeos::tether::TetherHostFetcherImpl::Factory::NewInstance( chromeos::tether::TetherHostFetcherImpl::Factory::NewInstance(
remote_device_provider_.get(), remote_device_provider_.get(),
device_sync_client_)), device_sync_client_,
multidevice_setup_client_)),
timer_(std::make_unique<base::OneShotTimer>()), timer_(std::make_unique<base::OneShotTimer>()),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
tether_host_fetcher_->AddObserver(this); tether_host_fetcher_->AddObserver(this);
......
...@@ -245,7 +245,9 @@ class FakeTetherHostFetcherFactory ...@@ -245,7 +245,9 @@ class FakeTetherHostFetcherFactory
// chromeos::tether::TetherHostFetcherImpl::Factory : // chromeos::tether::TetherHostFetcherImpl::Factory :
std::unique_ptr<chromeos::tether::TetherHostFetcher> BuildInstance( std::unique_ptr<chromeos::tether::TetherHostFetcher> BuildInstance(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
chromeos::device_sync::DeviceSyncClient* device_sync_client) override { chromeos::device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client) override {
last_created_ = last_created_ =
new chromeos::tether::FakeTetherHostFetcher(initial_devices_); new chromeos::tether::FakeTetherHostFetcher(initial_devices_);
return base::WrapUnique(last_created_); return base::WrapUnique(last_created_);
......
...@@ -136,6 +136,8 @@ static_library("tether") { ...@@ -136,6 +136,8 @@ static_library("tether") {
"//chromeos/components/proximity_auth/logging", "//chromeos/components/proximity_auth/logging",
"//chromeos/components/tether/proto", "//chromeos/components/tether/proto",
"//chromeos/services/device_sync/public/cpp", "//chromeos/services/device_sync/public/cpp",
"//chromeos/services/multidevice_setup/public/cpp:cpp",
"//chromeos/services/multidevice_setup/public/mojom:mojom",
"//chromeos/services/secure_channel/public/cpp/client", "//chromeos/services/secure_channel/public/cpp/client",
"//chromeos/services/secure_channel/public/mojom", "//chromeos/services/secure_channel/public/mojom",
...@@ -303,6 +305,8 @@ source_set("unit_tests") { ...@@ -303,6 +305,8 @@ source_set("unit_tests") {
# TODO(hansberry): Remove //chromeos/services/secure_channel dependency when # TODO(hansberry): Remove //chromeos/services/secure_channel dependency when
# SecureChannelClient migration is complete. # SecureChannelClient migration is complete.
"//chromeos/services/device_sync/public/mojom", "//chromeos/services/device_sync/public/mojom",
"//chromeos/services/multidevice_setup/public/cpp:test_support",
"//chromeos/services/multidevice_setup/public/mojom:mojom",
"//chromeos/services/secure_channel", "//chromeos/services/secure_channel",
"//chromeos/services/secure_channel:test_support", "//chromeos/services/secure_channel:test_support",
"//chromeos/services/secure_channel/public/cpp/client:test_support", "//chromeos/services/secure_channel/public/cpp/client:test_support",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "chromeos/chromeos_features.h" #include "chromeos/chromeos_features.h"
#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h"
#include "components/cryptauth/remote_device.h" #include "components/cryptauth/remote_device.h"
#include "components/cryptauth/remote_device_provider.h" #include "components/cryptauth/remote_device_provider.h"
...@@ -22,12 +23,14 @@ TetherHostFetcherImpl::Factory* ...@@ -22,12 +23,14 @@ TetherHostFetcherImpl::Factory*
// static // static
std::unique_ptr<TetherHostFetcher> TetherHostFetcherImpl::Factory::NewInstance( std::unique_ptr<TetherHostFetcher> TetherHostFetcherImpl::Factory::NewInstance(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client) { device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client) {
if (!factory_instance_) { if (!factory_instance_) {
factory_instance_ = new Factory(); factory_instance_ = new Factory();
} }
return factory_instance_->BuildInstance(remote_device_provider, return factory_instance_->BuildInstance(
device_sync_client); remote_device_provider, device_sync_client, multidevice_setup_client);
} }
// static // static
...@@ -38,16 +41,22 @@ void TetherHostFetcherImpl::Factory::SetInstanceForTesting(Factory* factory) { ...@@ -38,16 +41,22 @@ void TetherHostFetcherImpl::Factory::SetInstanceForTesting(Factory* factory) {
std::unique_ptr<TetherHostFetcher> std::unique_ptr<TetherHostFetcher>
TetherHostFetcherImpl::Factory::BuildInstance( TetherHostFetcherImpl::Factory::BuildInstance(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client) { device_sync::DeviceSyncClient* device_sync_client,
return base::WrapUnique( chromeos::multidevice_setup::MultiDeviceSetupClient*
new TetherHostFetcherImpl(remote_device_provider, device_sync_client)); multidevice_setup_client) {
return base::WrapUnique(new TetherHostFetcherImpl(
remote_device_provider, device_sync_client, multidevice_setup_client));
} }
TetherHostFetcherImpl::TetherHostFetcherImpl( TetherHostFetcherImpl::TetherHostFetcherImpl(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client) device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client)
: remote_device_provider_(remote_device_provider), : remote_device_provider_(remote_device_provider),
device_sync_client_(device_sync_client) { device_sync_client_(device_sync_client),
multidevice_setup_client_(multidevice_setup_client),
weak_ptr_factory_(this) {
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
device_sync_client_->AddObserver(this); device_sync_client_->AddObserver(this);
else else
...@@ -91,23 +100,24 @@ void TetherHostFetcherImpl::CacheCurrentTetherHosts() { ...@@ -91,23 +100,24 @@ void TetherHostFetcherImpl::CacheCurrentTetherHosts() {
cryptauth::RemoteDeviceRefList updated_list; cryptauth::RemoteDeviceRefList updated_list;
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) { if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) {
for (const auto& remote_device : device_sync_client_->GetSyncedDevices()) { multidevice_setup_client_->GetHostStatus(
if (remote_device.GetSoftwareFeatureState( base::BindOnce(&TetherHostFetcherImpl::OnHostStatusFetched,
cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) == weak_ptr_factory_.GetWeakPtr()));
cryptauth::SoftwareFeatureState::kSupported) return;
updated_list.push_back(remote_device); }
}
} else { for (const auto& remote_device :
for (const auto& remote_device : remote_device_provider_->GetSyncedDevices()) {
remote_device_provider_->GetSyncedDevices()) { if (base::ContainsKey(remote_device.software_features,
if (base::ContainsKey(remote_device.software_features, cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) &&
cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) && (remote_device.software_features.at(
remote_device.software_features.at( cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) ==
cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) == cryptauth::SoftwareFeatureState::kSupported ||
cryptauth::SoftwareFeatureState::kSupported) { remote_device.software_features.at(
updated_list.push_back(cryptauth::RemoteDeviceRef( cryptauth::SoftwareFeature::MAGIC_TETHER_HOST) ==
std::make_shared<cryptauth::RemoteDevice>(remote_device))); cryptauth::SoftwareFeatureState::kEnabled)) {
} updated_list.push_back(cryptauth::RemoteDeviceRef(
std::make_shared<cryptauth::RemoteDevice>(remote_device)));
} }
} }
...@@ -118,6 +128,24 @@ void TetherHostFetcherImpl::CacheCurrentTetherHosts() { ...@@ -118,6 +128,24 @@ void TetherHostFetcherImpl::CacheCurrentTetherHosts() {
NotifyTetherHostsUpdated(); NotifyTetherHostsUpdated();
} }
void TetherHostFetcherImpl::OnHostStatusFetched(
chromeos::multidevice_setup::mojom::HostStatus host_status,
const base::Optional<cryptauth::RemoteDeviceRef>& host_device) {
DCHECK(base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi));
cryptauth::RemoteDeviceRefList updated_list;
if (host_status ==
chromeos::multidevice_setup::mojom::HostStatus::kHostVerified) {
updated_list.push_back(*host_device);
}
if (updated_list == current_remote_device_list_)
return;
current_remote_device_list_.swap(updated_list);
NotifyTetherHostsUpdated();
}
} // namespace tether } // namespace tether
} // namespace chromeos } // namespace chromeos
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chromeos/components/tether/tether_host_fetcher.h" #include "chromeos/components/tether/tether_host_fetcher.h"
#include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
#include "components/cryptauth/remote_device_provider.h" #include "components/cryptauth/remote_device_provider.h"
#include "components/cryptauth/remote_device_ref.h" #include "components/cryptauth/remote_device_ref.h"
...@@ -19,6 +21,10 @@ class RemoteDeviceProvider; ...@@ -19,6 +21,10 @@ class RemoteDeviceProvider;
namespace chromeos { namespace chromeos {
namespace multidevice_setup {
class MultiDeviceSetupClient;
} // namespace multidevice_setup
namespace tether { namespace tether {
// Concrete TetherHostFetcher implementation. Despite the asynchronous function // Concrete TetherHostFetcher implementation. Despite the asynchronous function
...@@ -39,14 +45,18 @@ class TetherHostFetcherImpl : public TetherHostFetcher, ...@@ -39,14 +45,18 @@ class TetherHostFetcherImpl : public TetherHostFetcher,
public: public:
static std::unique_ptr<TetherHostFetcher> NewInstance( static std::unique_ptr<TetherHostFetcher> NewInstance(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client); device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client);
static void SetInstanceForTesting(Factory* factory); static void SetInstanceForTesting(Factory* factory);
protected: protected:
virtual std::unique_ptr<TetherHostFetcher> BuildInstance( virtual std::unique_ptr<TetherHostFetcher> BuildInstance(
cryptauth::RemoteDeviceProvider* remote_device_provider, cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client); device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client);
private: private:
static Factory* factory_instance_; static Factory* factory_instance_;
...@@ -70,15 +80,23 @@ class TetherHostFetcherImpl : public TetherHostFetcher, ...@@ -70,15 +80,23 @@ class TetherHostFetcherImpl : public TetherHostFetcher,
// TODO(crbug.com/848956): Remove RemoteDeviceProvider once all clients have // TODO(crbug.com/848956): Remove RemoteDeviceProvider once all clients have
// migrated to the DeviceSync Mojo API. // migrated to the DeviceSync Mojo API.
TetherHostFetcherImpl(cryptauth::RemoteDeviceProvider* remote_device_provider, TetherHostFetcherImpl(cryptauth::RemoteDeviceProvider* remote_device_provider,
device_sync::DeviceSyncClient* device_sync_client); device_sync::DeviceSyncClient* device_sync_client,
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client_);
private: private:
void CacheCurrentTetherHosts(); void CacheCurrentTetherHosts();
void OnHostStatusFetched(
chromeos::multidevice_setup::mojom::HostStatus host_status,
const base::Optional<cryptauth::RemoteDeviceRef>& host_device);
cryptauth::RemoteDeviceProvider* remote_device_provider_; cryptauth::RemoteDeviceProvider* remote_device_provider_;
device_sync::DeviceSyncClient* device_sync_client_; device_sync::DeviceSyncClient* device_sync_client_;
chromeos::multidevice_setup::MultiDeviceSetupClient*
multidevice_setup_client_;
cryptauth::RemoteDeviceRefList current_remote_device_list_; cryptauth::RemoteDeviceRefList current_remote_device_list_;
base::WeakPtrFactory<TetherHostFetcherImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(TetherHostFetcherImpl); DISALLOW_COPY_AND_ASSIGN(TetherHostFetcherImpl);
}; };
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/chromeos_features.h" #include "chromeos/chromeos_features.h"
#include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h"
#include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h"
#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
#include "components/cryptauth/fake_remote_device_provider.h" #include "components/cryptauth/fake_remote_device_provider.h"
#include "components/cryptauth/remote_device.h" #include "components/cryptauth/remote_device.h"
#include "components/cryptauth/remote_device_ref.h" #include "components/cryptauth/remote_device_ref.h"
...@@ -55,6 +57,8 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -55,6 +57,8 @@ class TetherHostFetcherImplTest : public testing::Test {
std::make_unique<cryptauth::FakeRemoteDeviceProvider>(); std::make_unique<cryptauth::FakeRemoteDeviceProvider>();
fake_device_sync_client_ = fake_device_sync_client_ =
std::make_unique<device_sync::FakeDeviceSyncClient>(); std::make_unique<device_sync::FakeDeviceSyncClient>();
fake_multidevice_setup_client_ = std::make_unique<
chromeos::multidevice_setup::FakeMultiDeviceSetupClient>();
} }
void TearDown() override { void TearDown() override {
...@@ -77,11 +81,32 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -77,11 +81,32 @@ class TetherHostFetcherImplTest : public testing::Test {
: fake_remote_device_provider_.get(), : fake_remote_device_provider_.get(),
base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi) base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)
? fake_device_sync_client_.get() ? fake_device_sync_client_.get()
: nullptr,
base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)
? fake_multidevice_setup_client_.get()
: nullptr); : nullptr);
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(test_remote_device_list_[0]);
test_observer_ = std::make_unique<TestObserver>(); test_observer_ = std::make_unique<TestObserver>();
tether_host_fetcher_->AddObserver(test_observer_.get()); tether_host_fetcher_->AddObserver(test_observer_.get());
} }
void InvokeGetHostStatusCallback(
const base::Optional<cryptauth::RemoteDevice>& host_device) {
EXPECT_TRUE(
base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi));
if (!host_device) {
fake_multidevice_setup_client_->InvokePendingGetHostStatusCallback(
chromeos::multidevice_setup::mojom::HostStatus::kNoEligibleHosts,
base::nullopt);
} else {
fake_multidevice_setup_client_->InvokePendingGetHostStatusCallback(
chromeos::multidevice_setup::mojom::HostStatus::kHostVerified,
cryptauth::RemoteDeviceRef(
std::make_shared<cryptauth::RemoteDevice>(*host_device)));
}
}
void OnTetherHostListFetched( void OnTetherHostListFetched(
const cryptauth::RemoteDeviceRefList& device_list) { const cryptauth::RemoteDeviceRefList& device_list) {
last_fetched_list_ = device_list; last_fetched_list_ = device_list;
...@@ -121,6 +146,10 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -121,6 +146,10 @@ class TetherHostFetcherImplTest : public testing::Test {
cryptauth::SoftwareFeatureState::kSupported; cryptauth::SoftwareFeatureState::kSupported;
} }
// Mark the first device enabled instead of supported.
list[0].software_features[cryptauth::SoftwareFeature::MAGIC_TETHER_HOST] =
cryptauth::SoftwareFeatureState::kEnabled;
return list; return list;
} }
...@@ -159,24 +188,32 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -159,24 +188,32 @@ class TetherHostFetcherImplTest : public testing::Test {
// Update the list of devices to be empty. // Update the list of devices to be empty.
SetSyncedDevices(cryptauth::RemoteDeviceList()); SetSyncedDevices(cryptauth::RemoteDeviceList());
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(base::nullopt);
EXPECT_FALSE(tether_host_fetcher_->HasSyncedTetherHosts()); EXPECT_FALSE(tether_host_fetcher_->HasSyncedTetherHosts());
EXPECT_EQ(1u, test_observer_->num_updates()); EXPECT_EQ(1u, test_observer_->num_updates());
// Notify that the list has changed, even though it hasn't. There should be // Notify that the list has changed, even though it hasn't. There should be
// no update. // no update.
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(base::nullopt);
EXPECT_FALSE(tether_host_fetcher_->HasSyncedTetherHosts()); EXPECT_FALSE(tether_host_fetcher_->HasSyncedTetherHosts());
EXPECT_EQ(1u, test_observer_->num_updates()); EXPECT_EQ(1u, test_observer_->num_updates());
// Update the list to include device 0 only. // Update the list to include device 0 only.
SetSyncedDevices({test_remote_device_list_[0]}); SetSyncedDevices({test_remote_device_list_[0]});
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(test_remote_device_list_[0]);
EXPECT_TRUE(tether_host_fetcher_->HasSyncedTetherHosts()); EXPECT_TRUE(tether_host_fetcher_->HasSyncedTetherHosts());
EXPECT_EQ(2u, test_observer_->num_updates()); EXPECT_EQ(2u, test_observer_->num_updates());
// Notify that the list has changed, even though it hasn't. There should be // Notify that the list has changed, even though it hasn't. There should be
// no update. // no update.
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(test_remote_device_list_[0]);
EXPECT_TRUE(tether_host_fetcher_->HasSyncedTetherHosts()); EXPECT_TRUE(tether_host_fetcher_->HasSyncedTetherHosts());
EXPECT_EQ(2u, test_observer_->num_updates()); EXPECT_EQ(2u, test_observer_->num_updates());
} }
...@@ -191,6 +228,8 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -191,6 +228,8 @@ class TetherHostFetcherImplTest : public testing::Test {
// requested. // requested.
SetSyncedDevices(cryptauth::RemoteDeviceList{test_remote_device_list_[0]}); SetSyncedDevices(cryptauth::RemoteDeviceList{test_remote_device_list_[0]});
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(test_remote_device_list_[0]);
VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(), VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(),
test_remote_device_ref_list_[0]); test_remote_device_ref_list_[0]);
...@@ -203,12 +242,16 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -203,12 +242,16 @@ class TetherHostFetcherImplTest : public testing::Test {
SetSyncedDevices(cryptauth::RemoteDeviceList{remote_device}); SetSyncedDevices(cryptauth::RemoteDeviceList{remote_device});
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(remote_device);
VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(), VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(),
base::nullopt); base::nullopt);
// Update the list; now, there are no more devices. // Update the list; now, there are no more devices.
SetSyncedDevices(cryptauth::RemoteDeviceList()); SetSyncedDevices(cryptauth::RemoteDeviceList());
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi))
InvokeGetHostStatusCallback(base::nullopt);
VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(), VerifySingleTetherHost(test_remote_device_ref_list_[0].GetDeviceId(),
base::nullopt); base::nullopt);
} }
...@@ -232,7 +275,13 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -232,7 +275,13 @@ class TetherHostFetcherImplTest : public testing::Test {
SetSyncedDevices(test_remote_device_list_); SetSyncedDevices(test_remote_device_list_);
NotifyNewDevicesSynced(); NotifyNewDevicesSynced();
VerifyAllTetherHosts(host_device_list); if (base::FeatureList::IsEnabled(chromeos::features::kMultiDeviceApi)) {
InvokeGetHostStatusCallback(test_remote_device_list_[0]);
VerifyAllTetherHosts(
CreateTestRemoteDeviceRefList({test_remote_device_list_[0]}));
} else {
VerifyAllTetherHosts(host_device_list);
}
} }
cryptauth::RemoteDeviceList test_remote_device_list_; cryptauth::RemoteDeviceList test_remote_device_list_;
...@@ -245,6 +294,8 @@ class TetherHostFetcherImplTest : public testing::Test { ...@@ -245,6 +294,8 @@ class TetherHostFetcherImplTest : public testing::Test {
std::unique_ptr<cryptauth::FakeRemoteDeviceProvider> std::unique_ptr<cryptauth::FakeRemoteDeviceProvider>
fake_remote_device_provider_; fake_remote_device_provider_;
std::unique_ptr<device_sync::FakeDeviceSyncClient> fake_device_sync_client_; std::unique_ptr<device_sync::FakeDeviceSyncClient> fake_device_sync_client_;
std::unique_ptr<chromeos::multidevice_setup::FakeMultiDeviceSetupClient>
fake_multidevice_setup_client_;
std::unique_ptr<TetherHostFetcher> tether_host_fetcher_; std::unique_ptr<TetherHostFetcher> tether_host_fetcher_;
......
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