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

Side by Side Diff: sandbox/linux/tests/unit_tests.h

Issue 11639038: ucontext_t support for Android x86. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ucontext_t support for Android x86 Created 7 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
« no previous file with comments | « sandbox/linux/services/ucontext_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 SANDBOX_LINUX_TESTS_UNIT_TESTS_H__ 5 #ifndef SANDBOX_LINUX_TESTS_UNIT_TESTS_H__
6 #define SANDBOX_LINUX_TESTS_UNIT_TESTS_H__ 6 #define SANDBOX_LINUX_TESTS_UNIT_TESTS_H__
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace sandbox { 11 namespace sandbox {
12 12
13 // While it is perfectly OK for a complex test to provide its own DeathCheck 13 // While it is perfectly OK for a complex test to provide its own DeathCheck
14 // function. Most death tests have very simple requirements. These tests should 14 // function. Most death tests have very simple requirements. These tests should
15 // use one of the predefined DEATH_XXX macros as an argument to 15 // use one of the predefined DEATH_XXX macros as an argument to
16 // SANDBOX_DEATH_TEST(). You can check for a (sub-)string in the output of the 16 // SANDBOX_DEATH_TEST(). You can check for a (sub-)string in the output of the
17 // test, for a particular exit code, or for a particular death signal. 17 // test, for a particular exit code, or for a particular death signal.
18 // NOTE: If you do decide to write your own DeathCheck, make sure to use 18 // NOTE: If you do decide to write your own DeathCheck, make sure to use
19 // gtests's ASSERT_XXX() macros instead of SANDBOX_ASSERT(). See 19 // gtests's ASSERT_XXX() macros instead of SANDBOX_ASSERT(). See
20 // unit_tests.cc for examples. 20 // unit_tests.cc for examples.
21 #define DEATH_SUCCESS() sandbox::UnitTests::DeathSuccess, NULL 21 #define DEATH_SUCCESS() sandbox::UnitTests::DeathSuccess, NULL
22 #define DEATH_MESSAGE(msg) sandbox::UnitTests::DeathMessage, \ 22 #define DEATH_MESSAGE(msg) sandbox::UnitTests::DeathMessage, \
23 static_cast<const void *>( \ 23 static_cast<const void *>( \
24 static_cast<const char *>(msg)) 24 static_cast<const char *>(msg))
25 #define DEATH_EXIT_CODE(rc) sandbox::UnitTests::DeathExitCode, \ 25 #define DEATH_EXIT_CODE(rc) sandbox::UnitTests::DeathExitCode, \
26 reinterpret_cast<void *>(static_cast<intptr_t>(rc)) 26 reinterpret_cast<void *>(static_cast<intptr_t>(rc))
27 #define DEATH_BY_SIGNAL(s) sandbox::UnitTests::DeathExitCode, \ 27 #define DEATH_BY_SIGNAL(s) sandbox::UnitTests::DeathBySignal, \
28 reinterpret_cast<void *>(static_cast<intptr_t>(s)) 28 reinterpret_cast<void *>(static_cast<intptr_t>(s))
29 29
30 // A SANDBOX_DEATH_TEST is just like a SANDBOX_TEST (see below), but it assumes 30 // A SANDBOX_DEATH_TEST is just like a SANDBOX_TEST (see below), but it assumes
31 // that the test actually dies. The death test only passes if the death occurs 31 // that the test actually dies. The death test only passes if the death occurs
32 // in the expected fashion, as specified by "death" and "death_aux". These two 32 // in the expected fashion, as specified by "death" and "death_aux". These two
33 // parameters are typically set to one of the DEATH_XXX() macros. 33 // parameters are typically set to one of the DEATH_XXX() macros.
34 #define SANDBOX_DEATH_TEST(test_case_name, test_name, death) \ 34 #define SANDBOX_DEATH_TEST(test_case_name, test_name, death) \
35 void TEST_##test_name(void *); \ 35 void TEST_##test_name(void *); \
36 TEST(test_case_name, test_name) { \ 36 TEST(test_case_name, test_name) { \
37 sandbox::UnitTests::RunTestInProcess(TEST_##test_name, NULL, death); \ 37 sandbox::UnitTests::RunTestInProcess(TEST_##test_name, NULL, death); \
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 static void DeathBySignal(int status, const std::string& msg, 107 static void DeathBySignal(int status, const std::string& msg,
108 const void *aux); 108 const void *aux);
109 109
110 private: 110 private:
111 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests);
112 }; 112 };
113 113
114 } // namespace 114 } // namespace
115 115
116 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H__ 116 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H__
OLDNEW
« no previous file with comments | « sandbox/linux/services/ucontext_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698