Enable cancellation flag support by default

PiperOrigin-RevId: 524329836
This commit is contained in:
Janusz Sobczak
2023-04-14 10:44:37 -07:00
committed by Copybara-Service
parent 00bba36219
commit 6cdc9890b5
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class FeatureFlags {
public:
// Holds for all the feature flags.
struct Flags {
bool enable_cancellation_flag = false;
bool enable_cancellation_flag = true;
bool enable_async_bandwidth_upgrade = true;
// If a scheduled runnable is already running, Cancel() will synchronously
// wait for the task to complete.
+4 -4
View File
@@ -21,23 +21,23 @@ namespace nearby {
namespace {
constexpr FeatureFlags::Flags kTestFeatureFlags{
.enable_cancellation_flag = true,
.enable_cancellation_flag = false,
.keep_alive_interval_millis = 5000,
.keep_alive_timeout_millis = 30000};
TEST(FeatureFlagsTest, ToSetFeatureWorks) {
const FeatureFlags& features = FeatureFlags::GetInstance();
EXPECT_FALSE(features.GetFlags().enable_cancellation_flag);
EXPECT_TRUE(features.GetFlags().enable_cancellation_flag);
EXPECT_EQ(5000, features.GetFlags().keep_alive_interval_millis);
EXPECT_EQ(30000, features.GetFlags().keep_alive_timeout_millis);
MediumEnvironment& medium_environment = MediumEnvironment::Instance();
medium_environment.SetFeatureFlags(kTestFeatureFlags);
EXPECT_TRUE(features.GetFlags().enable_cancellation_flag);
EXPECT_FALSE(features.GetFlags().enable_cancellation_flag);
const FeatureFlags& another_features_ref = FeatureFlags::GetInstance();
EXPECT_TRUE(another_features_ref.GetFlags().enable_cancellation_flag);
EXPECT_FALSE(another_features_ref.GetFlags().enable_cancellation_flag);
}
} // namespace