Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: base/metrics/field_trial_params_unittest.nc

Issue 2804633003: Add base::FeatureParam<> struct (Closed)
Patch Set: Remove constexpr for Windows Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/field_trial_params_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial_params_unittest.nc
diff --git a/base/metrics/field_trial_params_unittest.nc b/base/metrics/field_trial_params_unittest.nc
new file mode 100644
index 0000000000000000000000000000000000000000..4c6005e34db4f4622d5c96722a4c598337969dee
--- /dev/null
+++ b/base/metrics/field_trial_params_unittest.nc
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a "No Compile Test" suite.
+// http://dev.chromium.org/developers/testing/no-compile-tests
+
+#include "base/feature_list.h"
+#include "base/metrics/field_trial_params.h"
+
+constexpr base::Feature kFeature{"NoCompileFeature"};
+
+enum Param { FOO, BAR };
+
+#if defined(NCTEST_NO_PARAM_TYPE) // [r"too few template arguments"]
+
+constexpr base::FeatureParam<> kParam{
+ &kFeature, "Param"};
+
+#elif defined(NCTEST_VOID_PARAM_TYPE) // [r"unsupported FeatureParam<> type"]
+
+constexpr base::FeatureParam<void> kParam{
+ &kFeature, "Param"};
+
+#elif defined(NCTEST_INVALID_PARAM_TYPE) // [r"unsupported FeatureParam<> type"]
+
+constexpr base::FeatureParam<size_t> kParam{
+ &kFeature, "Param", 1u};
+
+#elif defined(NCTEST_ENUM_NULL_OPTIONS) // [r"candidate template ignored: could not match"]
+
+constexpr base::FeatureParam<Param> kParam{
+ &kFeature, "Param", FOO, nullptr};
+
+#elif defined(NCTEST_ENUM_EMPTY_OPTIONS) // [r"zero-length arrays are not permitted"]
+
+constexpr base::FeatureParam<Param>::Option kParamOptions[] = {};
+constexpr base::FeatureParam<Param> kParam{
+ &kFeature, "Param", FOO, &kParamOptions};
+
+#else
+
+void suppress_unused_variable_warning() {
+ (void)kFeature;
+}
+
+#endif
« no previous file with comments | « base/metrics/field_trial_params_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698