Avi Drissman | e4622aa | 2022-09-08 20:36:06 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
Roland Bock | d662a2d | 2022-07-12 20:55:27 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/check_is_test.h" |
| 6 | |
Cliff Smolinsky | fed5d5a5 | 2025-03-24 18:03:26 | [diff] [blame] | 7 | #include "base/base_export.h" |
Roland Bock | d662a2d | 2022-07-12 20:55:27 | [diff] [blame] | 8 | |
| 9 | namespace { |
| 10 | bool g_this_is_a_test = false; |
| 11 | } |
| 12 | |
| 13 | namespace base::internal { |
Peter Boström | 39497a60 | 2024-11-19 22:20:24 | [diff] [blame] | 14 | bool get_is_test_impl() { |
Daniel Murphy | 5fa7a319 | 2024-04-17 23:08:43 | [diff] [blame] | 15 | return g_this_is_a_test; |
| 16 | } |
Roland Bock | d662a2d | 2022-07-12 20:55:27 | [diff] [blame] | 17 | } // namespace base::internal |
| 18 | |
| 19 | namespace base::test { |
Roland Bock | 3c0853f | 2022-10-23 01:23:01 | [diff] [blame] | 20 | // base/test/allow_check_is_test_for_testing.h declares |
| 21 | // `AllowCheckIsTestForTesting`, but is only allowed to be included in test |
| 22 | // code. We therefore have to also mark the symbol as exported here. |
| 23 | BASE_EXPORT void AllowCheckIsTestForTesting() { |
Roland Bock | d662a2d | 2022-07-12 20:55:27 | [diff] [blame] | 24 | g_this_is_a_test = true; |
| 25 | } |
Roland Bock | d662a2d | 2022-07-12 20:55:27 | [diff] [blame] | 26 | } // namespace base::test |