mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Update broadcastradio HAL 1.0 VTS tests." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b0e7821fcb
@@ -229,7 +229,18 @@ class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase,
|
||||
bool getProperties();
|
||||
bool openTuner();
|
||||
bool checkAntenna();
|
||||
BandConfig& getBand(unsigned idx);
|
||||
|
||||
/**
|
||||
* Retrieves AM/FM band configuration from module properties.
|
||||
*
|
||||
* The configuration may not exist: if radio type is other than AM/FM
|
||||
* or provided index is out of bounds.
|
||||
* In such case, empty configuration is returned.
|
||||
*
|
||||
* @param idx Band index to retrieve.
|
||||
* @return Band configuration reference.
|
||||
*/
|
||||
const BandConfig& getBand(unsigned idx);
|
||||
|
||||
static const nsecs_t kConnectCallbacktimeoutNs = seconds_to_nanoseconds(1);
|
||||
static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
|
||||
@@ -349,7 +360,7 @@ bool BroadcastRadioHidlTest::checkAntenna()
|
||||
return ((halResult == Result::OK) && (halConfig.antennaConnected == true));
|
||||
}
|
||||
|
||||
BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
|
||||
const BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
|
||||
static BandConfig dummyBandConfig = {};
|
||||
if (radioClass == Class::AM_FM) {
|
||||
EXPECT_GT(mHalProperties.bands.size(), idx);
|
||||
@@ -419,8 +430,12 @@ TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
|
||||
auto openCb = [&](Result result, const sp<ITuner>&) { halResult = result; };
|
||||
auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
|
||||
EXPECT_TRUE(hidlReturn.isOk());
|
||||
if (halResult == Result::INVALID_STATE) {
|
||||
EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
|
||||
if (halResult == Result::OK) {
|
||||
if (radioClass == Class::AM_FM) {
|
||||
EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
|
||||
}
|
||||
} else {
|
||||
EXPECT_EQ(Result::INVALID_STATE, halResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +447,9 @@ TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
|
||||
* - the methods return 0 (no error)
|
||||
* - the configuration callback is received within kConfigCallbacktimeoutNs ns
|
||||
* - the configuration read back from HAl has the same class Id
|
||||
*
|
||||
* Skipped for other radio classes than AM/FM, because setConfiguration
|
||||
* applies only for these bands.
|
||||
*/
|
||||
TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
|
||||
if (radioClass != Class::AM_FM) skipped = true;
|
||||
@@ -467,6 +485,9 @@ TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
|
||||
* Verifies that:
|
||||
* - the methods returns INVALID_ARGUMENTS on invalid arguments
|
||||
* - the method recovers and succeeds after passing correct arguments
|
||||
*
|
||||
* Skipped for other radio classes than AM/FM, because setConfiguration
|
||||
* applies only for these bands.
|
||||
*/
|
||||
TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
|
||||
if (radioClass != Class::AM_FM) skipped = true;
|
||||
@@ -531,6 +552,9 @@ TEST_P(BroadcastRadioHidlTest, Scan) {
|
||||
* - the method returns 0 (no error)
|
||||
* - the tuned callback is received within kTuneCallbacktimeoutNs ns
|
||||
* - skipping sub-channel or not does not fail the call
|
||||
*
|
||||
* Skipped for other radio classes than AM/FM, because step is not possible
|
||||
* on DAB nor satellite.
|
||||
*/
|
||||
TEST_P(BroadcastRadioHidlTest, Step) {
|
||||
if (radioClass != Class::AM_FM) skipped = true;
|
||||
@@ -559,6 +583,9 @@ TEST_P(BroadcastRadioHidlTest, Step) {
|
||||
* - the HAL implements the methods
|
||||
* - the methods return 0 (no error)
|
||||
* - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
|
||||
*
|
||||
* Skipped for other radio classes than AM/FM, because tune to frequency
|
||||
* is not possible on DAB nor satellite.
|
||||
*/
|
||||
TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
|
||||
if (radioClass != Class::AM_FM) skipped = true;
|
||||
@@ -617,6 +644,9 @@ TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
|
||||
* Verifies that:
|
||||
* - the method returns INVALID_ARGUMENTS when applicable
|
||||
* - the method recovers and succeeds after passing correct arguments
|
||||
*
|
||||
* Skipped for other radio classes than AM/FM, because tune to frequency
|
||||
* is not possible on DAB nor satellite.
|
||||
*/
|
||||
TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
|
||||
if (radioClass != Class::AM_FM) skipped = true;
|
||||
|
||||
Reference in New Issue
Block a user