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

Side by Side Diff: mojo/public/cpp/environment/tests/logger_unittest.cc

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "mojo/public/c/environment/logger.h"
6 #include "mojo/public/cpp/environment/environment.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace mojo {
10 namespace {
11
12 TEST(LoggerTest, Basic) {
13 Environment environment;
14 const MojoLogger* const logger = Environment::GetDefaultLogger();
15
16 logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, "Logged at VERBOSE-1 level");
17 logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, "Logged at VERBOSE level");
18 logger->LogMessage(MOJO_LOG_LEVEL_INFO, "Logged at INFO level");
19 logger->LogMessage(MOJO_LOG_LEVEL_WARNING, "Logged at WARNING level");
20 logger->LogMessage(MOJO_LOG_LEVEL_ERROR, "Logged at ERROR level");
21
22 // This should kill us:
23 EXPECT_DEATH_IF_SUPPORTED(
24 { logger->LogMessage(MOJO_LOG_LEVEL_FATAL, "Logged at FATAL level"); },
25 "");
26 }
27
28 TEST(LoggerTest, LogLevels) {
29 Environment environment;
30 const MojoLogger* const logger = Environment::GetDefaultLogger();
31
32 for (MojoLogLevel log_level = MOJO_LOG_LEVEL_VERBOSE - 1;
33 log_level <= MOJO_LOG_LEVEL_FATAL + 1;
34 log_level++) {
35 logger->SetMinimumLogLevel(log_level);
36
37 if (log_level <= MOJO_LOG_LEVEL_FATAL)
38 EXPECT_EQ(log_level, logger->GetMinimumLogLevel());
39 else
40 EXPECT_EQ(MOJO_LOG_LEVEL_FATAL, logger->GetMinimumLogLevel());
41
42 logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE - 1, "Logged at VERBOSE-1 level");
43 logger->LogMessage(MOJO_LOG_LEVEL_VERBOSE, "Logged at VERBOSE level");
44 logger->LogMessage(MOJO_LOG_LEVEL_INFO, "Logged at INFO level");
45 logger->LogMessage(MOJO_LOG_LEVEL_WARNING, "Logged at WARNING level");
46 logger->LogMessage(MOJO_LOG_LEVEL_ERROR, "Logged at ERROR level");
47
48 // This should kill us:
49 EXPECT_DEATH_IF_SUPPORTED(
50 { logger->LogMessage(MOJO_LOG_LEVEL_FATAL, "Logged at FATAL level"); },
51 "");
52 }
53 }
54
55 } // namespace
56 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/environment/tests/async_waiter_unittest.cc ('k') | mojo/public/cpp/environment/tests/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698