Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Unified Diff: mojo/public/cpp/environment/tests/logger_unittest.cc

Issue 330933004: Mojo: Add basic logging facilities to environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/environment/tests/logger_unittest.cc
diff --git a/mojo/public/cpp/environment/tests/logger_unittest.cc b/mojo/public/cpp/environment/tests/logger_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..305d0c4aa8607390a7a613480dcfc05b95a60be9
--- /dev/null
+++ b/mojo/public/cpp/environment/tests/logger_unittest.cc
@@ -0,0 +1,29 @@
+// Copyright 2014 The Chromium 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 "mojo/public/cpp/environment/default_logger.h"
+#include "mojo/public/cpp/environment/environment.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace {
+
+TEST(LoggerTest, Basic) {
+ Environment environment;
+ const MojoLogger* const logger = GetDefaultLogger();
+
+ logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE-1, "Logged at VERBOSE-1 level");
+ logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, "Logged at VERBOSE level");
+ logger->LogMessage(MOJO_LOG_LEVEL_INFO, "Logged at INFO level");
+ logger->LogMessage(MOJO_LOG_LEVEL_WARNING, "Logged at WARNING level");
+ logger->LogMessage(MOJO_LOG_LEVEL_ERROR, "Logged at ERROR level");
+
+ // This should kill us:
+ EXPECT_DEATH({
+ logger->LogMessage(MOJO_LOG_LEVEL_FATAL, "Logged at FATAL level");
+ }, "");
+}
+
+} // namespace
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698