mark a. foltz | d6a5a22 | 2020-07-28 17:28:06 -0700 | [diff] [blame^] | 1 | // Copyright 2020 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 | #ifndef PLATFORM_IMPL_LOGGING_TEST_H_ |
| 6 | #define PLATFORM_IMPL_LOGGING_TEST_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | // These functions should only be called from logging unittests. |
| 12 | |
| 13 | namespace openscreen { |
| 14 | |
| 15 | // Append logging output to |messages|. Each log entry will be written as a new |
| 16 | // element including a newline. Pass nullptr to stop appending output. Calling |
| 17 | // this does not affect the behavior of SetLogFifoOrDie(). Normally this should |
| 18 | // only be called for tests as it creates an append-only buffer of log messages |
| 19 | // in memory. |
| 20 | void SetLogBufferForTest(std::vector<std::string>* messages); |
| 21 | |
| 22 | // Disables the mechanism to abort a process on an assertion failure. |
| 23 | // |
| 24 | // ***DANGEROUS!*** This will effectively disable assertion enforcement and |
| 25 | // should only be called for assertion macro tests. |
| 26 | // |
| 27 | // *break_was_called will be set to true when Break() is called afterwards. |
| 28 | // Calling with nullptr re-enables normal assertion behavior. |
| 29 | void DisableBreakForTest(bool* break_was_called); |
| 30 | |
| 31 | } // namespace openscreen |
| 32 | |
| 33 | #endif // PLATFORM_IMPL_LOGGING_TEST_H_ |