Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3132d6ea authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4916303 from 8e920568 to pi-qpr1-release

Change-Id: Ie9e75d44456f3694910c67123d579d8c0d2b9bc9
parents 8f7677d1 8e920568
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -45,29 +45,37 @@ namespace utility {
                        xmlFilePath, xsdFilePath)

/** Validate an XML according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 * All file named xmlFileName in each xmlFileLocations folder must be valid if present.
 * @tparam atLeastOneRequired If true, at least one file has to be found.
 *                           If false, no found file is a success.
 */
template <bool atLeastOneRequired = true>
::testing::AssertionResult validateXmlMultipleLocations(
    const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
    const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath);

/** ASSERT that an XML is valid according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 */
/** ASSERT that all found XML are valid according to an xsd. */
#define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)         \
    ASSERT_PRED_FORMAT3(                                                                        \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** EXPECT that all found XML are valid according to an xsd. */
#define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)         \
    EXPECT_PRED_FORMAT3(                                                                        \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** ASSERT that all found XML are valid according to an xsd. At least one must be found. */
#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)    \
    ASSERT_PRED_FORMAT3(                                                                       \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations,    \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

/** EXPECT an XML to be valid according to an xsd.
 * The XML file must be in at least one of the provided locations.
 * If multiple are found, all are validated.
 */
/** EXPECT that all found XML are valid according to an xsd. At least one must be found. */
#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath)    \
    EXPECT_PRED_FORMAT3(                                                                       \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations,    \
        ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
        xmlFileName, xmlFileLocations, xsdFilePath)

}  // namespace utility
+14 −2
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct Libxml2Global {
    return ::testing::AssertionSuccess();
}

template <bool atLeastOneRequired>
::testing::AssertionResult validateXmlMultipleLocations(
    const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
    const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) {
@@ -150,7 +151,7 @@ struct Libxml2Global {
        }
    }

    if (foundFiles.empty()) {
    if (atLeastOneRequired && foundFiles.empty()) {
        errors.push_back("No xml file found in provided locations.\n");
    }

@@ -160,8 +161,19 @@ struct Libxml2Global {
           << "     While validating all: " << xmlFileNameExpr
           << "\n                 Which is: " << xmlFileName
           << "\n In the following folders: " << xmlFileLocationsExpr
           << "\n                 Which is: " << ::testing::PrintToString(xmlFileLocations);
}
           << "\n                 Which is: " << ::testing::PrintToString(xmlFileLocations)
           << (atLeastOneRequired ? "Where at least one file must be found."
                                  : "Where no file might exist.");
}

template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*,
                                                                       const char*, const char*,
                                                                       std::vector<const char*>,
                                                                       const char*);
template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*,
                                                                        const char*, const char*,
                                                                        std::vector<const char*>,
                                                                        const char*);

}  // namespace utility
}  // namespace test
+2 −2
Original line number Diff line number Diff line
@@ -27,6 +27,6 @@ TEST(CheckConfig, audioEffectsConfigurationValidation) {
    using namespace android::effectsConfig;

    std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS));
    EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
    EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
                                        "/data/local/tmp/audio_effects_conf_V2_0.xsd");
}
+1 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@
      <xs:field xpath="@library"/>
    </xs:keyref>
    <xs:key name="effectName">
      <xs:selector xpath="aec:effects/aec:effect"/>
      <xs:selector xpath="aec:effects/aec:effect|aec:effects/aec:effectProxy"/>
      <xs:field xpath="@name"/>
    </xs:key>
    <xs:keyref name="effectNamePreRef" refer="aec:effectName">
+11 −5
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ using ::android::hardware::camera::device::V3_2::ICameraDevice;
using ::android::hardware::camera::device::V3_2::BufferCache;
using ::android::hardware::camera::device::V3_2::CaptureRequest;
using ::android::hardware::camera::device::V3_2::CaptureResult;
using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback;
using ::android::hardware::camera::device::V3_2::ICameraDeviceSession;
using ::android::hardware::camera::device::V3_2::NotifyMsg;
using ::android::hardware::camera::device::V3_2::RequestTemplate;
@@ -532,7 +531,7 @@ public:

 hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);

 struct EmptyDeviceCb : public ICameraDeviceCallback {
 struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback {
     virtual Return<void> processCaptureResult(
         const hidl_vec<CaptureResult>& /*results*/) override {
         ALOGI("processCaptureResult callback");
@@ -540,6 +539,13 @@ public:
         return Void();
     }

     virtual Return<void> processCaptureResult_3_4(
         const hidl_vec<V3_4::CaptureResult>& /*results*/) override {
         ALOGI("processCaptureResult_3_4 callback");
         ADD_FAILURE();  // Empty callback should not reach here
         return Void();
     }

     virtual Return<void> notify(const hidl_vec<NotifyMsg>& /*msgs*/) override {
         ALOGI("notify callback");
         ADD_FAILURE();  // Empty callback should not reach here
@@ -4040,12 +4046,12 @@ TEST_F(CameraHidlTest, flushPreviewRequest) {
                               << static_cast<uint32_t>(inflightReq.errorCode);
                }
            }
        }

        ret = session->close();
        ASSERT_TRUE(ret.isOk());
    }
}
}

// Verify that camera flushes correctly without any pending requests.
TEST_F(CameraHidlTest, flushEmpty) {
Loading