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/scoped_key_value_config.h b/test/scoped_key_value_config.h
index 0ecbddc..db90ca3 100644
--- a/test/scoped_key_value_config.h
+++ b/test/scoped_key_value_config.h
@@ -11,6 +11,7 @@
 #ifndef TEST_SCOPED_KEY_VALUE_CONFIG_H_
 #define TEST_SCOPED_KEY_VALUE_CONFIG_H_
 
+#include <functional>
 #include <map>
 #include <memory>
 #include <string>
@@ -26,13 +27,13 @@
  public:
   virtual ~ScopedKeyValueConfig();
   ScopedKeyValueConfig();
-  explicit ScopedKeyValueConfig(const std::string& s);
-  ScopedKeyValueConfig(ScopedKeyValueConfig& parent, const std::string& s);
+  explicit ScopedKeyValueConfig(absl::string_view s);
+  ScopedKeyValueConfig(ScopedKeyValueConfig& parent, absl::string_view s);
 
   std::string Lookup(absl::string_view key) const override;
 
  private:
-  ScopedKeyValueConfig(ScopedKeyValueConfig* parent, const std::string& s);
+  ScopedKeyValueConfig(ScopedKeyValueConfig* parent, absl::string_view s);
   ScopedKeyValueConfig* GetRoot(ScopedKeyValueConfig* n);
   std::string LookupRecurse(absl::string_view key) const;
 
@@ -42,7 +43,9 @@
   // Only set on root (e.g with parent_ == nullptr).
   const ScopedKeyValueConfig* leaf_;
 
-  std::map<std::string, std::string> key_value_map_;
+  // Unlike std::less<std::string>, std::less<> is transparent and allows
+  // heterogeneous lookup directly with absl::string_view.
+  std::map<std::string, std::string, std::less<>> key_value_map_;
   std::unique_ptr<ScopedFieldTrials> scoped_field_trials_;
 };