OSDN Git Service

release-request-d9dc98f7-19b2-484c-b4d1-f35dc43e9c05-for-git_oc-mr1-release-4152006...
[android-x86/hardware-interfaces.git] / broadcastradio / 1.0 / vts / functional / VtsHalBroadcastradioV1_0TargetTest.cpp
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #define LOG_TAG "BroadcastRadioHidlHalTest"
18 #include <VtsHalHidlTargetTestBase.h>
19 #include <android-base/logging.h>
20 #include <cutils/native_handle.h>
21 #include <cutils/properties.h>
22 #include <hidl/HidlTransportSupport.h>
23 #include <utils/threads.h>
24
25 #include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
26 #include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
27 #include <android/hardware/broadcastradio/1.0/ITuner.h>
28 #include <android/hardware/broadcastradio/1.0/ITunerCallback.h>
29 #include <android/hardware/broadcastradio/1.0/types.h>
30
31
32 using ::android::sp;
33 using ::android::Mutex;
34 using ::android::Condition;
35 using ::android::hardware::Return;
36 using ::android::hardware::Void;
37 using ::android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory;
38 using ::android::hardware::broadcastradio::V1_0::IBroadcastRadio;
39 using ::android::hardware::broadcastradio::V1_0::ITuner;
40 using ::android::hardware::broadcastradio::V1_0::ITunerCallback;
41 using ::android::hardware::broadcastradio::V1_0::Result;
42 using ::android::hardware::broadcastradio::V1_0::Class;
43 using ::android::hardware::broadcastradio::V1_0::Properties;
44 using ::android::hardware::broadcastradio::V1_0::Band;
45 using ::android::hardware::broadcastradio::V1_0::BandConfig;
46 using ::android::hardware::broadcastradio::V1_0::Direction;
47 using ::android::hardware::broadcastradio::V1_0::ProgramInfo;
48 using ::android::hardware::broadcastradio::V1_0::MetaData;
49
50
51 #define RETURN_IF_SKIPPED \
52     if (skipped) { \
53         std::cout << "[  SKIPPED ] This device class is not supported. " << std::endl; \
54         return; \
55     }
56
57 // The main test class for Broadcast Radio HIDL HAL.
58
59 class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase,
60         public ::testing::WithParamInterface<Class> {
61  protected:
62     virtual void SetUp() override {
63         ASSERT_EQ(nullptr, mRadio.get());
64
65         radioClass = GetParam();
66         skipped = false;
67
68         sp<IBroadcastRadioFactory> factory =
69               ::testing::VtsHalHidlTargetTestBase::getService<IBroadcastRadioFactory>();
70         ASSERT_NE(nullptr, factory.get());
71
72         Result connectResult;
73         factory->connectModule(radioClass, [&](Result ret, const sp<IBroadcastRadio>& radio) {
74             connectResult = ret;
75             mRadio = radio;
76             onCallback_l();
77         });
78         EXPECT_EQ(true, waitForCallback(kConnectCallbacktimeoutNs));
79         mCallbackCalled = false;
80
81         if (connectResult == Result::INVALID_ARGUMENTS) {
82             skipped = true;
83             return;
84         }
85         ASSERT_EQ(connectResult, Result::OK);
86
87         mTunerCallback = new MyCallback(this);
88         ASSERT_NE(nullptr, mRadio.get());
89         ASSERT_NE(nullptr, mTunerCallback.get());
90     }
91
92     virtual void TearDown() override {
93         mTuner.clear();
94         mRadio.clear();
95     }
96
97     class MyCallback : public ITunerCallback {
98      public:
99
100         // ITunerCallback methods (see doc in ITunerCallback.hal)
101         virtual Return<void> hardwareFailure() {
102             ALOGI("%s", __FUNCTION__);
103             mParentTest->onHwFailureCallback();
104             return Void();
105         }
106
107         virtual Return<void> configChange(Result result, const BandConfig& config) {
108             ALOGI("%s result %d", __FUNCTION__, result);
109             mParentTest->onConfigChangeCallback(result, config);
110             return Void();
111         }
112
113         virtual Return<void> tuneComplete(Result result, const ProgramInfo& info) {
114             ALOGI("%s result %d", __FUNCTION__, result);
115             mParentTest->onTuneCompleteCallback(result, info);
116             return Void();
117         }
118
119         virtual Return<void> afSwitch(const ProgramInfo& info __unused) {
120             return Void();
121         }
122
123         virtual Return<void> antennaStateChange(bool connected) {
124             ALOGI("%s connected %d", __FUNCTION__, connected);
125             return Void();
126         }
127
128         virtual Return<void> trafficAnnouncement(bool active) {
129             ALOGI("%s active %d", __FUNCTION__, active);
130             return Void();
131         }
132
133         virtual Return<void> emergencyAnnouncement(bool active) {
134             ALOGI("%s active %d", __FUNCTION__, active);
135             return Void();
136         }
137
138         virtual Return<void> newMetadata(uint32_t channel __unused, uint32_t subChannel __unused,
139                            const ::android::hardware::hidl_vec<MetaData>& metadata __unused) {
140             ALOGI("%s", __FUNCTION__);
141             return Void();
142         }
143
144                 MyCallback(BroadcastRadioHidlTest *parentTest) : mParentTest(parentTest) {}
145
146      private:
147         // BroadcastRadioHidlTest instance to which callbacks will be notified.
148         BroadcastRadioHidlTest *mParentTest;
149     };
150
151
152     /**
153      * Method called by MyCallback when a callback with no status or boolean value is received
154      */
155     void onCallback() {
156         Mutex::Autolock _l(mLock);
157         onCallback_l();
158     }
159
160     /**
161      * Method called by MyCallback when hardwareFailure() callback is received
162      */
163     void onHwFailureCallback() {
164         Mutex::Autolock _l(mLock);
165         mHwFailure = true;
166         onCallback_l();
167     }
168
169     /**
170      * Method called by MyCallback when configChange() callback is received.
171      */
172     void onConfigChangeCallback(Result result, const BandConfig& config) {
173         Mutex::Autolock _l(mLock);
174         mResultCallbackData = result;
175         mBandConfigCallbackData = config;
176         onCallback_l();
177     }
178
179     /**
180      * Method called by MyCallback when tuneComplete() callback is received.
181      */
182     void onTuneCompleteCallback(Result result, const ProgramInfo& info) {
183         Mutex::Autolock _l(mLock);
184         mResultCallbackData = result;
185         mProgramInfoCallbackData = info;
186         onCallback_l();
187     }
188
189     /**
190      * Method called by MyCallback when a boolean indication is received
191      */
192     void onBoolCallback(bool result) {
193         Mutex::Autolock _l(mLock);
194         mBoolCallbackData = result;
195         onCallback_l();
196     }
197
198
199     BroadcastRadioHidlTest()
200         : mCallbackCalled(false), mBoolCallbackData(false), mResultCallbackData(Result::OK),
201         mHwFailure(false) {}
202
203     void onCallback_l() {
204         if (!mCallbackCalled) {
205             mCallbackCalled = true;
206             mCallbackCond.broadcast();
207         }
208     }
209
210
211     bool waitForCallback(nsecs_t reltime = 0) {
212         Mutex::Autolock _l(mLock);
213         nsecs_t endTime = systemTime() + reltime;
214         while (!mCallbackCalled) {
215             if (reltime == 0) {
216                 mCallbackCond.wait(mLock);
217             } else {
218                 nsecs_t now = systemTime();
219                 if (now > endTime) {
220                     return false;
221                 }
222                 mCallbackCond.waitRelative(mLock, endTime - now);
223             }
224         }
225         return true;
226     }
227
228     bool getProperties();
229     bool openTuner();
230     bool checkAntenna();
231     BandConfig& getBand(unsigned idx);
232
233     static const nsecs_t kConnectCallbacktimeoutNs = seconds_to_nanoseconds(1);
234     static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
235     static const nsecs_t kTuneCallbacktimeoutNs = seconds_to_nanoseconds(30);
236
237     Class radioClass;
238     bool skipped;
239     sp<IBroadcastRadio> mRadio;
240     Properties mHalProperties;
241     bool mHalPropertiesInitialized = false;
242     sp<ITuner> mTuner;
243     sp<MyCallback> mTunerCallback;
244     Mutex mLock;
245     Condition mCallbackCond;
246     bool mCallbackCalled;
247     bool mBoolCallbackData;
248     Result mResultCallbackData;
249     ProgramInfo mProgramInfoCallbackData;
250     BandConfig mBandConfigCallbackData;
251     bool mHwFailure;
252 };
253
254 namespace android {
255 namespace hardware {
256 namespace broadcastradio {
257 namespace V1_0 {
258
259 /**
260  * Compares two BandConfig objects for testing purposes.
261  */
262 static bool operator==(const BandConfig& l, const BandConfig& r) {
263     if (l.type != r.type) return false;
264     if (l.antennaConnected != r.antennaConnected) return false;
265     if (l.lowerLimit != r.lowerLimit) return false;
266     if (l.upperLimit != r.upperLimit) return false;
267     if (l.spacings != r.spacings) return false;
268     if (l.type == Band::AM || l.type == Band::AM_HD) {
269         return l.ext.am == r.ext.am;
270     } else if (l.type == Band::FM || l.type == Band::FM_HD) {
271         return l.ext.fm == r.ext.fm;
272     } else {
273         // unsupported type
274         return false;
275     }
276 }
277
278 }  // V1_0
279 }  // broadcastradio
280 }  // hardware
281 }  // android
282
283 bool BroadcastRadioHidlTest::getProperties()
284 {
285     if (mHalPropertiesInitialized) return true;
286
287     Result halResult = Result::NOT_INITIALIZED;
288     auto hidlReturn = mRadio->getProperties([&](Result result, const Properties& properties) {
289         halResult = result;
290         if (result == Result::OK) {
291             mHalProperties = properties;
292         }
293     });
294
295     EXPECT_TRUE(hidlReturn.isOk());
296     EXPECT_EQ(Result::OK, halResult);
297     EXPECT_EQ(radioClass, mHalProperties.classId);
298     EXPECT_GT(mHalProperties.numTuners, 0u);
299     if (radioClass == Class::AM_FM) {
300         EXPECT_GT(mHalProperties.bands.size(), 0u);
301     }
302
303     if (hidlReturn.isOk() && halResult == Result::OK) {
304         mHalPropertiesInitialized = true;
305         return true;
306     }
307     return false;
308 }
309
310 bool BroadcastRadioHidlTest::openTuner()
311 {
312     if (!getProperties()) {
313         return false;
314     }
315     if (mTuner.get() == nullptr) {
316         Result halResult = Result::NOT_INITIALIZED;
317         auto openCb = [&](Result result, const sp<ITuner>& tuner) {
318             halResult = result;
319             if (result == Result::OK) {
320                 mTuner = tuner;
321             }
322         };
323         auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
324         EXPECT_TRUE(hidlReturn.isOk());
325         EXPECT_EQ(Result::OK, halResult);
326         if (radioClass == Class::AM_FM) {
327             EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
328         }
329     }
330     EXPECT_NE(nullptr, mTuner.get());
331     return nullptr != mTuner.get();
332 }
333
334 bool BroadcastRadioHidlTest::checkAntenna()
335 {
336     if (radioClass != Class::AM_FM) return true;
337
338     BandConfig halConfig;
339     Result halResult = Result::NOT_INITIALIZED;
340     Return<void> hidlReturn =
341             mTuner->getConfiguration([&](Result result, const BandConfig& config) {
342                 halResult = result;
343                 if (result == Result::OK) {
344                     halConfig = config;
345                 }
346             });
347
348     return ((halResult == Result::OK) && (halConfig.antennaConnected == true));
349 }
350
351 BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
352     static BandConfig dummyBandConfig = {};
353     if (radioClass == Class::AM_FM) {
354         EXPECT_GT(mHalProperties.bands.size(), idx);
355         if (mHalProperties.bands.size() > idx) {
356             return mHalProperties.bands[idx];
357         } else {
358             return dummyBandConfig;
359         }
360     } else {
361         return dummyBandConfig;
362     }
363 }
364
365 /**
366  * Test IBroadcastRadio::getProperties() method
367  *
368  * Verifies that:
369  *  - the HAL implements the method
370  *  - the method returns 0 (no error)
371  *  - the implementation class is radioClass
372  *  - the implementation supports at least one tuner
373  *  - the implementation supports at one band
374  */
375 TEST_P(BroadcastRadioHidlTest, GetProperties) {
376     RETURN_IF_SKIPPED;
377     EXPECT_EQ(true, getProperties());
378 }
379
380 /**
381  * Test IBroadcastRadio::openTuner() method
382  *
383  * Verifies that:
384  *  - the HAL implements the method
385  *  - the method returns 0 (no error) and a valid ITuner interface
386  */
387 TEST_P(BroadcastRadioHidlTest, OpenTuner) {
388     RETURN_IF_SKIPPED;
389     EXPECT_EQ(true, openTuner());
390 }
391
392 /**
393  * Test IBroadcastRadio::openTuner() after ITuner disposal.
394  *
395  * Verifies that:
396  *  - ITuner destruction gets propagated through HAL
397  *  - the openTuner method works well when called for the second time
398  */
399 TEST_P(BroadcastRadioHidlTest, ReopenTuner) {
400     RETURN_IF_SKIPPED;
401     EXPECT_TRUE(openTuner());
402     mTuner.clear();
403     EXPECT_TRUE(openTuner());
404 }
405
406 /**
407  * Test IBroadcastRadio::openTuner() method called twice.
408  *
409  * Verifies that:
410  *  - the openTuner method fails with INVALID_STATE or succeeds when called for the second time
411  *    without deleting previous ITuner instance
412  */
413 TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
414     RETURN_IF_SKIPPED;
415     EXPECT_TRUE(openTuner());
416
417     Result halResult = Result::NOT_INITIALIZED;
418     auto openCb = [&](Result result, const sp<ITuner>&) { halResult = result; };
419     auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
420     EXPECT_TRUE(hidlReturn.isOk());
421     if (halResult == Result::INVALID_STATE) {
422         EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
423     }
424 }
425
426 /**
427  * Test ITuner::setConfiguration() and getConfiguration methods
428  *
429  * Verifies that:
430  *  - the HAL implements both methods
431  *  - the methods return 0 (no error)
432  *  - the configuration callback is received within kConfigCallbacktimeoutNs ns
433  *  - the configuration read back from HAl has the same class Id
434  */
435 TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
436     if (radioClass != Class::AM_FM) skipped = true;
437     RETURN_IF_SKIPPED;
438     ASSERT_EQ(true, openTuner());
439     // test setConfiguration
440     mCallbackCalled = false;
441     Return<Result> hidlResult = mTuner->setConfiguration(getBand(1));
442     EXPECT_TRUE(hidlResult.isOk());
443     EXPECT_EQ(Result::OK, hidlResult);
444     EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
445     EXPECT_EQ(Result::OK, mResultCallbackData);
446     EXPECT_EQ(getBand(1), mBandConfigCallbackData);
447
448     // test getConfiguration
449     BandConfig halConfig;
450     Result halResult;
451     Return<void> hidlReturn =
452             mTuner->getConfiguration([&](Result result, const BandConfig& config) {
453                 halResult = result;
454                 if (result == Result::OK) {
455                     halConfig = config;
456                 }
457             });
458     EXPECT_TRUE(hidlReturn.isOk());
459     EXPECT_EQ(Result::OK, halResult);
460     EXPECT_EQ(getBand(1), halConfig);
461 }
462
463 /**
464  * Test ITuner::setConfiguration() with invalid arguments.
465  *
466  * Verifies that:
467  *  - the methods returns INVALID_ARGUMENTS on invalid arguments
468  *  - the method recovers and succeeds after passing correct arguments
469  */
470 TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
471     if (radioClass != Class::AM_FM) skipped = true;
472     RETURN_IF_SKIPPED;
473     ASSERT_EQ(true, openTuner());
474
475     // Let's define a config that's bad for sure.
476     BandConfig badConfig = {};
477     badConfig.type = Band::FM;
478     badConfig.lowerLimit = 0xFFFFFFFF;
479     badConfig.upperLimit = 0;
480     badConfig.spacings = (std::vector<uint32_t>){ 0 };
481
482     // Test setConfiguration failing on bad data.
483     mCallbackCalled = false;
484     auto setResult = mTuner->setConfiguration(badConfig);
485     EXPECT_TRUE(setResult.isOk());
486     EXPECT_EQ(Result::INVALID_ARGUMENTS, setResult);
487
488     // Test setConfiguration recovering after passing good data.
489     mCallbackCalled = false;
490     setResult = mTuner->setConfiguration(getBand(0));
491     EXPECT_TRUE(setResult.isOk());
492     EXPECT_EQ(Result::OK, setResult);
493     EXPECT_EQ(true, waitForCallback(kConfigCallbacktimeoutNs));
494     EXPECT_EQ(Result::OK, mResultCallbackData);
495 }
496
497 /**
498  * Test ITuner::scan
499  *
500  * Verifies that:
501  *  - the HAL implements the method
502  *  - the method returns 0 (no error)
503  *  - the tuned callback is received within kTuneCallbacktimeoutNs ns
504  *  - skipping sub-channel or not does not fail the call
505  */
506 TEST_P(BroadcastRadioHidlTest, Scan) {
507     RETURN_IF_SKIPPED;
508     ASSERT_EQ(true, openTuner());
509     ASSERT_TRUE(checkAntenna());
510     // test scan UP
511     mCallbackCalled = false;
512     Return<Result> hidlResult = mTuner->scan(Direction::UP, true);
513     EXPECT_TRUE(hidlResult.isOk());
514     EXPECT_EQ(Result::OK, hidlResult);
515     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
516
517     // test scan DOWN
518     mCallbackCalled = false;
519     hidlResult = mTuner->scan(Direction::DOWN, false);
520     EXPECT_TRUE(hidlResult.isOk());
521     EXPECT_EQ(Result::OK, hidlResult);
522     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
523 }
524
525 /**
526  * Test ITuner::step
527  *
528  * Verifies that:
529  *  - the HAL implements the method
530  *  - the method returns 0 (no error)
531  *  - the tuned callback is received within kTuneCallbacktimeoutNs ns
532  *  - skipping sub-channel or not does not fail the call
533  */
534 TEST_P(BroadcastRadioHidlTest, Step) {
535     if (radioClass != Class::AM_FM) skipped = true;
536     RETURN_IF_SKIPPED;
537     ASSERT_EQ(true, openTuner());
538     ASSERT_TRUE(checkAntenna());
539     // test step UP
540     mCallbackCalled = false;
541     Return<Result> hidlResult = mTuner->step(Direction::UP, false);
542     EXPECT_TRUE(hidlResult.isOk());
543     EXPECT_EQ(Result::OK, hidlResult);
544     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
545
546     // test step DOWN
547     mCallbackCalled = false;
548     hidlResult = mTuner->step(Direction::DOWN, true);
549     EXPECT_TRUE(hidlResult.isOk());
550     EXPECT_EQ(Result::OK, hidlResult);
551     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
552 }
553
554 /**
555  * Test ITuner::tune,  getProgramInformation and cancel methods
556  *
557  * Verifies that:
558  *  - the HAL implements the methods
559  *  - the methods return 0 (no error)
560  *  - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
561  */
562 TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
563     if (radioClass != Class::AM_FM) skipped = true;
564     RETURN_IF_SKIPPED;
565     ASSERT_EQ(true, openTuner());
566     ASSERT_TRUE(checkAntenna());
567
568     auto& band = getBand(0);
569
570     // test tune
571     ASSERT_GT(band.spacings.size(), 0u);
572     ASSERT_GT(band.upperLimit, band.lowerLimit);
573
574     // test scan UP
575     uint32_t lowerLimit = band.lowerLimit;
576     uint32_t upperLimit = band.upperLimit;
577     uint32_t spacing = band.spacings[0];
578
579     uint32_t channel =
580             lowerLimit + (((upperLimit - lowerLimit) / 2 + spacing - 1) / spacing) * spacing;
581     mCallbackCalled = false;
582     mResultCallbackData = Result::NOT_INITIALIZED;
583     Return<Result> hidlResult = mTuner->tune(channel, 0);
584     EXPECT_TRUE(hidlResult.isOk());
585     EXPECT_EQ(Result::OK, hidlResult);
586     EXPECT_EQ(true, waitForCallback(kTuneCallbacktimeoutNs));
587     EXPECT_EQ(channel, mProgramInfoCallbackData.channel);
588
589     // test getProgramInformation
590     ProgramInfo halInfo;
591     Result halResult = Result::NOT_INITIALIZED;
592     Return<void> hidlReturn = mTuner->getProgramInformation(
593         [&](Result result, const ProgramInfo& info) {
594             halResult = result;
595             if (result == Result::OK) {
596                 halInfo = info;
597             }
598         });
599     EXPECT_TRUE(hidlReturn.isOk());
600     EXPECT_EQ(Result::OK, halResult);
601     if (mResultCallbackData == Result::OK) {
602         EXPECT_LE(halInfo.channel, upperLimit);
603         EXPECT_GE(halInfo.channel, lowerLimit);
604     }
605
606     // test cancel
607     mTuner->tune(lowerLimit, 0);
608     hidlResult = mTuner->cancel();
609     EXPECT_TRUE(hidlResult.isOk());
610     EXPECT_EQ(Result::OK, hidlResult);
611 }
612
613 /**
614  * Test ITuner::tune failing when channel out of the range is provided.
615  *
616  * Verifies that:
617  *  - the method returns INVALID_ARGUMENTS when applicable
618  *  - the method recovers and succeeds after passing correct arguments
619  */
620 TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
621     if (radioClass != Class::AM_FM) skipped = true;
622     RETURN_IF_SKIPPED;
623     ASSERT_TRUE(openTuner());
624     ASSERT_TRUE(checkAntenna());
625
626     // get current channel bounds
627     BandConfig halConfig;
628     Result halResult;
629     auto configResult = mTuner->getConfiguration([&](Result result, const BandConfig& config) {
630         halResult = result;
631         halConfig = config;
632     });
633     ASSERT_TRUE(configResult.isOk());
634     ASSERT_EQ(Result::OK, halResult);
635
636     // try to tune slightly above the limit and expect to fail
637     auto badChannel = halConfig.upperLimit + halConfig.spacings[0];
638     auto tuneResult = mTuner->tune(badChannel, 0);
639     EXPECT_TRUE(tuneResult.isOk());
640     EXPECT_EQ(Result::INVALID_ARGUMENTS, tuneResult);
641     EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
642
643     // tuning exactly at the limit should succeed
644     auto goodChannel = halConfig.upperLimit;
645     tuneResult = mTuner->tune(goodChannel, 0);
646     EXPECT_TRUE(tuneResult.isOk());
647     EXPECT_EQ(Result::OK, tuneResult);
648     EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
649 }
650
651 INSTANTIATE_TEST_CASE_P(
652     BroadcastRadioHidlTestCases,
653     BroadcastRadioHidlTest,
654     ::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
655
656 int main(int argc, char** argv) {
657   ::testing::InitGoogleTest(&argc, argv);
658   int status = RUN_ALL_TESTS();
659   ALOGI("Test result = %d", status);
660   return status;
661 }