field_trial_params_unittest.nc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 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. // This is a "No Compile Test" suite.
  5. // http://dev.chromium.org/developers/testing/no-compile-tests
  6. #include "base/feature_list.h"
  7. #include "base/metrics/field_trial_params.h"
  8. [[maybe_unused]] constexpr base::Feature kFeature{
  9. "NoCompileFeature", base::FEATURE_DISABLED_BY_DEFAULT};
  10. enum Param { FOO, BAR };
  11. #if defined(NCTEST_NO_PARAM_TYPE) // [r"too few template arguments"]
  12. constexpr base::FeatureParam<> kParam{
  13. &kFeature, "Param"};
  14. #elif defined(NCTEST_VOID_PARAM_TYPE) // [r"unsupported FeatureParam<> type"]
  15. constexpr base::FeatureParam<void> kParam{
  16. &kFeature, "Param"};
  17. #elif defined(NCTEST_INVALID_PARAM_TYPE) // [r"unsupported FeatureParam<> type"]
  18. constexpr base::FeatureParam<size_t> kParam{
  19. &kFeature, "Param", 1u};
  20. #elif defined(NCTEST_ENUM_NULL_OPTIONS) // [r"candidate template ignored: could not match"]
  21. constexpr base::FeatureParam<Param> kParam{
  22. &kFeature, "Param", FOO, nullptr};
  23. #elif defined(NCTEST_ENUM_EMPTY_OPTIONS) // [r"zero-length arrays are not permitted"]
  24. constexpr base::FeatureParam<Param>::Option kParamOptions[] = {};
  25. constexpr base::FeatureParam<Param> kParam{
  26. &kFeature, "Param", FOO, &kParamOptions};
  27. #endif