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

Side by Side Diff: base/test/gtest_util.h

Issue 2712823003: Various logging-related cleanups & reformatting. (Closed)
Patch Set: Fix base unit-tests Created 3 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 unified diff | Download patch
« no previous file with comments | « base/syslog_logging.cc ('k') | third_party/WebKit/Source/platform/wtf/AssertionsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef BASE_TEST_GTEST_UTIL_H_ 5 #ifndef BASE_TEST_GTEST_UTIL_H_
6 #define BASE_TEST_GTEST_UTIL_H_ 6 #define BASE_TEST_GTEST_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 20 matching lines...) Expand all
31 #define ASSERT_DCHECK_DEATH(statement) ASSERT_DEATH(statement, "Check failed") 31 #define ASSERT_DCHECK_DEATH(statement) ASSERT_DEATH(statement, "Check failed")
32 32
33 #else 33 #else
34 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) 34 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID)
35 35
36 // Macro copied from gtest-death-test-internal.h as it's (1) internal for now 36 // Macro copied from gtest-death-test-internal.h as it's (1) internal for now
37 // and (2) only defined if !GTEST_HAS_DEATH_TEST which is only a subset of the 37 // and (2) only defined if !GTEST_HAS_DEATH_TEST which is only a subset of the
38 // conditions in which it's needed here. 38 // conditions in which it's needed here.
39 // TODO(gab): Expose macro in upstream gtest repo for consumers like us that 39 // TODO(gab): Expose macro in upstream gtest repo for consumers like us that
40 // want more specific death tests and remove this hack. 40 // want more specific death tests and remove this hack.
41 # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \ 41 #define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
42 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ 42 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
43 if (::testing::internal::AlwaysTrue()) { \ 43 if (::testing::internal::AlwaysTrue()) { \
44 GTEST_LOG_(WARNING) \ 44 GTEST_LOG_(WARNING) \
45 << "Death tests are not supported on this platform.\n" \ 45 << "Death tests are not supported in this configuration.\n" \
46 << "Statement '" #statement "' cannot be verified."; \ 46 << "Statement '" #statement "' cannot be verified."; \
47 } else if (::testing::internal::AlwaysFalse()) { \ 47 } else if (::testing::internal::AlwaysFalse()) { \
48 ::testing::internal::RE::PartialMatch(".*", (regex)); \ 48 ::testing::internal::RE::PartialMatch(".*", (regex)); \
49 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ 49 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
50 terminator; \ 50 terminator; \
51 } else \ 51 } else \
52 ::testing::Message() 52 ::testing::Message()
53 53
54 #define EXPECT_DCHECK_DEATH(statement) \ 54 #define EXPECT_DCHECK_DEATH(statement) \
55 GTEST_UNSUPPORTED_DEATH_TEST(statement, "Check failed", ) 55 GTEST_UNSUPPORTED_DEATH_TEST(statement, "Check failed", )
56 #define ASSERT_DCHECK_DEATH(statement) \ 56 #define ASSERT_DCHECK_DEATH(statement) \
57 GTEST_UNSUPPORTED_DEATH_TEST(statement, "Check failed", return) 57 GTEST_UNSUPPORTED_DEATH_TEST(statement, "Check failed", return)
58 58
59 #endif 59 #endif
60 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) 60 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID)
61 61
62 namespace base { 62 namespace base {
(...skipping 30 matching lines...) Expand all
93 93
94 // Reads the list of gtest-based tests from |path| into |output|. 94 // Reads the list of gtest-based tests from |path| into |output|.
95 // Returns true on success. 95 // Returns true on success.
96 bool ReadTestNamesFromFile( 96 bool ReadTestNamesFromFile(
97 const FilePath& path, 97 const FilePath& path,
98 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT; 98 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT;
99 99
100 } // namespace base 100 } // namespace base
101 101
102 #endif // BASE_TEST_GTEST_UTIL_H_ 102 #endif // BASE_TEST_GTEST_UTIL_H_
OLDNEW
« no previous file with comments | « base/syslog_logging.cc ('k') | third_party/WebKit/Source/platform/wtf/AssertionsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698