diff --git a/connections/implementation/wifi_direct_bwu_test.cc b/connections/implementation/wifi_direct_bwu_test.cc index 6763828c..127065f2 100644 --- a/connections/implementation/wifi_direct_bwu_test.cc +++ b/connections/implementation/wifi_direct_bwu_test.cc @@ -18,6 +18,7 @@ #include "gtest/gtest.h" #include "connections/implementation/bwu_handler.h" #include "connections/implementation/wifi_direct_bwu_handler.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/medium_environment.h" namespace nearby { @@ -50,7 +51,7 @@ TEST_F(WifiDirectTest, CanCreateBwuHandler) { handler.reset(); } -TEST_F(WifiDirectTest, SoftAPBWUInit_STACreateEndpointChannel) { +TEST_F(WifiDirectTest, WFDGOBWUInit_GCCreateEndpointChannel) { CountDownLatch start_latch(1); CountDownLatch accept_latch(1); CountDownLatch end_latch(1); @@ -108,9 +109,14 @@ TEST_F(WifiDirectTest, SoftAPBWUInit_STACreateEndpointChannel) { handler_2->CreateUpgradedEndpointChannel( &wifi_direct_gc, /*service_id=*/"A", /*endpoint_id=*/"1", bwu_frame.upgrade_path_info()); - EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_EQ(new_channel->GetMedium(), - location::nearby::proto::connections::Medium::WIFI_DIRECT); + if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) { + EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); + EXPECT_EQ(new_channel->GetMedium(), + location::nearby::proto::connections::Medium::WIFI_DIRECT); + } else { + accept_latch.CountDown(); + EXPECT_EQ(new_channel, nullptr); + } EXPECT_TRUE(mediums_2.GetWifiDirect().IsConnectedToGO()); handler_2->RevertResponderState(/*service_id=*/"A"); end_latch.CountDown(); diff --git a/connections/implementation/wifi_hotspot_test.cc b/connections/implementation/wifi_hotspot_test.cc index 698bb065..c24a2988 100644 --- a/connections/implementation/wifi_hotspot_test.cc +++ b/connections/implementation/wifi_hotspot_test.cc @@ -17,6 +17,7 @@ #include "gtest/gtest.h" #include "connections/implementation/bwu_handler.h" #include "connections/implementation/wifi_hotspot_bwu_handler.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/medium_environment.h" namespace nearby { @@ -96,7 +97,7 @@ TEST_F(WifiHotspotTest, SoftAPBWUInit_STACreateEndpointChannel) { std::make_unique(mediums_2, notifications_2); client_executor.Execute([&handler_2, &client_2, &upgrade_frame, &accept_latch, - &end_latch]() { + &end_latch, &mediums_2]() { auto bwu_frame = upgrade_frame.result().v1().bandwidth_upgrade_negotiation(); @@ -104,14 +105,22 @@ TEST_F(WifiHotspotTest, SoftAPBWUInit_STACreateEndpointChannel) { handler_2->CreateUpgradedEndpointChannel(&client_2, /*service_id=*/"A", /*endpoint_id=*/"1", bwu_frame.upgrade_path_info()); - EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_EQ(new_channel->GetMedium(), - location::nearby::proto::connections::Medium::WIFI_HOTSPOT); + if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) { + EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); + EXPECT_EQ(new_channel->GetMedium(), + location::nearby::proto::connections::Medium::WIFI_HOTSPOT); + } else { + accept_latch.CountDown(); + EXPECT_EQ(new_channel, nullptr); + } + EXPECT_TRUE(mediums_2.GetWifiHotspot().IsConnectedToHotspot()); + handler_2->RevertResponderState(/*service_id=*/"A"); end_latch.CountDown(); }); EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); EXPECT_TRUE(end_latch.Await(kWaitDuration).result()); + EXPECT_FALSE(mediums_2.GetWifiHotspot().IsConnectedToHotspot()); } } // namespace connections