Loading broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp +34 −4 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -419,9 +430,13 @@ 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) { if (halResult == Result::OK) { if (radioClass == Class::AM_FM) { EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs)); } } else { EXPECT_EQ(Result::INVALID_STATE, halResult); } } /** Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading
broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp +34 −4 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -419,9 +430,13 @@ 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) { if (halResult == Result::OK) { if (radioClass == Class::AM_FM) { EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs)); } } else { EXPECT_EQ(Result::INVALID_STATE, halResult); } } /** Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading