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

Commit 460be586 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "upstream-vts-v6"

* changes:
  audio: Run VTS tests for streams of non-primary modules for HAL V6
  audio: Run VTS tests for non-primary modules for HAL V6
  audio: Parametrize core VTS tests
  audio: Parametrize effect VTS tests for V6.0
parents ea49733b 60bd3ecc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -260,7 +260,8 @@ interface IDevice {
    /**
     * Returns an array with available microphones in device.
     *
     * @return retval INVALID_STATE if the call is not successful,
     * @return retval NOT_SUPPORTED if there are no microphones on this device
     *                INVALID_STATE if the call is not successful,
     *                OK otherwise.
     *
     * @return microphones array with microphones info
+3 −1
Original line number Diff line number Diff line
@@ -123,9 +123,11 @@ interface IStream {
     * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_FORMATS on the legacy
     * HAL.
     *
     * @return retval operation completion status.
     * @return formats supported audio formats.
     *                 Must be non empty if retval is OK.
     */
    getSupportedFormats() generates (vec<AudioFormat> formats);
    getSupportedFormats() generates (Result retval, vec<AudioFormat> formats);

    /**
     * Sets the audio format of the stream. Calling this method is equivalent to
+6 −7
Original line number Diff line number Diff line
@@ -20,9 +20,6 @@
#include <functional>
#include <list>

#include <VtsHalHidlTargetTestEnvBase.h>
#include <gtest/gtest.h>

namespace android {
namespace hardware {
namespace audio {
@@ -34,18 +31,20 @@ namespace utility {
 * Avoid destroying static objects after main return.
 * Post main return destruction leads to incorrect gtest timing measurements as
 * well as harder debuging if anything goes wrong during destruction. */
class Environment : public ::testing::VtsHalHidlTargetTestEnvBase {
class EnvironmentTearDown {
  public:
    using TearDownFunc = std::function<void()>;
    void registerTearDown(TearDownFunc&& tearDown) { tearDowns.push_front(std::move(tearDown)); }

   private:
    void HidlTearDown() override {
  protected:
    void executeAllTearDowns() {
        // Call the tear downs in reverse order of insertion
        for (auto& tearDown : tearDowns) {
            tearDown();
        }
    }

  private:
    std::list<TearDownFunc> tearDowns;
};

+9 −0
Original line number Diff line number Diff line
@@ -175,8 +175,17 @@ Return<void> Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) {
        for (size_t i = 0; i < halFormats.size(); ++i) {
            formats[i] = AudioFormat(halFormats[i]);
        }
        // Legacy get_parameter does not return a status_t, thus can not advertise of failure.
        // Note that the method must not return an empty list if this capability is supported.
        if (formats.size() == 0) {
            result = Result::NOT_SUPPORTED;
        }
    }
#if MAJOR_VERSION <= 5
    _hidl_cb(formats);
#elif MAJOR_VERSION >= 6
    _hidl_cb(result, formats);
#endif
    return Void();
}

+5 −4
Original line number Diff line number Diff line
@@ -60,19 +60,20 @@ TEST_IO_STREAM(SetConnectedState,
               "deconnection",
               testConnectedState(stream.get()))

TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", ASSERT_IS_OK(device->getHwAvSync()));
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail",
               ASSERT_IS_OK(getDevice()->getHwAvSync()));

TEST_F(AudioPrimaryHidlTest, setMode) {
TEST_P(AudioPrimaryHidlTest, setMode) {
    doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
    // Test Invalid values
    for (AudioMode mode : {AudioMode::INVALID, AudioMode::CURRENT, AudioMode::CNT}) {
        SCOPED_TRACE("mode=" + toString(mode));
        ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(mode));
        ASSERT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(mode));
    }
    // Test valid values
    for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
                           AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
        SCOPED_TRACE("mode=" + toString(mode));
        ASSERT_OK(device->setMode(mode));
        ASSERT_OK(getDevice()->setMode(mode));
    }
}
Loading