blob: 92c117aca15586cfb5582fd5bdbc83f87ca59eef [file] [log] [blame]
Igor Murashkine302ee32012-11-05 11:14:49 -08001/*
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 Murashkineab33fc2012-11-06 17:02:54 -080017#include <stdlib.h>
18
Igor Murashkine302ee32012-11-05 11:14:49 -080019#include <gtest/gtest.h>
Igor Murashkineab33fc2012-11-06 17:02:54 -080020#include "TestForkerEventListener.h"
21
22using android::camera2::tests::TestForkerEventListener;
Igor Murashkine302ee32012-11-05 11:14:49 -080023
24int main(int argc, char **argv) {
25
26 ::testing::InitGoogleTest(&argc, argv);
27
Igor Murashkineab33fc2012-11-06 17:02:54 -080028 {
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 Murashkine302ee32012-11-05 11:14:49 -080044 int ret = RUN_ALL_TESTS();
45
46 return ret;
47}