From d7f9550647e4a6160408676eb210dd69ae91a402 Mon Sep 17 00:00:00 2001 From: Jonas Oreland Date: Tue, 22 Mar 2022 16:52:08 +0100 Subject: [PATCH] Fix interaction between ScopedkeyValueConfig and global field trials string This patch fixes a problem for test programs that mix usage of ScopedKeyValueConfig and the global field trial string. In this case, tests that were using CallTest. The solution is to check the global string when nothing has been explicitly added to a ScopedKeyValueConfig. Bug: webrtc:13828 Change-Id: Ib89735670cfe93340ca0a8bac53f8a64a600ad66 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256366 Reviewed-by: Mirko Bonadei Reviewed-by: Harald Alvestrand Commit-Queue: Jonas Oreland Cr-Commit-Position: refs/heads/main@{#36294} --- test/BUILD.gn | 1 + test/scoped_key_value_config.cc | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/BUILD.gn b/test/BUILD.gn index ae0f3ba8d3..e9d63ca42b 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -251,6 +251,7 @@ rtc_library("scoped_key_value_config") { ":field_trial", "../api:webrtc_key_value_config", "../rtc_base:checks", + "../system_wrappers:field_trial", ] absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ] } diff --git a/test/scoped_key_value_config.cc b/test/scoped_key_value_config.cc index 723be22261..d6090b7f31 100644 --- a/test/scoped_key_value_config.cc +++ b/test/scoped_key_value_config.cc @@ -12,6 +12,7 @@ #include "api/webrtc_key_value_config.h" #include "rtc_base/checks.h" +#include "system_wrappers/include/field_trial.h" #include "test/field_trial.h" namespace { @@ -112,7 +113,9 @@ std::string ScopedKeyValueConfig::LookupRecurse(absl::string_view key) const { return parent_->LookupRecurse(key); } - return ""; + // When at the root, check the global string so that test programs using + // a mix between ScopedKeyValueConfig and the global string continue to work + return webrtc::field_trial::FindFullName(std::string(key)); } } // namespace test