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

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

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops commit on wrong branch Created 4 years, 5 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
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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 // EXPECT/ASSERT_DCHECK_DEATH is intended to replace EXPECT/ASSERT_DEBUG_DEATH 17 // EXPECT/ASSERT_DCHECK_DEATH is intended to replace EXPECT/ASSERT_DEBUG_DEATH
18 // when the death is expected to be caused by a DCHECK. Contrary to 18 // when the death is expected to be caused by a DCHECK. Contrary to
19 // EXPECT/ASSERT_DEBUG_DEATH however, it doesn't execute the statement in non- 19 // EXPECT/ASSERT_DEBUG_DEATH however, it doesn't execute the statement in non-
20 // dcheck builds as DCHECKs are intended to catch things that should never 20 // dcheck builds as DCHECKs are intended to catch things that should never
21 // happen and as such executing the statement results in undefined behavior. 21 // happen and as such executing the statement results in undefined behavior
22 // (|statement| is compiled in unsupported configurations nonetheless).
22 // Death tests misbehave on Android. 23 // Death tests misbehave on Android.
23 #if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) 24 #if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID)
24 #define EXPECT_DCHECK_DEATH(statement, regex) EXPECT_DEATH(statement, regex) 25 #define EXPECT_DCHECK_DEATH(statement, regex) EXPECT_DEATH(statement, regex)
25 #define ASSERT_DCHECK_DEATH(statement, regex) ASSERT_DEATH(statement, regex) 26 #define ASSERT_DCHECK_DEATH(statement, regex) ASSERT_DEATH(statement, regex)
26 #else 27 #else
27 #define EXPECT_DCHECK_DEATH(statement, regex) 28 #define EXPECT_DCHECK_DEATH(statement, regex) \
28 #define ASSERT_DCHECK_DEATH(statement, regex) 29 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
30 #define ASSERT_DCHECK_DEATH(statement, regex) \
31 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
29 #endif 32 #endif
30 33
31 namespace base { 34 namespace base {
32 35
33 class FilePath; 36 class FilePath;
34 37
35 struct TestIdentifier { 38 struct TestIdentifier {
36 TestIdentifier(); 39 TestIdentifier();
37 TestIdentifier(const TestIdentifier& other); 40 TestIdentifier(const TestIdentifier& other);
38 41
(...skipping 18 matching lines...) Expand all
57 60
58 // Reads the list of gtest-based tests from |path| into |output|. 61 // Reads the list of gtest-based tests from |path| into |output|.
59 // Returns true on success. 62 // Returns true on success.
60 bool ReadTestNamesFromFile( 63 bool ReadTestNamesFromFile(
61 const FilePath& path, 64 const FilePath& path,
62 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT; 65 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT;
63 66
64 } // namespace base 67 } // namespace base
65 68
66 #endif // BASE_TEST_GTEST_UTIL_H_ 69 #endif // BASE_TEST_GTEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698