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 <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36294}
This commit is contained in:
Jonas Oreland 2022-03-22 16:52:08 +01:00 committed by WebRTC LUCI CQ
parent 8f1159b518
commit d7f9550647
2 changed files with 5 additions and 1 deletions

View file

@ -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" ]
}

View file

@ -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