OLD | NEW |
1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // guarantees that the following use of failure_reporter is | 96 // guarantees that the following use of failure_reporter is |
97 // thread-safe. We may need to add additional synchronization to | 97 // thread-safe. We may need to add additional synchronization to |
98 // protect failure_reporter if we port Google Mock to other | 98 // protect failure_reporter if we port Google Mock to other |
99 // compilers. | 99 // compilers. |
100 static FailureReporterInterface* const failure_reporter = | 100 static FailureReporterInterface* const failure_reporter = |
101 new GoogleTestFailureReporter(); | 101 new GoogleTestFailureReporter(); |
102 return failure_reporter; | 102 return failure_reporter; |
103 } | 103 } |
104 | 104 |
105 // Protects global resources (stdout in particular) used by Log(). | 105 // Protects global resources (stdout in particular) used by Log(). |
106 static Mutex g_log_mutex(Mutex::NO_CONSTRUCTOR_NEEDED_FOR_STATIC_MUTEX); | 106 static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex); |
107 | 107 |
108 // Returns true iff a log with the given severity is visible according | 108 // Returns true iff a log with the given severity is visible according |
109 // to the --gmock_verbose flag. | 109 // to the --gmock_verbose flag. |
110 bool LogIsVisible(LogSeverity severity) { | 110 bool LogIsVisible(LogSeverity severity) { |
111 if (GMOCK_FLAG(verbose) == kInfoVerbosity) { | 111 if (GMOCK_FLAG(verbose) == kInfoVerbosity) { |
112 // Always show the log if --gmock_verbose=info. | 112 // Always show the log if --gmock_verbose=info. |
113 return true; | 113 return true; |
114 } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) { | 114 } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) { |
115 // Always hide it if --gmock_verbose=error. | 115 // Always hide it if --gmock_verbose=error. |
116 return false; | 116 return false; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 std::cout << "Stack trace:\n" | 165 std::cout << "Stack trace:\n" |
166 << ::testing::internal::GetCurrentOsStackTraceExceptTop( | 166 << ::testing::internal::GetCurrentOsStackTraceExceptTop( |
167 ::testing::UnitTest::GetInstance(), actual_to_skip); | 167 ::testing::UnitTest::GetInstance(), actual_to_skip); |
168 } | 168 } |
169 std::cout << ::std::flush; | 169 std::cout << ::std::flush; |
170 } | 170 } |
171 | 171 |
172 } // namespace internal | 172 } // namespace internal |
173 } // namespace testing | 173 } // namespace testing |
OLD | NEW |