diff options
| author | Kevin Rocard <krocard@google.com> | 2017-12-07 05:54:12 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-12-07 05:54:12 +0000 |
| commit | 30944c7a73160c7607c2edac59b5d60f03742301 (patch) | |
| tree | 43a2280be4257cc3edeaa9a25a10b71f1740c26e /audio | |
| parent | 27dfaa09414aa4b7e9bf08d0d8fa4b3fecec7b3b (diff) | |
| parent | d7042bba2b78d978619e1c6505d4d3e4872bdec6 (diff) | |
| download | android_hardware_interfaces-30944c7a73160c7607c2edac59b5d60f03742301.tar.gz android_hardware_interfaces-30944c7a73160c7607c2edac59b5d60f03742301.tar.bz2 android_hardware_interfaces-30944c7a73160c7607c2edac59b5d60f03742301.zip | |
Merge changes from topic "b/69811500" into oc-dev am: 61ae0a1fc7 am: d7d5d7a22d am: abec925f05
am: d7042bba2b
Change-Id: I7265aa584b13ddc16e690b94f1976f6aaf5b91fa
Diffstat (limited to 'audio')
| -rw-r--r-- | audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp index 7c213d4e6..fd175de8f 100644 --- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp +++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp @@ -716,11 +716,12 @@ TEST_IO_STREAM(GetBufferSize, ASSERT_GE(extract(stream->getBufferSize()), extract(stream->getFrameSize()))); -template <class Property, class CapabilityGetter, class Getter, class Setter> +template <class Property, class CapabilityGetter> static void testCapabilityGetter(const string& name, IStream* stream, - Property currentValue, CapabilityGetter capablityGetter, - Getter getter, Setter setter) { + Return<Property> (IStream::*getter)(), + Return<Result> (IStream::*setter)(Property), + bool currentMustBeSupported = true) { hidl_vec<Property> capabilities; ASSERT_OK((stream->*capablityGetter)(returnIn(capabilities))); if (capabilities.size() == 0) { @@ -731,16 +732,24 @@ static void testCapabilityGetter(const string& name, IStream* stream, doc::partialTest(name + " is not supported"); return; }; - // TODO: This code has never been tested on a hal that supports - // getSupportedSampleRates - EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue), - capabilities.end()) - << "current " << name << " is not in the list of the supported ones " - << toString(capabilities); + + if (currentMustBeSupported) { + Property currentValue = extract((stream->*getter)()); + EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue), + capabilities.end()) + << "current " << name << " is not in the list of the supported ones " + << toString(capabilities); + } // Check that all declared supported values are indeed supported for (auto capability : capabilities) { - ASSERT_OK((stream->*setter)(capability)); + auto ret = (stream->*setter)(capability); + ASSERT_TRUE(ret.isOk()); + if (ret == Result::NOT_SUPPORTED) { + doc::partialTest("Setter is not supported"); + return; + } + ASSERT_OK(ret); ASSERT_EQ(capability, extract((stream->*getter)())); } } @@ -748,15 +757,17 @@ static void testCapabilityGetter(const string& name, IStream* stream, TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declared as supported", testCapabilityGetter("getSupportedSampleRate", stream.get(), - extract(stream->getSampleRate()), &IStream::getSupportedSampleRates, &IStream::getSampleRate, - &IStream::setSampleRate)) + &IStream::setSampleRate, + // getSupportedSampleRate returns the native sampling rates, + // (the sampling rates that can be played without resampling) + // but other sampling rates can be supported by the HAL. + false)) TEST_IO_STREAM(SupportedChannelMask, "Check that the stream channel mask is declared as supported", testCapabilityGetter("getSupportedChannelMask", stream.get(), - extract(stream->getChannelMask()), &IStream::getSupportedChannelMasks, &IStream::getChannelMask, &IStream::setChannelMask)) @@ -764,7 +775,6 @@ TEST_IO_STREAM(SupportedChannelMask, TEST_IO_STREAM(SupportedFormat, "Check that the stream format is declared as supported", testCapabilityGetter("getSupportedFormat", stream.get(), - extract(stream->getFormat()), &IStream::getSupportedFormats, &IStream::getFormat, &IStream::setFormat)) |
