• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TEST_METRICS_ACTION_SUFFIX_READER_H_
6 #define BASE_TEST_METRICS_ACTION_SUFFIX_READER_H_
7 
8 #include <map>
9 #include <string>
10 #include <variant>
11 #include <vector>
12 
13 namespace base {
14 
15 using ActionSuffixEntryMap = std::map<std::string, std::string>;
16 
17 // Find and read the suffixes list(s) which apply to the given `affected_action`
18 // in actions.xml.
19 //
20 // Useful for when you want to verify that the set of suffixes associated with
21 // a particular action contains expected values. For example,
22 // BrowserUserEducationServiceTest.CheckFeaturePromoActions verifies that for
23 // every registered Chrome Desktop in-product-help experience, there is a
24 // corresponding suffix for recording UserEducation.MessageAction* actions. This
25 // prevents someone from adding an IPH experience without adding the
26 // corresponding action entry.
27 //
28 // Returns a list of maps, each of which corresponds to one list of suffixes
29 // associated with the action (an `<affected-action>` could theoretically show
30 // up in more than one `<action-suffix>` block.)
31 //
32 // If no suffix list is found, returns an empty list. May generate test errors
33 // on malformed/duplicate entries even if valid suffixes are found.
34 extern std::vector<ActionSuffixEntryMap> ReadActionSuffixesForAction(
35     const std::string& affected_action);
36 
37 }  // namespace base
38 
39 #endif  // BASE_TEST_METRICS_ACTION_SUFFIX_READER_H_
40