Home | History | Annotate | Download | only in metrics
      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 
      5 // This is a "No Compile Test" suite.
      6 // http://dev.chromium.org/developers/testing/no-compile-tests
      7 
      8 #include "base/feature_list.h"
      9 #include "base/metrics/field_trial_params.h"
     10 
     11 constexpr base::Feature kFeature{"NoCompileFeature"};
     12 
     13 enum Param { FOO, BAR };
     14 
     15 #if defined(NCTEST_NO_PARAM_TYPE)  // [r"too few template arguments"]
     16 
     17 constexpr base::FeatureParam<> kParam{
     18   &kFeature, "Param"};
     19 
     20 #elif defined(NCTEST_VOID_PARAM_TYPE)  // [r"unsupported FeatureParam<> type"]
     21 
     22 constexpr base::FeatureParam<void> kParam{
     23   &kFeature, "Param"};
     24 
     25 #elif defined(NCTEST_INVALID_PARAM_TYPE)  // [r"unsupported FeatureParam<> type"]
     26 
     27 constexpr base::FeatureParam<size_t> kParam{
     28   &kFeature, "Param", 1u};
     29 
     30 #elif defined(NCTEST_ENUM_NULL_OPTIONS)  // [r"candidate template ignored: could not match"]
     31 
     32 constexpr base::FeatureParam<Param> kParam{
     33   &kFeature, "Param", FOO, nullptr};
     34 
     35 #elif defined(NCTEST_ENUM_EMPTY_OPTIONS)  // [r"zero-length arrays are not permitted"]
     36 
     37 constexpr base::FeatureParam<Param>::Option kParamOptions[] = {};
     38 constexpr base::FeatureParam<Param> kParam{
     39   &kFeature, "Param", FOO, &kParamOptions};
     40 
     41 #else
     42 
     43 void suppress_unused_variable_warning() {
     44     (void)kFeature;
     45 }
     46 
     47 #endif
     48