diff options
author | Abraham Corea Diaz <abrahamcd@google.com> | 2021-06-30 16:55:56 +0000 |
---|---|---|
committer | Openscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2021-06-30 17:39:49 +0000 |
commit | fb98aabab3ee63d07f0a56c8873e8e24c18b2055 (patch) | |
tree | db29c2f0cdea02a114b57c620a9b574662a84c97 /cast/sender | |
parent | 6c58a6c92528d5b0b3dbe55f4bf44c69a27270cf (diff) | |
download | openscreen-fb98aabab3ee63d07f0a56c8873e8e24c18b2055.tar.gz |
Rename ServiceInfo to ReceiverInfo
This patch renames ServiceInfo and all related usages to ReceiverInfo.
Bug: b/155337619
Change-Id: I9337dbb7f64339bf60f079726f21af9a2452cddb
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2994467
Commit-Queue: Jordan Bayles <jophba@chromium.org>
Reviewed-by: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast/sender')
-rw-r--r-- | cast/sender/cast_app_discovery_service_impl.cc | 10 | ||||
-rw-r--r-- | cast/sender/cast_app_discovery_service_impl.h | 10 | ||||
-rw-r--r-- | cast/sender/cast_app_discovery_service_impl_unittest.cc | 36 | ||||
-rw-r--r-- | cast/sender/cast_platform_client.cc | 6 | ||||
-rw-r--r-- | cast/sender/cast_platform_client.h | 6 | ||||
-rw-r--r-- | cast/sender/cast_platform_client_unittest.cc | 4 | ||||
-rw-r--r-- | cast/sender/public/cast_app_discovery_service.h | 4 |
7 files changed, 38 insertions, 38 deletions
diff --git a/cast/sender/cast_app_discovery_service_impl.cc b/cast/sender/cast_app_discovery_service_impl.cc index 4ca9a016..cdf46bf2 100644 --- a/cast/sender/cast_app_discovery_service_impl.cc +++ b/cast/sender/cast_app_discovery_service_impl.cc @@ -76,7 +76,7 @@ void CastAppDiscoveryServiceImpl::Refresh() { } void CastAppDiscoveryServiceImpl::AddOrUpdateReceiver( - const ServiceInfo& receiver) { + const ReceiverInfo& receiver) { const std::string& device_id = receiver.unique_id; receivers_by_id_[device_id] = receiver; @@ -89,7 +89,7 @@ void CastAppDiscoveryServiceImpl::AddOrUpdateReceiver( } } -void CastAppDiscoveryServiceImpl::RemoveReceiver(const ServiceInfo& receiver) { +void CastAppDiscoveryServiceImpl::RemoveReceiver(const ReceiverInfo& receiver) { const std::string& device_id = receiver.unique_id; receivers_by_id_.erase(device_id); UpdateAvailabilityQueries( @@ -135,16 +135,16 @@ void CastAppDiscoveryServiceImpl::UpdateAvailabilityQueries( continue; std::vector<std::string> device_ids = availability_tracker_.GetAvailableDevices(source); - std::vector<ServiceInfo> receivers = GetReceiversByIds(device_ids); + std::vector<ReceiverInfo> receivers = GetReceiversByIds(device_ids); for (const auto& callback : it->second) { callback.callback(source, receivers); } } } -std::vector<ServiceInfo> CastAppDiscoveryServiceImpl::GetReceiversByIds( +std::vector<ReceiverInfo> CastAppDiscoveryServiceImpl::GetReceiversByIds( const std::vector<std::string>& device_ids) const { - std::vector<ServiceInfo> receivers; + std::vector<ReceiverInfo> receivers; for (const std::string& device_id : device_ids) { auto entry = receivers_by_id_.find(device_id); if (entry != receivers_by_id_.end()) { diff --git a/cast/sender/cast_app_discovery_service_impl.h b/cast/sender/cast_app_discovery_service_impl.h index fa577808..aa2354d2 100644 --- a/cast/sender/cast_app_discovery_service_impl.h +++ b/cast/sender/cast_app_discovery_service_impl.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cast/common/public/service_info.h" +#include "cast/common/public/receiver_info.h" #include "cast/sender/cast_app_availability_tracker.h" #include "cast/sender/cast_platform_client.h" #include "cast/sender/public/cast_app_discovery_service.h" @@ -37,8 +37,8 @@ class CastAppDiscoveryServiceImpl : public CastAppDiscoveryService { // app_id) pairs whose status is kUnavailable or kUnknown. void Refresh() override; - void AddOrUpdateReceiver(const ServiceInfo& receiver); - void RemoveReceiver(const ServiceInfo& receiver); + void AddOrUpdateReceiver(const ReceiverInfo& receiver); + void RemoveReceiver(const ReceiverInfo& receiver); private: struct AvailabilityCallbackEntry { @@ -60,7 +60,7 @@ class CastAppDiscoveryServiceImpl : public CastAppDiscoveryService { // Updates the availability query results for |sources|. void UpdateAvailabilityQueries(const std::vector<CastMediaSource>& sources); - std::vector<ServiceInfo> GetReceiversByIds( + std::vector<ReceiverInfo> GetReceiversByIds( const std::vector<std::string>& device_ids) const; // Returns true if an app availability request should be issued for @@ -72,7 +72,7 @@ class CastAppDiscoveryServiceImpl : public CastAppDiscoveryService { void RemoveAvailabilityCallback(uint32_t id) override; - std::map<std::string, ServiceInfo> receivers_by_id_; + std::map<std::string, ReceiverInfo> receivers_by_id_; // Registered availability queries and their associated callbacks keyed by // media source IDs. diff --git a/cast/sender/cast_app_discovery_service_impl_unittest.cc b/cast/sender/cast_app_discovery_service_impl_unittest.cc index a2eeb046..7f08b13e 100644 --- a/cast/sender/cast_app_discovery_service_impl_unittest.cc +++ b/cast/sender/cast_app_discovery_service_impl_unittest.cc @@ -9,7 +9,7 @@ #include "cast/common/channel/testing/fake_cast_socket.h" #include "cast/common/channel/testing/mock_socket_error_handler.h" #include "cast/common/channel/virtual_connection_router.h" -#include "cast/common/public/service_info.h" +#include "cast/common/public/receiver_info.h" #include "cast/sender/testing/test_helpers.h" #include "gtest/gtest.h" #include "platform/test/fake_clock.h" @@ -42,23 +42,23 @@ class CastAppDiscoveryServiceImplTest : public ::testing::Test { return fake_cast_socket_pair_.mock_peer_client; } - void AddOrUpdateReceiver(const ServiceInfo& receiver, int32_t socket_id) { + void AddOrUpdateReceiver(const ReceiverInfo& receiver, int32_t socket_id) { platform_client_.AddOrUpdateReceiver(receiver, socket_id); app_discovery_service_.AddOrUpdateReceiver(receiver); } CastAppDiscoveryService::Subscription StartObservingAvailability( const CastMediaSource& source, - std::vector<ServiceInfo>* save_receivers) { + std::vector<ReceiverInfo>* save_receivers) { return app_discovery_service_.StartObservingAvailability( source, [save_receivers](const CastMediaSource& source, - const std::vector<ServiceInfo>& receivers) { + const std::vector<ReceiverInfo>& receivers) { *save_receivers = receivers; }); } CastAppDiscoveryService::Subscription StartSourceA1Query( - std::vector<ServiceInfo>* receivers, + std::vector<ReceiverInfo>* receivers, int* request_id, std::string* sender_id) { auto subscription = StartObservingAvailability(source_a_1_, receivers); @@ -91,18 +91,18 @@ class CastAppDiscoveryServiceImplTest : public ::testing::Test { CastMediaSource source_a_2_{"cast:AAA?clientId=2", {"AAA"}}; CastMediaSource source_b_1_{"cast:BBB?clientId=1", {"BBB"}}; - ServiceInfo receiver_; + ReceiverInfo receiver_; }; TEST_F(CastAppDiscoveryServiceImplTest, StartObservingAvailability) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; int request_id; std::string sender_id; auto subscription1 = StartSourceA1Query(&receivers1, &request_id, &sender_id); // Same app ID should not trigger another request. EXPECT_CALL(peer_client(), OnMessage(_, _)).Times(0); - std::vector<ServiceInfo> receivers2; + std::vector<ReceiverInfo> receivers2; auto subscription2 = StartObservingAvailability(source_a_2_, &receivers2); CastMessage availability_response = @@ -123,7 +123,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, StartObservingAvailability) { } TEST_F(CastAppDiscoveryServiceImplTest, ReAddAvailQueryUsesCachedValue) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; int request_id; std::string sender_id; auto subscription1 = StartSourceA1Query(&receivers1, &request_id, &sender_id); @@ -145,7 +145,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, ReAddAvailQueryUsesCachedValue) { } TEST_F(CastAppDiscoveryServiceImplTest, AvailQueryUpdatedOnReceiverUpdate) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; int request_id; std::string sender_id; auto subscription1 = StartSourceA1Query(&receivers1, &request_id, &sender_id); @@ -169,9 +169,9 @@ TEST_F(CastAppDiscoveryServiceImplTest, AvailQueryUpdatedOnReceiverUpdate) { } TEST_F(CastAppDiscoveryServiceImplTest, Refresh) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; auto subscription1 = StartObservingAvailability(source_a_1_, &receivers1); - std::vector<ServiceInfo> receivers2; + std::vector<ReceiverInfo> receivers2; auto subscription2 = StartObservingAvailability(source_b_1_, &receivers2); // Adding a receiver after app registered causes two separate app availability @@ -236,7 +236,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, .WillOnce([&request_idA, &sender_id](CastSocket*, CastMessage message) { VerifyAppAvailabilityRequest(message, "AAA", &request_idA, &sender_id); }); - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; auto subscription1 = StartObservingAvailability(source_a_1_, &receivers1); int request_idB = -1; @@ -244,7 +244,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, .WillOnce([&request_idB, &sender_id](CastSocket*, CastMessage message) { VerifyAppAvailabilityRequest(message, "BBB", &request_idB, &sender_id); }); - std::vector<ServiceInfo> receivers2; + std::vector<ReceiverInfo> receivers2; auto subscription2 = StartObservingAvailability(source_b_1_, &receivers2); // Add a new receiver with a corresponding socket. @@ -252,7 +252,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, {{192, 168, 1, 19}, 2345}); CastSocket* socket2 = fake_sockets2.socket.get(); router_.TakeSocket(&mock_error_handler_, std::move(fake_sockets2.socket)); - ServiceInfo receiver2; + ReceiverInfo receiver2; receiver2.unique_id = "deviceId2"; receiver2.v4_address = fake_sockets2.remote_endpoint.address; receiver2.port = fake_sockets2.remote_endpoint.port; @@ -283,7 +283,7 @@ TEST_F(CastAppDiscoveryServiceImplTest, } TEST_F(CastAppDiscoveryServiceImplTest, StartObservingAvailabilityCachedValue) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; int request_id; std::string sender_id; auto subscription1 = StartSourceA1Query(&receivers1, &request_id, &sender_id); @@ -297,14 +297,14 @@ TEST_F(CastAppDiscoveryServiceImplTest, StartObservingAvailabilityCachedValue) { // Same app ID should not trigger another request, but it should return // cached value. EXPECT_CALL(peer_client(), OnMessage(_, _)).Times(0); - std::vector<ServiceInfo> receivers2; + std::vector<ReceiverInfo> receivers2; auto subscription2 = StartObservingAvailability(source_a_2_, &receivers2); ASSERT_EQ(receivers2.size(), 1u); EXPECT_EQ(receivers2[0].unique_id, "deviceId1"); } TEST_F(CastAppDiscoveryServiceImplTest, AvailabilityUnknownOrUnavailable) { - std::vector<ServiceInfo> receivers1; + std::vector<ReceiverInfo> receivers1; int request_id; std::string sender_id; auto subscription1 = StartSourceA1Query(&receivers1, &request_id, &sender_id); diff --git a/cast/sender/cast_platform_client.cc b/cast/sender/cast_platform_client.cc index c321201a..d3f39cfb 100644 --- a/cast/sender/cast_platform_client.cc +++ b/cast/sender/cast_platform_client.cc @@ -11,7 +11,7 @@ #include "absl/strings/str_cat.h" #include "cast/common/channel/virtual_connection_router.h" #include "cast/common/public/cast_socket.h" -#include "cast/common/public/service_info.h" +#include "cast/common/public/receiver_info.h" #include "util/json/json_serialization.h" #include "util/osp_logging.h" #include "util/stringprintf.h" @@ -82,12 +82,12 @@ absl::optional<int> CastPlatformClient::RequestAppAvailability( return request_id; } -void CastPlatformClient::AddOrUpdateReceiver(const ServiceInfo& device, +void CastPlatformClient::AddOrUpdateReceiver(const ReceiverInfo& device, int socket_id) { socket_id_by_device_id_[device.unique_id] = socket_id; } -void CastPlatformClient::RemoveReceiver(const ServiceInfo& device) { +void CastPlatformClient::RemoveReceiver(const ReceiverInfo& device) { auto pending_requests_it = pending_requests_by_device_id_.find(device.unique_id); if (pending_requests_it != pending_requests_by_device_id_.end()) { diff --git a/cast/sender/cast_platform_client.h b/cast/sender/cast_platform_client.h index 8ea9a99a..0acb35a7 100644 --- a/cast/sender/cast_platform_client.h +++ b/cast/sender/cast_platform_client.h @@ -20,7 +20,7 @@ namespace openscreen { namespace cast { -struct ServiceInfo; +struct ReceiverInfo; class VirtualConnectionRouter; // This class handles Cast messages that generally relate to the "platform", in @@ -48,8 +48,8 @@ class CastPlatformClient final : public CastMessageHandler { // Notifies this object about general receiver connectivity or property // changes. - void AddOrUpdateReceiver(const ServiceInfo& device, int socket_id); - void RemoveReceiver(const ServiceInfo& device); + void AddOrUpdateReceiver(const ReceiverInfo& device, int socket_id); + void RemoveReceiver(const ReceiverInfo& device); void CancelRequest(int request_id); diff --git a/cast/sender/cast_platform_client_unittest.cc b/cast/sender/cast_platform_client_unittest.cc index ae721a15..4c10ac91 100644 --- a/cast/sender/cast_platform_client_unittest.cc +++ b/cast/sender/cast_platform_client_unittest.cc @@ -9,7 +9,7 @@ #include "cast/common/channel/testing/fake_cast_socket.h" #include "cast/common/channel/testing/mock_socket_error_handler.h" #include "cast/common/channel/virtual_connection_router.h" -#include "cast/common/public/service_info.h" +#include "cast/common/public/receiver_info.h" #include "cast/sender/testing/test_helpers.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -51,7 +51,7 @@ class CastPlatformClientTest : public ::testing::Test { FakeClock clock_{Clock::now()}; FakeTaskRunner task_runner_{&clock_}; CastPlatformClient platform_client_{&router_, &FakeClock::now, &task_runner_}; - ServiceInfo receiver_; + ReceiverInfo receiver_; }; TEST_F(CastPlatformClientTest, AppAvailability) { diff --git a/cast/sender/public/cast_app_discovery_service.h b/cast/sender/public/cast_app_discovery_service.h index c05d66bd..f85e35b1 100644 --- a/cast/sender/public/cast_app_discovery_service.h +++ b/cast/sender/public/cast_app_discovery_service.h @@ -7,7 +7,7 @@ #include <vector> -#include "cast/common/public/service_info.h" +#include "cast/common/public/receiver_info.h" namespace openscreen { namespace cast { @@ -19,7 +19,7 @@ class CastAppDiscoveryService { public: using AvailabilityCallback = std::function<void(const CastMediaSource& source, - const std::vector<ServiceInfo>& devices)>; + const std::vector<ReceiverInfo>& devices)>; class Subscription { public: |