flags_test_helpers.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_FLAGS_UI_FLAGS_TEST_HELPERS_H_
  5. #define COMPONENTS_FLAGS_UI_FLAGS_TEST_HELPERS_H_
  6. #include "base/containers/span.h"
  7. #include "components/flags_ui/feature_entry.h"
  8. namespace flags_ui {
  9. namespace testing {
  10. // Ensures that all flags in |entries| has associated metadata. |count| is the
  11. // number of flags in |entries|.
  12. void EnsureEveryFlagHasMetadata(
  13. const base::span<const flags_ui::FeatureEntry>& entries);
  14. // Ensures that all flags marked as never expiring in flag-metadata.json is
  15. // listed in flag-never-expire-list.json.
  16. void EnsureOnlyPermittedFlagsNeverExpire();
  17. // Ensures that every flag has an owner.
  18. void EnsureEveryFlagHasNonEmptyOwners();
  19. // Ensures that owners conform to rules in flag-metadata.json.
  20. void EnsureOwnersLookValid();
  21. // Ensures that flags are listed in alphabetical order in flag-metadata.json and
  22. // flag-never-expire-list.json.
  23. void EnsureFlagsAreListedInAlphabeticalOrder();
  24. // Ensures that unexpire flags are present for the most recent two milestones,
  25. // in accordance with the policy in //docs/flag_expiry.md.
  26. void EnsureRecentUnexpireFlagsArePresent(
  27. const base::span<const FeatureEntry>& entries,
  28. int current_milestone);
  29. } // namespace testing
  30. } // namespace flags_ui
  31. #endif // COMPONENTS_FLAGS_UI_FLAGS_TEST_HELPERS_H_