From bf5f843dfe4d1df6deaa40397fef48442d42bc12 Mon Sep 17 00:00:00 2001 From: Guogang Li Date: Wed, 12 Jun 2024 16:22:01 -0700 Subject: [PATCH] Added logic to stabilize endpoint IDs PiperOrigin-RevId: 642774719 --- connections/implementation/BUILD | 3 - connections/implementation/client_proxy.cc | 107 +++---- connections/implementation/client_proxy.h | 29 +- .../implementation/client_proxy_test.cc | 288 +----------------- 4 files changed, 48 insertions(+), 379 deletions(-) diff --git a/connections/implementation/BUILD b/connections/implementation/BUILD index 5adc6b9c..512790f0 100644 --- a/connections/implementation/BUILD +++ b/connections/implementation/BUILD @@ -237,7 +237,6 @@ cc_test( deps = [ ":internal", ":internal_test", - "//base:casts", "//connections:core_types", "//connections/implementation/analytics", "//connections/implementation/flags:connections_flags", @@ -250,7 +249,6 @@ cc_test( "//internal/interop:authentication_transport_interface", "//internal/interop:device", "//internal/platform:base", - "//internal/platform:cancellation_flag", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", @@ -262,7 +260,6 @@ cc_test( "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", diff --git a/connections/implementation/client_proxy.cc b/connections/implementation/client_proxy.cc index 2e0185af..75a93f5d 100644 --- a/connections/implementation/client_proxy.cc +++ b/connections/implementation/client_proxy.cc @@ -15,46 +15,32 @@ #include "connections/implementation/client_proxy.h" #include +#include #include #include +#include #include #include -#include #include #include #include -#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/functional/any_invocable.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" -#include "absl/time/time.h" -#include "absl/types/span.h" #include "connections/advertising_options.h" -#include "connections/connection_options.h" #include "connections/discovery_options.h" -#include "connections/implementation/analytics/analytics_recorder.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/listeners.h" #include "connections/medium_selector.h" -#include "connections/payload.h" -#include "connections/status.h" -#include "connections/strategy.h" #include "connections/v3/bandwidth_info.h" #include "connections/v3/connection_listening_options.h" -#include "connections/v3/connection_result.h" -#include "connections/v3/connections_device.h" #include "connections/v3/connections_device_provider.h" -#include "connections/v3/listeners.h" #include "internal/analytics/event_logger.h" #include "internal/flags/nearby_flags.h" -#include "internal/interop/device.h" -#include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" -#include "internal/platform/cancellation_flag.h" -#include "internal/platform/error_code_params.h" #include "internal/platform/error_code_recorder.h" #include "internal/platform/feature_flags.h" #include "internal/platform/implementation/platform.h" @@ -160,24 +146,15 @@ void ClientProxy::SetBluetoothMacAddress( } std::string ClientProxy::GenerateLocalEndpointId() { - if (!cached_endpoint_id_.empty()) { - if (high_vis_mode_) { - NEARBY_LOGS(INFO) << "ClientProxy [Local Endpoint Re-using cached " - "endpoint id due to high visibility mode]: client=" - << GetClientId() - << "; cached_endpoint_id_=" << cached_endpoint_id_; - return cached_endpoint_id_; - } else if (use_stable_endpoint_id_) { - if (high_vis_mode_ != last_high_vis_mode_) { - NEARBY_LOGS(INFO) << "ClientProxy [Local Endpoint Re-using cached " - "endpoint id due to switch visibility.]: client=" - << GetClientId() - << "; cached_endpoint_id_=" << cached_endpoint_id_; - return cached_endpoint_id_; - } + if (high_vis_mode_) { + if (!local_high_vis_mode_cache_endpoint_id_.empty()) { + NEARBY_LOGS(INFO) + << "ClientProxy [Local Endpoint Re-using cached endpoint id]: client=" + << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" + << local_high_vis_mode_cache_endpoint_id_; + return local_high_vis_mode_cache_endpoint_id_; } } - std::string id; Prng prng; for (int i = 0; i < kEndpointIdLength; i++) { @@ -204,11 +181,14 @@ void ClientProxy::StartedAdvertising( NEARBY_LOGS(INFO) << "ClientProxy [StartedAdvertising]: client=" << GetClientId(); - use_stable_endpoint_id_ = advertising_options.use_stable_endpoint_id; - - cached_endpoint_id_ = local_endpoint_id_; - - CancelClearCachedEndpointIdAlarm(); + if (high_vis_mode_) { + local_high_vis_mode_cache_endpoint_id_ = local_endpoint_id_; + NEARBY_LOGS(INFO) + << "ClientProxy [High Visibility Mode Adv, Cache EndpointId]: client=" + << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" + << local_high_vis_mode_cache_endpoint_id_; + CancelClearLocalHighVisModeCacheEndpointIdAlarm(); + } advertising_info_ = {service_id, listener}; advertising_options_ = advertising_options; @@ -232,7 +212,6 @@ void ClientProxy::StoppedAdvertising() { OnSessionComplete(); ExitHighVisibilityMode(); - ScheduleClearCachedEndpointIdAlarm(); } bool ClientProxy::IsAdvertising() const { @@ -550,10 +529,6 @@ void ClientProxy::OnDisconnected(const std::string& endpoint_id, bool notify) { } CancelEndpoint(endpoint_id); - - if (use_stable_endpoint_id_ && !HasOngoingConnection()) { - ScheduleClearCachedEndpointIdAlarm(); - } } bool ClientProxy::ConnectionStatusMatches(const std::string& endpoint_id, @@ -650,11 +625,6 @@ std::vector ClientProxy::GetConnectedEndpoints() const { }); } -bool ClientProxy::HasOngoingConnection() const { - return !GetPendingConnectedEndpoints().empty() || - !GetConnectedEndpoints().empty(); -} - std::int32_t ClientProxy::GetNumOutgoingConnections() const { return GetMatchingEndpoints([](const Connection& connection) { return connection.status == Connection::kConnected && @@ -1076,33 +1046,28 @@ void ClientProxy::ExitHighVisibilityMode() { NEARBY_LOGS(INFO) << "ClientProxy [ExitHighVisibilityMode]: client=" << GetClientId(); - last_high_vis_mode_ = high_vis_mode_; high_vis_mode_ = false; + ScheduleClearLocalHighVisModeCacheEndpointIdAlarm(); } -void ClientProxy::ScheduleClearCachedEndpointIdAlarm() { - CancelClearCachedEndpointIdAlarm(); +void ClientProxy::ScheduleClearLocalHighVisModeCacheEndpointIdAlarm() { + CancelClearLocalHighVisModeCacheEndpointIdAlarm(); - if (cached_endpoint_id_.empty()) { + if (local_high_vis_mode_cache_endpoint_id_.empty()) { NEARBY_LOGS(VERBOSE) << "ClientProxy [There is no cached local high power " "advertising endpoint Id]: client=" << GetClientId(); return; } - if (use_stable_endpoint_id_ && HasOngoingConnection()) { - NEARBY_LOGS(VERBOSE) << "ClientProxy [Handle clearing cached endpoint ID " - "during disconnection]: client=" - << GetClientId(); - return; - } - // Schedule to clear cache high visibility mode advertisement endpoint id in // 30s. - NEARBY_LOGS(INFO) - << "ClientProxy [ScheduleClearCachedEndpointIdAlarm]: client=" - << GetClientId() << "; cached_endpoint_id_=" << cached_endpoint_id_; - cached_endpoint_id_alarm_ = + NEARBY_LOGS(INFO) << "ClientProxy [High Visibility Mode Adv, Schedule to " + "Clear Cache EndpointId]: client=" + << GetClientId() + << "; local_high_vis_mode_cache_endpoint_id_=" + << local_high_vis_mode_cache_endpoint_id_; + clear_local_high_vis_mode_cache_endpoint_id_alarm_ = std::make_unique( "clear_high_power_endpoint_id_cache", [this]() { @@ -1110,18 +1075,19 @@ void ClientProxy::ScheduleClearCachedEndpointIdAlarm() { NEARBY_LOGS(INFO) << "ClientProxy [Cleared cached local high power advertising " "endpoint Id.]: client=" - << GetClientId() - << "; cached_endpoint_id_=" << cached_endpoint_id_; - cached_endpoint_id_.clear(); + << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" + << local_high_vis_mode_cache_endpoint_id_; + local_high_vis_mode_cache_endpoint_id_.clear(); }, kHighPowerAdvertisementEndpointIdCacheTimeout, &single_thread_executor_); } -void ClientProxy::CancelClearCachedEndpointIdAlarm() { - if (cached_endpoint_id_alarm_ && cached_endpoint_id_alarm_->IsValid()) { - cached_endpoint_id_alarm_->Cancel(); - cached_endpoint_id_alarm_.reset(); +void ClientProxy::CancelClearLocalHighVisModeCacheEndpointIdAlarm() { + if (clear_local_high_vis_mode_cache_endpoint_id_alarm_ && + clear_local_high_vis_mode_cache_endpoint_id_alarm_->IsValid()) { + clear_local_high_vis_mode_cache_endpoint_id_alarm_->Cancel(); + clear_local_high_vis_mode_cache_endpoint_id_alarm_.reset(); } } @@ -1177,7 +1143,7 @@ bool ClientProxy::IsMultiplexSocketSupported(absl::string_view endpoint_id, } int combined_result = GetLocalMultiplexSocketBitmask() & - item->first.remote_multiplex_socket_bitmask; + item->first.remote_multiplex_socket_bitmask; switch (medium) { case Medium::BLUETOOTH: return (combined_result & kBtMultiplexEnabled) != 0; @@ -1188,6 +1154,7 @@ bool ClientProxy::IsMultiplexSocketSupported(absl::string_view endpoint_id, } } + std::string ClientProxy::ToString(PayloadProgressInfo::Status status) const { switch (status) { case PayloadProgressInfo::Status::kSuccess: diff --git a/connections/implementation/client_proxy.h b/connections/implementation/client_proxy.h index e28edc86..4d8e409b 100644 --- a/connections/implementation/client_proxy.h +++ b/connections/implementation/client_proxy.h @@ -24,7 +24,6 @@ #include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" -#include "absl/time/time.h" #include "connections/advertising_options.h" #include "connections/connection_options.h" #include "connections/discovery_options.h" @@ -32,7 +31,6 @@ #include "connections/implementation/proto/offline_wire_formats.pb.h" #include "connections/listeners.h" #include "connections/medium_selector.h" -#include "connections/payload.h" #include "connections/status.h" #include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" @@ -51,8 +49,6 @@ #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/types/span.h" -#include "internal/platform/os_name.h" -#include "internal/platform/scheduled_executor.h" namespace nearby { namespace connections { @@ -195,9 +191,6 @@ class ClientProxy final { std::vector GetConnectedEndpoints() const; // Returns all endpoints that are still awaiting acceptance. std::vector GetPendingConnectedEndpoints() const; - // Returns true if there is at least one connected connection or one pending - // connection. - bool HasOngoingConnection() const; // Returns the number of endpoints that are connected and outgoing. std::int32_t GetNumOutgoingConnections() const; // Returns the number of endpoints that are connected and incoming. @@ -289,7 +282,9 @@ class ClientProxy final { return supports_safe_to_disconnect_; } - bool IsSupportAutoReconnect() const { return support_auto_reconnect_; } + bool IsSupportAutoReconnect() const { + return support_auto_reconnect_; + } const std::int32_t& GetLocalSafeToDisconnectVersion() const { return local_safe_to_disconnect_version_; @@ -390,8 +385,8 @@ class ClientProxy final { absl::AnyInvocable pred) const; std::string GenerateLocalEndpointId(); - void ScheduleClearCachedEndpointIdAlarm(); - void CancelClearCachedEndpointIdAlarm(); + void ScheduleClearLocalHighVisModeCacheEndpointIdAlarm(); + void CancelClearLocalHighVisModeCacheEndpointIdAlarm(); location::nearby::connections::OsInfo::OsType OSNameToOsInfoType( api::OSName osName); @@ -402,20 +397,11 @@ class ClientProxy final { std::int64_t client_id_; std::string local_endpoint_id_; std::string local_endpoint_info_; - - // When use_stable_endpoint_id_ is true, the endpoint id is stable in - // below cases: - // 1) if no connection is established and in high visibility mode, keep 30s - // after stopped advertising. - // 2) if connection is established, keep 30s after disconnected. - // 3) if high_vis_mode_ changed, keep 30s after high_vis_mode_ changed. - bool use_stable_endpoint_id_ = false; // If currently is advertising in high visibility mode is true: high power and // Bluetooth Classic enabled. When high_visibility_mode_ is true, the endpoint // id is stable for 30s. When high_visibility_mode_ is false, the endpoint id // always rotates. bool high_vis_mode_ = false; - bool last_high_vis_mode_ = false; // Caches the endpoint id when it is in high visibility mode advertisement for // 30s. Currently, Nearby Connections keeps rotating endpoint id. The client // (Nearby Share) treats different endpoints as different receivers, duplicate @@ -424,9 +410,10 @@ class ClientProxy final { // here. empty if 1) There is no high power advertisement before 2) The // endpoint id cached here in previous high visibility mode advertisement // expires. - std::string cached_endpoint_id_; + std::string local_high_vis_mode_cache_endpoint_id_; ScheduledExecutor single_thread_executor_; - std::unique_ptr cached_endpoint_id_alarm_; + std::unique_ptr + clear_local_high_vis_mode_cache_endpoint_id_alarm_; // If not empty, we are currently advertising and accepting connection // requests for the given service_id. diff --git a/connections/implementation/client_proxy_test.cc b/connections/implementation/client_proxy_test.cc index eb4a6b68..c4382557 100644 --- a/connections/implementation/client_proxy_test.cc +++ b/connections/implementation/client_proxy_test.cc @@ -15,42 +15,28 @@ #include "connections/implementation/client_proxy.h" #include +#include #include #include #include #include #include -#include "base/casts.h" #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" -#include "absl/strings/str_format.h" -#include "absl/strings/string_view.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "absl/types/span.h" -#include "connections/advertising_options.h" #include "connections/listeners.h" -#include "connections/medium_selector.h" -#include "connections/payload.h" -#include "connections/status.h" #include "connections/strategy.h" -#include "connections/v3/bandwidth_info.h" #include "connections/v3/connection_listening_options.h" -#include "connections/v3/connection_result.h" -#include "connections/v3/connections_device_provider.h" -#include "connections/v3/listeners.h" #include "internal/analytics/mock_event_logger.h" -#include "internal/interop/device.h" #include "internal/interop/device_provider.h" #include "internal/platform/byte_array.h" -#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/feature_flags.h" #include "internal/platform/medium_environment.h" -#include "internal/platform/mutex.h" -#include "internal/platform/mutex_lock.h" #include "proto/connections_enums.pb.h" namespace nearby { @@ -761,216 +747,6 @@ TEST_F(ClientProxyTest, EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } -// Test case for background ID rotation. -TEST_F(ClientProxyTest, - EndpointIdRotateWhenLowVizAdvertisementAfterLowVizStableAdvertisement) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions high_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, - high_viz_advertising_options); - - StopAdvertising(&client1_); - - AdvertisingOptions low_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); - - EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - -TEST_F(ClientProxyTest, - NoRotateWhenLowVizAdvertisementAfterHighVizAndStableAdvertisement) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions high_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - false, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, - high_viz_advertising_options); - - StopAdvertising(&client1_); - - AdvertisingOptions low_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - }; - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); - - EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - -TEST_F( - ClientProxyTest, - NoRotateWhenAdvertisementHasConnectionAfterStableAdvertisementForAWhile) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions high_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, - high_viz_advertising_options); - - OnAdvertisingConnectionInitiated(&client1_, advertising_endpoint_1); - StopAdvertising(&client1_); - - // Wait to expire and then advertise. - absl::SleepFor(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + - absl::Milliseconds(100)); - AdvertisingOptions low_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - }; - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); - - EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - -TEST_F(ClientProxyTest, NoRotateWhenAdvertisementAfterDisconnection) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions high_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - false, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, - high_viz_advertising_options); - - OnAdvertisingConnectionInitiated(&client1_, advertising_endpoint_1); - StopAdvertising(&client1_); - absl::SleepFor(absl::Seconds(2)); - client1_.OnDisconnected(advertising_endpoint_1.id, true); - - AdvertisingOptions low_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - }; - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); - - EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - -TEST_F(ClientProxyTest, RotateWhenAdvertisementAfterDisconnectionForAWhile) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions high_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - false, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, - high_viz_advertising_options); - - OnAdvertisingConnectionInitiated(&client1_, advertising_endpoint_1); - StopAdvertising(&client1_); - client1_.OnDisconnected(advertising_endpoint_1.id, true); - - // Wait to expire and then advertise. - absl::SleepFor(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + - absl::Milliseconds(100)); - AdvertisingOptions low_viz_advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - }; - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); - - EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - // Tests endpoint_id rotates when discover. TEST_F(ClientProxyTest, EndpointIdRotateWhenStartDiscovery) { BooleanMediumSelector booleanMediumSelector; @@ -998,36 +774,6 @@ TEST_F(ClientProxyTest, EndpointIdRotateWhenStartDiscovery) { EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } -TEST_F(ClientProxyTest, - NoEndpointIdRotateWhenStartDiscoveryAfterStableAdvertising) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = true; - - AdvertisingOptions advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - false, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - - Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); - - StopAdvertising(&client1_); - StartDiscovery(&client1_, GetDiscoveryListener()); - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); - - EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - // Tests the low visibility mode with bluetooth disabled advertisment. TEST_F(ClientProxyTest, EndpointIdRotateWhenLowVizAdvertisementWithBluetoothDisabled) { @@ -1055,6 +801,7 @@ TEST_F(ClientProxyTest, EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } +// Tests the low visibility mode with low power advertisment. TEST_F(ClientProxyTest, EndpointIdRotateWhenLowVizAdvertisementWithLowPower) { BooleanMediumSelector booleanMediumSelector; booleanMediumSelector.bluetooth = false; @@ -1079,35 +826,6 @@ TEST_F(ClientProxyTest, EndpointIdRotateWhenLowVizAdvertisementWithLowPower) { EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } -// Tests the low visibility mode with low power advertisment. -TEST_F(ClientProxyTest, - EndpointIdRotateWhenLowVizAdvertisementWithLowPowerAndStableEndpointId) { - BooleanMediumSelector booleanMediumSelector; - booleanMediumSelector.bluetooth = false; - - AdvertisingOptions advertising_options{ - { - strategy_, - booleanMediumSelector, - }, - false, // auto_upgrade_bandwidth - false, // enforce_topology_constraints - true, // low_power - true, // enable_bluetooth_listening - false, // enable_webrtc_listening - true, // use_stable_endpoint_id - }; - Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); - - StopAdvertising(&client1_); - - Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); - - EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); -} - TEST_F(ClientProxyTest, NotLogSessionForStoppedAdvertisingWithConnection) { Endpoint advertising_endpoint = StartAdvertising(&client1_, advertising_connection_listener_); @@ -1176,7 +894,7 @@ TEST_F(ClientProxyTest, // Before EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - EXPECT_TRUE(client2_.IsDiscovering()); // Discovering + EXPECT_TRUE(client2_.IsDiscovering()); // Discoverying EXPECT_FALSE(client2_.HasPendingConnectionToEndpoint( advertising_endpoint.id)); // No Connections