summaryrefslogtreecommitdiff
path: root/brillo/syslog_logging_unittest.cc
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2015-10-12 15:21:28 -0700
committerAlex Vakulenko <avakulenko@google.com>2015-10-13 16:10:03 -0700
commit9ed0cab99f18acb3570a35e9408f24355f6b8324 (patch)
tree60e3b4c2822b812b3218489a9a6d835df1e8ca6e /brillo/syslog_logging_unittest.cc
parenteabfe23a51c91a103042793ac2d5c28170994e1f (diff)
downloadlibchromeos-9ed0cab99f18acb3570a35e9408f24355f6b8324.tar.gz
Move chromeos symbols into brillo namespace
And move the include files into "brillo" directory instead of "chromeos" BUG: 24872993 TEST=built aosp and brillo and unit tests pass on dragonoboard Change-Id: Ieb979d1ebd3152921d36cd15acbd6247f02aae69
Diffstat (limited to 'brillo/syslog_logging_unittest.cc')
-rw-r--r--brillo/syslog_logging_unittest.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/brillo/syslog_logging_unittest.cc b/brillo/syslog_logging_unittest.cc
new file mode 100644
index 0000000..e852e50
--- /dev/null
+++ b/brillo/syslog_logging_unittest.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <base/logging.h>
+#include <brillo/syslog_logging.h>
+#include <gtest/gtest.h>
+
+namespace brillo {
+
+class SyslogLoggingDeathTest : public ::testing::Test {
+ public:
+ SyslogLoggingDeathTest() {}
+ virtual ~SyslogLoggingDeathTest() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SyslogLoggingDeathTest);
+};
+
+TEST_F(SyslogLoggingDeathTest, FatalLoggingIsFatal) {
+ int old_flags = GetLogFlags();
+ SetLogFlags(kLogToStderr);
+ EXPECT_DEATH({ LOG(FATAL) << "First Fatality!"; }, "First Fatality!");
+ // No flags == don't log to syslog, stderr, or accumulated string.
+ SetLogFlags(0);
+ // Still a fatal log message
+ EXPECT_DEATH({ LOG(FATAL) << "Second Fatality!"; }, "Second Fatality!");
+ SetLogFlags(old_flags);
+}
+
+} // namespace brillo