From ef8695ed8435b10bf9ae5f5e5b22f1d8a4d716d8 Mon Sep 17 00:00:00 2001 From: Sundong Ahn Date: Tue, 30 Jul 2019 20:43:43 +0900 Subject: [PATCH] Check the media.settings.xml property The file name and path of the media profiles can be changed by media.settings.xml property. So befor test, we should check media.settings.xml property. Bug: 138413934 Test: vts-tradefed run vts -m VtsValidateMediaProfiles Change-Id: Ib7070cca94b9d637b9a1a175d09baf7b78ec0fd9 --- media/libmedia/xsd/vts/Android.bp | 1 + media/libmedia/xsd/vts/ValidateMediaProfiles.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/media/libmedia/xsd/vts/Android.bp b/media/libmedia/xsd/vts/Android.bp index b590a12882..4739504ede 100644 --- a/media/libmedia/xsd/vts/Android.bp +++ b/media/libmedia/xsd/vts/Android.bp @@ -24,6 +24,7 @@ cc_test { "libxml2", ], shared_libs: [ + "libbase", "liblog", ], cflags: [ diff --git a/media/libmedia/xsd/vts/ValidateMediaProfiles.cpp b/media/libmedia/xsd/vts/ValidateMediaProfiles.cpp index ff9b0605bf..7729d52fe1 100644 --- a/media/libmedia/xsd/vts/ValidateMediaProfiles.cpp +++ b/media/libmedia/xsd/vts/ValidateMediaProfiles.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +#include + +#include +#include #include "utility/ValidateXml.h" TEST(CheckConfig, mediaProfilesValidation) { @@ -21,8 +25,12 @@ TEST(CheckConfig, mediaProfilesValidation) { "Verify that the media profiles file " "is valid according to the schema"); - const char* location = "/vendor/etc"; + std::string mediaSettingsPath = android::base::GetProperty("media.settings.xml", ""); + if (mediaSettingsPath.empty()) { + mediaSettingsPath.assign("/vendor/etc/media_profiles_V1_0.xml"); + } - EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("media_profiles_V1_0.xml", {location}, + EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(android::base::Basename(mediaSettingsPath).c_str(), + {android::base::Dirname(mediaSettingsPath).c_str()}, "/data/local/tmp/media_profiles.xsd"); }