Eric Caruso | ea9f10e | 2019-05-01 09:52:01 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS 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 | #define G_LOG_USE_STRUCTURED |
| 6 | #include <glib.h> |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <gtest/gtest.h> |
| 13 | |
| 14 | #include "glib-bridge/glib_logger.h" |
| 15 | |
| 16 | namespace glib_bridge { |
| 17 | |
| 18 | extern uint64_t g_num_logs; |
| 19 | |
| 20 | class GlibStructuredLoggerTest : public ::testing::Test { |
| 21 | public: |
| 22 | GlibStructuredLoggerTest() { |
| 23 | g_num_logs = 0; |
| 24 | ForwardLogs(); |
| 25 | } |
| 26 | ~GlibStructuredLoggerTest() override = default; |
| 27 | }; |
| 28 | |
| 29 | TEST_F(GlibStructuredLoggerTest, TestLogging) { |
| 30 | g_message("foo"); |
| 31 | EXPECT_EQ(g_num_logs, 1); |
| 32 | } |
| 33 | |
| 34 | } // namespace glib_bridge |