Igor Murashkin | e302ee3 | 2012-11-05 11:14:49 -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 | |
Igor Murashkin | eab33fc | 2012-11-06 17:02:54 -0800 | [diff] [blame^] | 17 | #include <stdlib.h> |
| 18 | |
Igor Murashkin | e302ee3 | 2012-11-05 11:14:49 -0800 | [diff] [blame] | 19 | #include <gtest/gtest.h> |
Igor Murashkin | eab33fc | 2012-11-06 17:02:54 -0800 | [diff] [blame^] | 20 | #include "TestForkerEventListener.h" |
| 21 | |
| 22 | using android::camera2::tests::TestForkerEventListener; |
Igor Murashkin | e302ee3 | 2012-11-05 11:14:49 -0800 | [diff] [blame] | 23 | |
| 24 | int main(int argc, char **argv) { |
| 25 | |
| 26 | ::testing::InitGoogleTest(&argc, argv); |
| 27 | |
Igor Murashkin | eab33fc | 2012-11-06 17:02:54 -0800 | [diff] [blame^] | 28 | { |
| 29 | //TODO: have a command line flag as well |
| 30 | char *env = getenv("CAMERA2_TEST_FORKING_DISABLED"); |
| 31 | if (env) { |
| 32 | int forking = atoi(env); |
| 33 | |
| 34 | TestForkerEventListener::SetForking(!forking); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // Gets hold of the event listener list. |
| 39 | ::testing::TestEventListeners& listeners = |
| 40 | ::testing::UnitTest::GetInstance()->listeners(); |
| 41 | // Adds a listener to the end. Google Test takes the ownership. |
| 42 | listeners.Append(new TestForkerEventListener()); |
| 43 | |
Igor Murashkin | e302ee3 | 2012-11-05 11:14:49 -0800 | [diff] [blame] | 44 | int ret = RUN_ALL_TESTS(); |
| 45 | |
| 46 | return ret; |
| 47 | } |