OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/public/cpp/environment/environment.h" | 10 #include "mojo/public/cpp/environment/environment.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 *was_called = true; | 28 *was_called = true; |
29 return false; | 29 return false; |
30 } | 30 } |
31 | 31 |
32 class LoggingTest : public testing::Test { | 32 class LoggingTest : public testing::Test { |
33 public: | 33 public: |
34 LoggingTest() : environment_(nullptr, &kMockLogger) { | 34 LoggingTest() : environment_(nullptr, &kMockLogger) { |
35 minimum_log_level_ = MOJO_LOG_LEVEL_INFO; | 35 minimum_log_level_ = MOJO_LOG_LEVEL_INFO; |
36 ResetMockLogger(); | 36 ResetMockLogger(); |
37 } | 37 } |
38 virtual ~LoggingTest() {} | 38 ~LoggingTest() override {} |
39 | 39 |
40 protected: | 40 protected: |
41 // Note: Does not reset |minimum_log_level_|. | 41 // Note: Does not reset |minimum_log_level_|. |
42 static void ResetMockLogger() { | 42 static void ResetMockLogger() { |
43 log_message_was_called_ = false; | 43 log_message_was_called_ = false; |
44 last_log_level_ = MOJO_LOG_LEVEL_INFO; | 44 last_log_level_ = MOJO_LOG_LEVEL_INFO; |
45 last_message_.clear(); | 45 last_message_.clear(); |
46 } | 46 } |
47 | 47 |
48 // A function returning |bool| that shouldn't be called. | 48 // A function returning |bool| that shouldn't be called. |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 ResetMockLogger(); | 470 ResetMockLogger(); |
471 | 471 |
472 // Also try to make sure that we parenthesize the condition properly. | 472 // Also try to make sure that we parenthesize the condition properly. |
473 bool x = true; | 473 bool x = true; |
474 MOJO_DCHECK(false || x) << "hello"; | 474 MOJO_DCHECK(false || x) << "hello"; |
475 EXPECT_FALSE(log_message_was_called()); | 475 EXPECT_FALSE(log_message_was_called()); |
476 } | 476 } |
477 | 477 |
478 } // namespace | 478 } // namespace |
479 } // namespace mojo | 479 } // namespace mojo |
OLD | NEW |