blob: ec3259a1e372361e0820045c8e18f7fe645b08ab [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
Kevin Rocard6dcc7132017-08-21 18:32:49 -070027 for (std::string folder : possibleConfigLocations) {
28 const auto configPath = folder + '/' + configName;
29 if (access(configPath.c_str(), R_OK) == 0) {
Kevin Rocard6dcc7132017-08-21 18:32:49 -070030 ASSERT_VALID_XML(configPath.c_str(), configSchemaPath);
Kevin Rocardff7dcd72017-09-13 18:11:14 -070031 return; // The framework does not read past the first config file found
Kevin Rocard6dcc7132017-08-21 18:32:49 -070032 }
33 }
Kevin Rocard19b3e432017-05-24 11:01:34 -070034}