1// Copyright 2018 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/task/task_traits.h"
9
10#include "base/task/test_task_traits_extension.h"
11
12namespace base {
13
14#if defined(NCTEST_TASK_TRAITS_EXTENSION_MULTIPLE_BASE_TRAITS)  // [r"The traits bag contains multiple traits of the same type."]
15constexpr TaskTraits traits = {MayBlock(), MayBlock()};
16#elif defined(NCTEST_TASK_TRAITS_EXTENSION_MULTIPLE_EXTENSION_TRAITS)  // [r"The traits bag contains multiple traits of the same type."]
17constexpr TaskTraits traits = {TestExtensionEnumTrait::kB, TestExtensionEnumTrait::kC};
18#elif defined(NCTEST_TASK_TRAITS_EXTENSION_INVALID_TYPE)  // [r"no matching constructor for initialization of 'const base::TaskTraits'"]
19constexpr TaskTraits traits = {TestExtensionEnumTrait::kB, 123};
20#elif defined(NCTEST_TASK_TRAITS_EXTENSION_TOO_MUCH_DATA_FOR_STORAGE)  // [r"no matching constructor for initialization of 'base::TaskTraitsExtensionStorage'"]
21constexpr TaskTraitsExtensionStorage TestSerializeTaskTraitsWithTooMuchData() {
22  constexpr std::array<uint8_t, TaskTraitsExtensionStorage::kStorageSize + 1>
23      data = {};
24  return {TaskTraitsExtensionStorage::kFirstEmbedderExtensionId, data};
25}
26#endif
27
28}  // namespace base
29