Igor Murashkin | eab33fc | 2012-11-06 17:02:54 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef __ANDROID_HAL_CAMERA2_TESTS_EXTENSIONS__ |
| 18 | #define __ANDROID_HAL_CAMERA2_TESTS_EXTENSIONS__ |
| 19 | |
| 20 | #include "TestForkerEventListener.h" |
| 21 | |
| 22 | // Use at the beginning of each Test::SetUp() impl |
| 23 | #define TEST_EXTENSION_FORKING_SET_UP \ |
| 24 | do { \ |
| 25 | if (TEST_EXTENSION_FORKING_ENABLED) { \ |
| 26 | if (!TestForkerEventListener::mIsForked) { \ |
| 27 | return; \ |
| 28 | } \ |
| 29 | } \ |
| 30 | } while (false) \ |
| 31 | |
| 32 | // Use at the beginning of each Test::TearDown() impl |
| 33 | #define TEST_EXTENSION_FORKING_TEAR_DOWN TEST_EXTENSION_FORKING_SET_UP |
| 34 | |
| 35 | // Use at the beginning of each Test::Test constructor |
| 36 | #define TEST_EXTENSION_FORKING_CONSTRUCTOR TEST_EXTENSION_FORKING_SET_UP |
| 37 | |
| 38 | // Use at the beginning of each Test::~Test destructor |
| 39 | #define TEST_EXTENSION_FORKING_DESTRUCTOR TEST_EXTENSION_FORKING_TEAR_DOWN |
| 40 | |
| 41 | // Use at the beginning of each test body, e.g. TEST(x,y), TEST_F(x,y), etc |
| 42 | #define TEST_EXTENSION_FORKING_INIT \ |
| 43 | do { \ |
| 44 | TEST_EXTENSION_FORKING_SET_UP; \ |
| 45 | if (HasFatalFailure()) return; \ |
| 46 | } while(false) \ |
| 47 | |
| 48 | // Are we running each test by forking it? |
| 49 | #define TEST_EXTENSION_FORKING_ENABLED (TestForkerEventListener::mUsingForking) |
| 50 | |
| 51 | |
| 52 | |
| 53 | #endif |
| 54 | |