| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 2019 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 |  | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 17 | #include <android-base/file.h> | 
| Yifan Hong | 28a44eb | 2019-03-04 15:22:37 -0800 | [diff] [blame] | 18 | #include <gtest/gtest.h> | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 19 | #include <jsonpb/json_schema_test.h> | 
 | 20 |  | 
| Yifan Hong | 28a44eb | 2019-03-04 15:22:37 -0800 | [diff] [blame] | 21 | #include "cgroups_test.h" | 
 | 22 | #include "task_profiles_test.h" | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 23 |  | 
 | 24 | using namespace ::android::jsonpb; | 
 | 25 | using ::android::base::GetExecutableDirectory; | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 26 |  | 
 | 27 | namespace android { | 
 | 28 | namespace profiles { | 
 | 29 |  | 
 | 30 | template <typename T> | 
 | 31 | JsonSchemaTestConfigFactory MakeTestParam(const std::string& path) { | 
 | 32 |     return jsonpb::MakeTestParam<T>(GetExecutableDirectory() + path); | 
 | 33 | } | 
 | 34 |  | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 35 | // Test suite instantiations | 
| Haibo Huang | cf8a5b0 | 2019-11-08 12:15:11 -0800 | [diff] [blame] | 36 | INSTANTIATE_TEST_SUITE_P(Cgroups, JsonSchemaTest, | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 37 |                          ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"), | 
 | 38 |                                            MakeTestParam<Cgroups>("/cgroups.recovery.json"), | 
 | 39 |                                            MakeTestParam<TaskProfiles>("/task_profiles.json"))); | 
| Haibo Huang | cf8a5b0 | 2019-11-08 12:15:11 -0800 | [diff] [blame] | 40 | INSTANTIATE_TEST_SUITE_P(Cgroups, CgroupsTest, | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 41 |                          ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"), | 
 | 42 |                                            MakeTestParam<Cgroups>("/cgroups.recovery.json"))); | 
| Haibo Huang | cf8a5b0 | 2019-11-08 12:15:11 -0800 | [diff] [blame] | 43 | INSTANTIATE_TEST_SUITE_P(TaskProfiles, TaskProfilesTest, | 
| Yifan Hong | 72ff585 | 2019-02-13 14:32:34 -0800 | [diff] [blame] | 44 |                          ::testing::Values(MakeTestParam<TaskProfiles>("/task_profiles.json"))); | 
 | 45 |  | 
 | 46 | }  // namespace profiles | 
 | 47 | }  // namespace android | 
 | 48 |  | 
 | 49 | int main(int argc, char** argv) { | 
 | 50 |     ::testing::InitGoogleTest(&argc, argv); | 
 | 51 |     return RUN_ALL_TESTS(); | 
 | 52 | } |