Internal change

PiperOrigin-RevId: 371332999
This commit is contained in:
hai007
2021-04-30 07:57:08 -07:00
committed by Copybara-Service
parent 857958c87f
commit 54f30cd81d
17 changed files with 168 additions and 45 deletions
+3
View File
@@ -34,6 +34,9 @@ class FeatureFlags {
// If a scheduled runnable is already running, Cancel() will synchronously
// wait for the task to complete.
bool cancel_waits_for_running_tasks = true;
// Keep Alive frame interval and timeout in millis.
std::int32_t keep_alive_interval_millis = 5000;
std::int32_t keep_alive_timeout_millis = 30000;
};
static const FeatureFlags& GetInstance() {
+7 -2
View File
@@ -21,13 +21,18 @@ namespace location {
namespace nearby {
namespace {
constexpr FeatureFlags::Flags kTestFeatureFlags{.enable_cancellation_flag =
true};
constexpr FeatureFlags::Flags kTestFeatureFlags{
.enable_cancellation_flag = true,
.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_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);