task_traits_unittest.nc 1.8 KB

12345678910111213141516171819202122232425262728293031
  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/task/task_traits.h"
  7. namespace base {
  8. #if defined(NCTEST_TASK_TRAITS_MULTIPLE_MAY_BLOCK) // [r"The traits bag contains multiple traits of the same type."]
  9. constexpr TaskTraits traits = {MayBlock(), MayBlock()};
  10. #elif defined(NCTEST_TASK_TRAITS_MULTIPLE_WITH_BASE_SYNC_PRIMITIVES) // [r"The traits bag contains multiple traits of the same type."]
  11. constexpr TaskTraits traits = {WithBaseSyncPrimitives(),
  12. WithBaseSyncPrimitives()};
  13. #elif defined(NCTEST_TASK_TRAITS_MULTIPLE_TASK_PRIORITY) // [r"The traits bag contains multiple traits of the same type."]
  14. constexpr TaskTraits traits = {TaskPriority::BEST_EFFORT,
  15. TaskPriority::USER_BLOCKING};
  16. #elif defined(NCTEST_TASK_TRAITS_MULTIPLE_SHUTDOWN_BEHAVIOR) // [r"The traits bag contains multiple traits of the same type."]
  17. constexpr TaskTraits traits = {TaskShutdownBehavior::BLOCK_SHUTDOWN,
  18. TaskShutdownBehavior::BLOCK_SHUTDOWN};
  19. #elif defined(NCTEST_TASK_TRAITS_MULTIPLE_SAME_TYPE_MIX) // [r"The traits bag contains multiple traits of the same type."]
  20. constexpr TaskTraits traits = {TaskShutdownBehavior::BLOCK_SHUTDOWN,
  21. MayBlock(),
  22. TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN};
  23. #elif defined(NCTEST_TASK_TRAITS_INVALID_TYPE) // [r"no matching constructor for initialization of 'const TaskTraits'"]
  24. constexpr TaskTraits traits = {TaskShutdownBehavior::BLOCK_SHUTDOWN, true};
  25. #endif
  26. } // namespace base