blob: 5fc1b3d3e4d507b18f1927162d349f4df66c53c7 [file] [log] [blame]
Kevin Rocard19b3e432017-05-24 11:01:34 -07001/*
2 * Copyright (C) 2017 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
Kevin Rocard6dcc7132017-08-21 18:32:49 -070017#include <string>
18#include <unistd.h>
19
Kevin Rocard19b3e432017-05-24 11:01:34 -070020#include "utility/ValidateXml.h"
21
22TEST(CheckConfig, audioPolicyConfigurationValidation) {
Kevin Rocard6dcc7132017-08-21 18:32:49 -070023 const char* configName = "audio_policy_configuration.xml";
24 const char* possibleConfigLocations[] = {"/odm/etc", "/vendor/etc", "/system/etc"};
25 const char* configSchemaPath = "/data/local/tmp/audio_policy_configuration.xsd";
26
27 bool found = false;
28 for (std::string folder : possibleConfigLocations) {
29 const auto configPath = folder + '/' + configName;
30 if (access(configPath.c_str(), R_OK) == 0) {
31 ASSERT_FALSE(found) << "Multiple " << configName << " found in "
32 << ::testing::PrintToString(possibleConfigLocations);
33 found = true;
34 ASSERT_VALID_XML(configPath.c_str(), configSchemaPath);
35 }
36 }
Kevin Rocard19b3e432017-05-24 11:01:34 -070037}