Adopt absl::string_view in field trial test helpers

Bug: webrtc:13579
Change-Id: Ie16b2f1cf5288cf795ea6d40f4b3a37f76f00f76
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258422
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36505}
diff --git a/test/explicit_key_value_config.cc b/test/explicit_key_value_config.cc
index a080a0c..c9e5ac1 100644
--- a/test/explicit_key_value_config.cc
+++ b/test/explicit_key_value_config.cc
@@ -10,13 +10,14 @@
 
 #include "test/explicit_key_value_config.h"
 
+#include "absl/strings/string_view.h"
 #include "api/field_trials_view.h"
 #include "rtc_base/checks.h"
 
 namespace webrtc {
 namespace test {
 
-ExplicitKeyValueConfig::ExplicitKeyValueConfig(const std::string& s) {
+ExplicitKeyValueConfig::ExplicitKeyValueConfig(absl::string_view s) {
   std::string::size_type field_start = 0;
   while (field_start < s.size()) {
     std::string::size_type separator_pos = s.find('/', field_start);
@@ -24,7 +25,7 @@
         << "Missing separator '/' after field trial key.";
     RTC_CHECK_GT(separator_pos, field_start)
         << "Field trial key cannot be empty.";
-    std::string key = s.substr(field_start, separator_pos - field_start);
+    std::string key(s.substr(field_start, separator_pos - field_start));
     field_start = separator_pos + 1;
 
     RTC_CHECK_LT(field_start, s.size())
@@ -34,7 +35,7 @@
         << "Missing terminating '/' in field trial string.";
     RTC_CHECK_GT(separator_pos, field_start)
         << "Field trial value cannot be empty.";
-    std::string value = s.substr(field_start, separator_pos - field_start);
+    std::string value(s.substr(field_start, separator_pos - field_start));
     field_start = separator_pos + 1;
 
     key_value_map_[key] = value;
@@ -46,7 +47,7 @@
 }
 
 std::string ExplicitKeyValueConfig::Lookup(absl::string_view key) const {
-  auto it = key_value_map_.find(std::string(key));
+  auto it = key_value_map_.find(key);
   if (it != key_value_map_.end())
     return it->second;
   return "";