xref: /aosp_15_r20/external/webrtc/test/explicit_key_value_config.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef TEST_EXPLICIT_KEY_VALUE_CONFIG_H_
12 #define TEST_EXPLICIT_KEY_VALUE_CONFIG_H_
13 
14 #include <functional>
15 #include <map>
16 #include <string>
17 
18 #include "absl/strings/string_view.h"
19 #include "api/field_trials_registry.h"
20 
21 namespace webrtc {
22 namespace test {
23 
24 class ExplicitKeyValueConfig : public FieldTrialsRegistry {
25  public:
26   explicit ExplicitKeyValueConfig(absl::string_view s);
27 
28  private:
29   std::string GetValue(absl::string_view key) const override;
30 
31   // Unlike std::less<std::string>, std::less<> is transparent and allows
32   // heterogeneous lookup directly with absl::string_view.
33   std::map<std::string, std::string, std::less<>> key_value_map_;
34 };
35 
36 }  // namespace test
37 }  // namespace webrtc
38 
39 #endif  // TEST_EXPLICIT_KEY_VALUE_CONFIG_H_
40