blob: 615fde03433042572f3907fa57aca520d429a08e [file] [log] [blame]
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -08001/*
2 * Copyright (C) 2017 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
Tomasz Wasilczykdb902862018-01-14 17:22:03 -080017#define EGMOCK_VERBOSE 1
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080018
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080019#include <android-base/logging.h>
Tomasz Wasilczyk8acabf22018-04-30 10:22:20 -070020#include <android-base/strings.h>
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080021#include <android/hardware/broadcastradio/2.0/IBroadcastRadio.h>
22#include <android/hardware/broadcastradio/2.0/ITunerCallback.h>
23#include <android/hardware/broadcastradio/2.0/ITunerSession.h>
24#include <android/hardware/broadcastradio/2.0/types.h>
25#include <broadcastradio-utils-2x/Utils.h>
26#include <broadcastradio-vts-utils/call-barrier.h>
27#include <broadcastradio-vts-utils/mock-timeout.h>
28#include <broadcastradio-vts-utils/pointer-utils.h>
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -080029#include <cutils/bitops.h>
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080030#include <gmock/gmock.h>
Dan Shi27506e62019-12-12 10:54:49 -080031#include <gtest/gtest.h>
32#include <hidl/GtestPrinter.h>
33#include <hidl/ServiceManagement.h>
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080034
35#include <chrono>
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -080036#include <optional>
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -080037#include <regex>
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080038
39namespace android {
40namespace hardware {
41namespace broadcastradio {
42namespace V2_0 {
43namespace vts {
44
45using namespace std::chrono_literals;
46
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080047using std::unordered_set;
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080048using std::vector;
49using testing::_;
50using testing::AnyNumber;
51using testing::ByMove;
52using testing::DoAll;
53using testing::Invoke;
54using testing::SaveArg;
55
56using broadcastradio::vts::CallBarrier;
57using broadcastradio::vts::clearAndWait;
58using utils::make_identifier;
59using utils::make_selector_amfm;
60
61namespace timeout {
62
63static constexpr auto tune = 30s;
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080064static constexpr auto programListScan = 5min;
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080065
66} // namespace timeout
67
Tomasz Wasilczyk55241f72018-04-30 08:53:24 -070068static constexpr auto gTuneWorkaround = 200ms;
69
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -080070static const ConfigFlag gConfigFlagValues[] = {
Tomasz Wasilczyk30240f62017-12-20 14:19:21 -080071 ConfigFlag::FORCE_MONO,
72 ConfigFlag::FORCE_ANALOG,
73 ConfigFlag::FORCE_DIGITAL,
74 ConfigFlag::RDS_AF,
75 ConfigFlag::RDS_REG,
76 ConfigFlag::DAB_DAB_LINKING,
77 ConfigFlag::DAB_FM_LINKING,
78 ConfigFlag::DAB_DAB_SOFT_LINKING,
79 ConfigFlag::DAB_FM_SOFT_LINKING,
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -080080};
81
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080082class TunerCallbackMock : public ITunerCallback {
83 public:
84 TunerCallbackMock();
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080085
86 MOCK_METHOD2(onTuneFailed, Return<void>(Result, const ProgramSelector&));
Tomasz Wasilczyk67360522018-02-10 14:05:18 -080087 MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChanged_, Return<void>(const ProgramInfo&));
88 virtual Return<void> onCurrentProgramInfoChanged(const ProgramInfo& info);
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080089 Return<void> onProgramListUpdated(const ProgramListChunk& chunk);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080090 MOCK_METHOD1(onAntennaStateChange, Return<void>(bool connected));
91 MOCK_METHOD1(onParametersUpdated, Return<void>(const hidl_vec<VendorKeyValue>& parameters));
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080092
93 MOCK_TIMEOUT_METHOD0(onProgramListReady, void());
94
95 std::mutex mLock;
96 utils::ProgramInfoSet mProgramList;
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -080097};
98
Tomasz Wasilczyk0d5ef5d2018-01-10 10:58:20 -080099struct AnnouncementListenerMock : public IAnnouncementListener {
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800100 MOCK_METHOD1(onListUpdated, Return<void>(const hidl_vec<Announcement>&));
101};
102
Dan Shi27506e62019-12-12 10:54:49 -0800103class BroadcastRadioHalTest : public ::testing::TestWithParam<std::string> {
104 protected:
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800105 virtual void SetUp() override;
106 virtual void TearDown() override;
107
108 bool openSession();
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800109 bool getAmFmRegionConfig(bool full, AmFmRegionConfig* config);
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800110 std::optional<utils::ProgramInfoSet> getProgramList();
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800111
112 sp<IBroadcastRadio> mModule;
113 Properties mProperties;
114 sp<ITunerSession> mSession;
115 sp<TunerCallbackMock> mCallback = new TunerCallbackMock();
116};
117
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800118static void printSkipped(std::string msg) {
Tomasz Wasilczyk751855d2020-06-29 10:22:43 -0700119 const auto testInfo = testing::UnitTest::GetInstance()->current_test_info();
120 std::cout << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name()
121 << std::endl;
122 std::cout << msg << std::endl;
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800123}
124
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800125MATCHER_P(InfoHasId, id,
126 std::string(negation ? "does not contain" : "contains") + " " + toString(id)) {
127 auto ids = utils::getAllIds(arg.selector, utils::getType(id));
128 return ids.end() != find(ids.begin(), ids.end(), id.value);
129}
130
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800131TunerCallbackMock::TunerCallbackMock() {
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800132 EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800133
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800134 // we expect the antenna is connected through the whole test
135 EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0);
136}
137
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800138Return<void> TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) {
Tomasz Wasilczykcea64962018-05-23 09:56:58 -0700139 for (auto&& id : info.selector) {
140 EXPECT_NE(IdentifierType::INVALID, utils::getType(id));
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800141 }
142
Tomasz Wasilczykcea64962018-05-23 09:56:58 -0700143 auto logically = utils::getType(info.logicallyTunedTo);
144 /* This field is required for currently tuned program and should be INVALID
145 * for entries from the program list.
146 */
147 EXPECT_TRUE(
148 logically == IdentifierType::AMFM_FREQUENCY || logically == IdentifierType::RDS_PI ||
149 logically == IdentifierType::HD_STATION_ID_EXT ||
150 logically == IdentifierType::DAB_SID_EXT || logically == IdentifierType::DRMO_SERVICE_ID ||
151 logically == IdentifierType::SXM_SERVICE_ID ||
152 (logically >= IdentifierType::VENDOR_START && logically <= IdentifierType::VENDOR_END) ||
153 logically > IdentifierType::SXM_CHANNEL);
154
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800155 auto physically = utils::getType(info.physicallyTunedTo);
Tomasz Wasilczykcea64962018-05-23 09:56:58 -0700156 // ditto (see "logically" above)
157 EXPECT_TRUE(
158 physically == IdentifierType::AMFM_FREQUENCY ||
159 physically == IdentifierType::DAB_ENSEMBLE ||
160 physically == IdentifierType::DRMO_FREQUENCY || physically == IdentifierType::SXM_CHANNEL ||
161 (physically >= IdentifierType::VENDOR_START && physically <= IdentifierType::VENDOR_END) ||
162 physically > IdentifierType::SXM_CHANNEL);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800163
Tomasz Wasilczyk8acabf22018-04-30 10:22:20 -0700164 if (logically == IdentifierType::AMFM_FREQUENCY) {
165 auto ps = utils::getMetadataString(info, MetadataKey::RDS_PS);
166 if (ps.has_value()) {
167 EXPECT_NE("", android::base::Trim(*ps))
168 << "Don't use empty RDS_PS as an indicator of missing RSD PS data.";
169 }
170 }
171
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800172 return onCurrentProgramInfoChanged_(info);
173}
174
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800175Return<void> TunerCallbackMock::onProgramListUpdated(const ProgramListChunk& chunk) {
176 std::lock_guard<std::mutex> lk(mLock);
177
178 updateProgramList(mProgramList, chunk);
179
180 if (chunk.complete) onProgramListReady();
181
182 return {};
183}
184
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800185void BroadcastRadioHalTest::SetUp() {
186 EXPECT_EQ(nullptr, mModule.get()) << "Module is already open";
187
188 // lookup HIDL service (radio module)
Dan Shi27506e62019-12-12 10:54:49 -0800189 mModule = IBroadcastRadio::getService(GetParam());
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800190 ASSERT_NE(nullptr, mModule.get()) << "Couldn't find broadcast radio HAL implementation";
191
192 // get module properties
193 auto propResult = mModule->getProperties([&](const Properties& p) { mProperties = p; });
194 ASSERT_TRUE(propResult.isOk());
195
196 EXPECT_FALSE(mProperties.maker.empty());
197 EXPECT_FALSE(mProperties.product.empty());
198 EXPECT_GT(mProperties.supportedIdentifierTypes.size(), 0u);
199}
200
201void BroadcastRadioHalTest::TearDown() {
202 mSession.clear();
203 mModule.clear();
204 clearAndWait(mCallback, 1s);
205}
206
207bool BroadcastRadioHalTest::openSession() {
208 EXPECT_EQ(nullptr, mSession.get()) << "Session is already open";
209
210 Result halResult = Result::UNKNOWN_ERROR;
211 auto openCb = [&](Result result, const sp<ITunerSession>& session) {
212 halResult = result;
213 if (result != Result::OK) return;
214 mSession = session;
215 };
216 auto hidlResult = mModule->openSession(mCallback, openCb);
217
218 EXPECT_TRUE(hidlResult.isOk());
219 EXPECT_EQ(Result::OK, halResult);
220 EXPECT_NE(nullptr, mSession.get());
221
222 return nullptr != mSession.get();
223}
224
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800225bool BroadcastRadioHalTest::getAmFmRegionConfig(bool full, AmFmRegionConfig* config) {
226 auto halResult = Result::UNKNOWN_ERROR;
227 auto cb = [&](Result result, AmFmRegionConfig configCb) {
228 halResult = result;
229 if (config) *config = configCb;
230 };
231
232 auto hidlResult = mModule->getAmFmRegionConfig(full, cb);
233 EXPECT_TRUE(hidlResult.isOk());
234
235 if (halResult == Result::NOT_SUPPORTED) return false;
236
237 EXPECT_EQ(Result::OK, halResult);
238 return halResult == Result::OK;
239}
240
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800241std::optional<utils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList() {
242 EXPECT_TIMEOUT_CALL(*mCallback, onProgramListReady).Times(AnyNumber());
243
244 auto startResult = mSession->startProgramListUpdates({});
245 if (startResult == Result::NOT_SUPPORTED) {
246 printSkipped("Program list not supported");
Dan Shi27506e62019-12-12 10:54:49 -0800247 return std::nullopt;
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800248 }
249 EXPECT_EQ(Result::OK, startResult);
Dan Shi27506e62019-12-12 10:54:49 -0800250 if (startResult != Result::OK) return std::nullopt;
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800251
252 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onProgramListReady, timeout::programListScan);
253
254 auto stopResult = mSession->stopProgramListUpdates();
255 EXPECT_TRUE(stopResult.isOk());
256
257 return mCallback->mProgramList;
258}
259
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800260/**
261 * Test session opening.
262 *
263 * Verifies that:
264 * - the method succeeds on a first and subsequent calls;
265 * - the method succeeds when called for the second time without
266 * closing previous session.
267 */
Dan Shi27506e62019-12-12 10:54:49 -0800268TEST_P(BroadcastRadioHalTest, OpenSession) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800269 // simply open session for the first time
270 ASSERT_TRUE(openSession());
271
272 // drop (without explicit close) and re-open the session
273 mSession.clear();
274 ASSERT_TRUE(openSession());
275
276 // open the second session (the first one should be forcibly closed)
277 auto secondSession = mSession;
278 mSession.clear();
279 ASSERT_TRUE(openSession());
280}
281
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800282static bool isValidAmFmFreq(uint64_t freq) {
283 auto id = utils::make_identifier(IdentifierType::AMFM_FREQUENCY, freq);
284 return utils::isValid(id);
285}
286
287static void validateRange(const AmFmBandRange& range) {
288 EXPECT_TRUE(isValidAmFmFreq(range.lowerBound));
289 EXPECT_TRUE(isValidAmFmFreq(range.upperBound));
290 EXPECT_LT(range.lowerBound, range.upperBound);
291 EXPECT_GT(range.spacing, 0u);
292 EXPECT_EQ(0u, (range.upperBound - range.lowerBound) % range.spacing);
293}
294
295static bool supportsFM(const AmFmRegionConfig& config) {
296 for (auto&& range : config.ranges) {
297 if (utils::getBand(range.lowerBound) == utils::FrequencyBand::FM) return true;
298 }
299 return false;
300}
301
302/**
303 * Test fetching AM/FM regional configuration.
304 *
305 * Verifies that:
306 * - AM/FM regional configuration is either set at startup or not supported at all by the hardware;
307 * - there is at least one AM/FM band configured;
308 * - FM Deemphasis and RDS are correctly configured for FM-capable radio;
309 * - all channel grids (frequency ranges and spacings) are valid;
Tomasz Wasilczykb557e0b2018-06-05 10:10:39 -0700310 * - seek spacing is a multiple of the manual spacing value.
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800311 */
Dan Shi27506e62019-12-12 10:54:49 -0800312TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfig) {
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800313 AmFmRegionConfig config;
314 bool supported = getAmFmRegionConfig(false, &config);
315 if (!supported) {
316 printSkipped("AM/FM not supported");
317 return;
318 }
319
320 EXPECT_GT(config.ranges.size(), 0u);
321 EXPECT_LE(popcountll(config.fmDeemphasis), 1);
322 EXPECT_LE(popcountll(config.fmRds), 1);
323
324 for (auto&& range : config.ranges) {
325 validateRange(range);
326 EXPECT_EQ(0u, range.scanSpacing % range.spacing);
327 EXPECT_GE(range.scanSpacing, range.spacing);
328 }
329
330 if (supportsFM(config)) {
331 EXPECT_EQ(popcountll(config.fmDeemphasis), 1);
332 }
333}
334
335/**
336 * Test fetching AM/FM regional capabilities.
337 *
338 * Verifies that:
339 * - AM/FM regional capabilities are either available or not supported at all by the hardware;
340 * - there is at least one AM/FM range supported;
341 * - there is at least one de-emphasis filter mode supported for FM-capable radio;
342 * - all channel grids (frequency ranges and spacings) are valid;
Tomasz Wasilczykb557e0b2018-06-05 10:10:39 -0700343 * - seek spacing is not set.
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800344 */
Dan Shi27506e62019-12-12 10:54:49 -0800345TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilities) {
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800346 AmFmRegionConfig config;
347 bool supported = getAmFmRegionConfig(true, &config);
348 if (!supported) {
349 printSkipped("AM/FM not supported");
350 return;
351 }
352
353 EXPECT_GT(config.ranges.size(), 0u);
354
355 for (auto&& range : config.ranges) {
356 validateRange(range);
357 EXPECT_EQ(0u, range.scanSpacing);
358 }
359
360 if (supportsFM(config)) {
361 EXPECT_GE(popcountll(config.fmDeemphasis), 1);
362 }
363}
364
365/**
366 * Test fetching DAB regional configuration.
367 *
368 * Verifies that:
369 * - DAB regional configuration is either set at startup or not supported at all by the hardware;
370 * - all channel labels match correct format;
371 * - all channel frequencies are in correct range.
372 */
Dan Shi27506e62019-12-12 10:54:49 -0800373TEST_P(BroadcastRadioHalTest, GetDabRegionConfig) {
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800374 Result halResult;
375 hidl_vec<DabTableEntry> config;
376 auto cb = [&](Result result, hidl_vec<DabTableEntry> configCb) {
377 halResult = result;
378 config = configCb;
379 };
380 auto hidlResult = mModule->getDabRegionConfig(cb);
381 ASSERT_TRUE(hidlResult.isOk());
382
383 if (halResult == Result::NOT_SUPPORTED) {
384 printSkipped("DAB not supported");
385 return;
386 }
387 ASSERT_EQ(Result::OK, halResult);
388
Tomasz Wasilczyka425ded2018-01-12 15:15:59 -0800389 std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$");
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800390 // double-check correctness of the test
391 ASSERT_TRUE(std::regex_match("5A", re));
392 ASSERT_FALSE(std::regex_match("5a", re));
Tomasz Wasilczyka425ded2018-01-12 15:15:59 -0800393 ASSERT_FALSE(std::regex_match("1234ABCD", re));
394 ASSERT_TRUE(std::regex_match("CN 12D", re));
395 ASSERT_FALSE(std::regex_match(" 5A", re));
Tomasz Wasilczyk8b70ee42017-12-21 11:51:29 -0800396
397 for (auto&& entry : config) {
398 EXPECT_TRUE(std::regex_match(std::string(entry.label), re));
399
400 auto id = utils::make_identifier(IdentifierType::DAB_FREQUENCY, entry.frequency);
401 EXPECT_TRUE(utils::isValid(id));
402 }
403}
404
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800405/**
406 * Test tuning with FM selector.
407 *
408 * Verifies that:
409 * - if AM/FM selector is not supported, the method returns NOT_SUPPORTED;
410 * - if it is supported, the method succeeds;
411 * - after a successful tune call, onCurrentProgramInfoChanged callback is
412 * invoked carrying a proper selector;
413 * - program changes exactly to what was requested.
414 */
Dan Shi27506e62019-12-12 10:54:49 -0800415TEST_P(BroadcastRadioHalTest, FmTune) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800416 ASSERT_TRUE(openSession());
417
Jan Kowal4e041502021-01-21 12:44:44 +0100418 uint64_t freq = 90900; // 90.9 FM
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800419 auto sel = make_selector_amfm(freq);
420
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800421 /* TODO(b/69958777): there is a race condition between tune() and onCurrentProgramInfoChanged
422 * callback setting infoCb, because egmock cannot distinguish calls with different matchers
423 * (there is one here and one in callback constructor).
424 *
425 * This sleep workaround will fix default implementation, but the real HW tests will still be
426 * flaky. We probably need to implement egmock alternative based on actions.
427 */
Tomasz Wasilczyk55241f72018-04-30 08:53:24 -0700428 std::this_thread::sleep_for(gTuneWorkaround);
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800429
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800430 // try tuning
431 ProgramInfo infoCb = {};
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800432 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_,
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800433 InfoHasId(utils::make_identifier(IdentifierType::AMFM_FREQUENCY, freq)))
Tomasz Wasilczyk751855d2020-06-29 10:22:43 -0700434 .Times(AnyNumber())
435 .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void()))))
436 .WillRepeatedly(testing::InvokeWithoutArgs([] { return Void(); }));
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800437 auto result = mSession->tune(sel);
438
439 // expect a failure if it's not supported
440 if (!utils::isSupported(mProperties, sel)) {
441 EXPECT_EQ(Result::NOT_SUPPORTED, result);
442 return;
443 }
444
445 // expect a callback if it succeeds
446 EXPECT_EQ(Result::OK, result);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800447 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800448
Tomasz Wasilczyk84ec4e12018-11-13 11:26:23 -0800449 LOG(DEBUG) << "current program info: " << toString(infoCb);
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800450
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800451 // it should tune exactly to what was requested
452 auto freqs = utils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY);
453 EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq));
454}
455
456/**
457 * Test tuning with invalid selectors.
458 *
459 * Verifies that:
460 * - if the selector is not supported, it's ignored;
461 * - if it is supported, an invalid value results with INVALID_ARGUMENTS;
462 */
Dan Shi27506e62019-12-12 10:54:49 -0800463TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800464 ASSERT_TRUE(openSession());
465
466 vector<ProgramIdentifier> invalid = {
467 make_identifier(IdentifierType::AMFM_FREQUENCY, 0),
468 make_identifier(IdentifierType::RDS_PI, 0x10000),
469 make_identifier(IdentifierType::HD_STATION_ID_EXT, 0x100000000),
470 make_identifier(IdentifierType::DAB_SID_EXT, 0),
471 make_identifier(IdentifierType::DRMO_SERVICE_ID, 0x100000000),
472 make_identifier(IdentifierType::SXM_SERVICE_ID, 0x100000000),
473 };
474
475 for (auto&& id : invalid) {
476 ProgramSelector sel{id, {}};
477
478 auto result = mSession->tune(sel);
479
480 if (utils::isSupported(mProperties, sel)) {
481 EXPECT_EQ(Result::INVALID_ARGUMENTS, result);
482 } else {
483 EXPECT_EQ(Result::NOT_SUPPORTED, result);
484 }
485 }
486}
487
488/**
hyewon.eum96b542d2020-12-04 12:09:17 +0900489 * Test tuning with DAB selector.
490 *
491 * Verifies that:
492 * - if DAB selector is not supported, the method returns NOT_SUPPORTED;
493 * - if it is supported, the method succeeds;
494 * - after a successful tune call, onCurrentProgramInfoChanged callback is
495 * invoked carrying a proper selector;
496 * - program changes exactly to what was requested.
497 */
Kihyung Leec3d3abc2021-03-11 16:29:55 +0900498TEST_P(BroadcastRadioHalTest, DabTune) {
Jan Kowalddef7912021-05-31 16:48:19 +0200499 Result halResult;
500 hidl_vec<DabTableEntry> config;
501 auto cb = [&](Result result, hidl_vec<DabTableEntry> configCb) {
502 halResult = result;
503 config = configCb;
504 };
505 auto hidlResult = mModule->getDabRegionConfig(cb);
506 ASSERT_TRUE(hidlResult.isOk());
507
508 if (halResult == Result::NOT_SUPPORTED) {
509 printSkipped("DAB not supported");
510 return;
511 }
512 ASSERT_EQ(Result::OK, halResult);
513 ASSERT_NE(config.size(), 0U);
514
hyewon.eum96b542d2020-12-04 12:09:17 +0900515 ASSERT_TRUE(openSession());
516
517 ProgramSelector sel = {};
Jan Kowalddef7912021-05-31 16:48:19 +0200518 uint64_t freq = config[config.size() / 2].frequency;
hyewon.eum96b542d2020-12-04 12:09:17 +0900519 sel.primaryId = make_identifier(IdentifierType::DAB_FREQUENCY,freq);
520
521 std::this_thread::sleep_for(gTuneWorkaround);
522
523 // try tuning
524 ProgramInfo infoCb = {};
525 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_,
526 InfoHasId(utils::make_identifier(IdentifierType::DAB_FREQUENCY, freq)))
527 .Times(AnyNumber())
528 .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void()))));
529 auto result = mSession->tune(sel);
530
531 // expect a failure if it's not supported
532 if (!utils::isSupported(mProperties, sel)) {
533 EXPECT_EQ(Result::NOT_SUPPORTED, result);
534 return;
535 }
536
537 // expect a callback if it succeeds
538 EXPECT_EQ(Result::OK, result);
539 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
540
541 LOG(DEBUG) << "current program info: " << toString(infoCb);
542
543 // it should tune exactly to what was requested
544 auto freqs = utils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY);
545 EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq));
546}
547
548/**
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800549 * Test tuning with empty program selector.
550 *
551 * Verifies that:
552 * - tune fails with NOT_SUPPORTED when program selector is not initialized.
553 */
Dan Shi27506e62019-12-12 10:54:49 -0800554TEST_P(BroadcastRadioHalTest, TuneFailsWithEmpty) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800555 ASSERT_TRUE(openSession());
556
557 // Program type is 1-based, so 0 will always be invalid.
558 ProgramSelector sel = {};
559 auto result = mSession->tune(sel);
560 ASSERT_EQ(Result::NOT_SUPPORTED, result);
561}
562
563/**
Tomasz Wasilczykb557e0b2018-06-05 10:10:39 -0700564 * Test seeking to next/prev station via ITunerSession::scan().
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800565 *
566 * Verifies that:
567 * - the method succeeds;
568 * - the program info is changed within timeout::tune;
569 * - works both directions and with or without skipping sub-channel.
570 */
Dan Shi27506e62019-12-12 10:54:49 -0800571TEST_P(BroadcastRadioHalTest, Seek) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800572 ASSERT_TRUE(openSession());
573
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800574 // TODO(b/69958777): see FmTune workaround
Tomasz Wasilczyk55241f72018-04-30 08:53:24 -0700575 std::this_thread::sleep_for(gTuneWorkaround);
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800576
Tomasz Wasilczykaf898822018-12-03 13:15:50 -0800577 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800578 auto result = mSession->scan(true /* up */, true /* skip subchannel */);
hyewon.eum96b542d2020-12-04 12:09:17 +0900579
580 if (result == Result::NOT_SUPPORTED) {
581 printSkipped("seek not supported");
582 return;
583 }
584
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800585 EXPECT_EQ(Result::OK, result);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800586 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800587
Tomasz Wasilczykaf898822018-12-03 13:15:50 -0800588 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800589 result = mSession->scan(false /* down */, false /* don't skip subchannel */);
590 EXPECT_EQ(Result::OK, result);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800591 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800592}
593
594/**
595 * Test step operation.
596 *
597 * Verifies that:
598 * - the method succeeds or returns NOT_SUPPORTED;
599 * - the program info is changed within timeout::tune if the method succeeded;
600 * - works both directions.
601 */
Dan Shi27506e62019-12-12 10:54:49 -0800602TEST_P(BroadcastRadioHalTest, Step) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800603 ASSERT_TRUE(openSession());
604
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800605 // TODO(b/69958777): see FmTune workaround
Tomasz Wasilczyk55241f72018-04-30 08:53:24 -0700606 std::this_thread::sleep_for(gTuneWorkaround);
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800607
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800608 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800609 auto result = mSession->step(true /* up */);
Tomasz Wasilczykdb902862018-01-14 17:22:03 -0800610 if (result == Result::NOT_SUPPORTED) {
611 printSkipped("step not supported");
612 return;
613 }
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800614 EXPECT_EQ(Result::OK, result);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800615 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800616
Tomasz Wasilczykaf898822018-12-03 13:15:50 -0800617 EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800618 result = mSession->step(false /* down */);
619 EXPECT_EQ(Result::OK, result);
Tomasz Wasilczyk67360522018-02-10 14:05:18 -0800620 EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800621}
622
623/**
624 * Test tune cancellation.
625 *
626 * Verifies that:
627 * - the method does not crash after being invoked multiple times.
628 */
Dan Shi27506e62019-12-12 10:54:49 -0800629TEST_P(BroadcastRadioHalTest, Cancel) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800630 ASSERT_TRUE(openSession());
631
632 for (int i = 0; i < 10; i++) {
Tomasz Wasilczykb557e0b2018-06-05 10:10:39 -0700633 auto result = mSession->scan(true /* up */, true /* skip subchannel */);
hyewon.eum96b542d2020-12-04 12:09:17 +0900634
635 if (result == Result::NOT_SUPPORTED) {
636 printSkipped("cancel is skipped because of seek not supported");
637 return;
638 }
639
Tomasz Wasilczykb557e0b2018-06-05 10:10:39 -0700640 ASSERT_EQ(Result::OK, result);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800641
642 auto cancelResult = mSession->cancel();
643 ASSERT_TRUE(cancelResult.isOk());
644 }
645}
646
647/**
648 * Test IBroadcastRadio::get|setParameters() methods called with no parameters.
649 *
650 * Verifies that:
651 * - callback is called for empty parameters set.
652 */
Dan Shi27506e62019-12-12 10:54:49 -0800653TEST_P(BroadcastRadioHalTest, NoParameters) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800654 ASSERT_TRUE(openSession());
655
656 hidl_vec<VendorKeyValue> halResults = {};
657 bool wasCalled = false;
658 auto cb = [&](hidl_vec<VendorKeyValue> results) {
659 wasCalled = true;
660 halResults = results;
661 };
662
663 auto hidlResult = mSession->setParameters({}, cb);
664 ASSERT_TRUE(hidlResult.isOk());
665 ASSERT_TRUE(wasCalled);
666 ASSERT_EQ(0u, halResults.size());
667
668 wasCalled = false;
669 hidlResult = mSession->getParameters({}, cb);
670 ASSERT_TRUE(hidlResult.isOk());
671 ASSERT_TRUE(wasCalled);
672 ASSERT_EQ(0u, halResults.size());
673}
674
675/**
676 * Test IBroadcastRadio::get|setParameters() methods called with unknown parameters.
677 *
678 * Verifies that:
679 * - unknown parameters are ignored;
680 * - callback is called also for empty results set.
681 */
Dan Shi27506e62019-12-12 10:54:49 -0800682TEST_P(BroadcastRadioHalTest, UnknownParameters) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800683 ASSERT_TRUE(openSession());
684
685 hidl_vec<VendorKeyValue> halResults = {};
686 bool wasCalled = false;
687 auto cb = [&](hidl_vec<VendorKeyValue> results) {
688 wasCalled = true;
689 halResults = results;
690 };
691
692 auto hidlResult = mSession->setParameters({{"com.google.unknown", "dummy"}}, cb);
693 ASSERT_TRUE(hidlResult.isOk());
694 ASSERT_TRUE(wasCalled);
695 ASSERT_EQ(0u, halResults.size());
696
697 wasCalled = false;
698 hidlResult = mSession->getParameters({{"com.google.unknown*", "dummy"}}, cb);
699 ASSERT_TRUE(hidlResult.isOk());
700 ASSERT_TRUE(wasCalled);
701 ASSERT_EQ(0u, halResults.size());
702}
703
704/**
705 * Test session closing.
706 *
707 * Verifies that:
708 * - the method does not crash after being invoked multiple times.
709 */
Dan Shi27506e62019-12-12 10:54:49 -0800710TEST_P(BroadcastRadioHalTest, Close) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800711 ASSERT_TRUE(openSession());
712
713 for (int i = 0; i < 10; i++) {
714 auto cancelResult = mSession->close();
715 ASSERT_TRUE(cancelResult.isOk());
716 }
717}
718
719/**
720 * Test geting image of invalid ID.
721 *
722 * Verifies that:
723 * - getImage call handles argument 0 gracefully.
724 */
Dan Shi27506e62019-12-12 10:54:49 -0800725TEST_P(BroadcastRadioHalTest, GetNoImage) {
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800726 size_t len = 0;
727 auto result = mModule->getImage(0, [&](hidl_vec<uint8_t> rawImage) { len = rawImage.size(); });
728
729 ASSERT_TRUE(result.isOk());
730 ASSERT_EQ(0u, len);
731}
732
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800733/**
734 * Test getting config flags.
735 *
736 * Verifies that:
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800737 * - isConfigFlagSet either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800738 * - call success or failure is consistent with setConfigFlag.
739 */
Dan Shi27506e62019-12-12 10:54:49 -0800740TEST_P(BroadcastRadioHalTest, FetchConfigFlags) {
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800741 ASSERT_TRUE(openSession());
742
743 for (auto flag : gConfigFlagValues) {
744 auto halResult = Result::UNKNOWN_ERROR;
745 auto cb = [&](Result result, bool) { halResult = result; };
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800746 auto hidlResult = mSession->isConfigFlagSet(flag, cb);
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800747 EXPECT_TRUE(hidlResult.isOk());
748
749 if (halResult != Result::NOT_SUPPORTED && halResult != Result::INVALID_STATE) {
750 ASSERT_EQ(Result::OK, halResult);
751 }
752
753 // set must fail or succeed the same way as get
754 auto setResult = mSession->setConfigFlag(flag, false);
755 EXPECT_EQ(halResult, setResult);
756 setResult = mSession->setConfigFlag(flag, true);
757 EXPECT_EQ(halResult, setResult);
758 }
759}
760
761/**
762 * Test setting config flags.
763 *
764 * Verifies that:
765 * - setConfigFlag either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800766 * - isConfigFlagSet reflects the state requested immediately after the set call.
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800767 */
Dan Shi27506e62019-12-12 10:54:49 -0800768TEST_P(BroadcastRadioHalTest, SetConfigFlags) {
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800769 ASSERT_TRUE(openSession());
770
771 auto get = [&](ConfigFlag flag) {
772 auto halResult = Result::UNKNOWN_ERROR;
773 bool gotValue = false;
774 auto cb = [&](Result result, bool value) {
775 halResult = result;
776 gotValue = value;
777 };
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800778 auto hidlResult = mSession->isConfigFlagSet(flag, cb);
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800779 EXPECT_TRUE(hidlResult.isOk());
780 EXPECT_EQ(Result::OK, halResult);
781 return gotValue;
782 };
783
784 for (auto flag : gConfigFlagValues) {
785 auto result = mSession->setConfigFlag(flag, false);
786 if (result == Result::NOT_SUPPORTED || result == Result::INVALID_STATE) {
787 // setting to true must result in the same error as false
788 auto secondResult = mSession->setConfigFlag(flag, true);
789 EXPECT_EQ(result, secondResult);
790 continue;
791 }
792 ASSERT_EQ(Result::OK, result);
793
794 // verify false is set
795 auto value = get(flag);
796 EXPECT_FALSE(value);
797
798 // try setting true this time
799 result = mSession->setConfigFlag(flag, true);
800 ASSERT_EQ(Result::OK, result);
801 value = get(flag);
802 EXPECT_TRUE(value);
803
804 // false again
805 result = mSession->setConfigFlag(flag, false);
806 ASSERT_EQ(Result::OK, result);
807 value = get(flag);
808 EXPECT_FALSE(value);
809 }
810}
811
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800812/**
813 * Test getting program list.
814 *
815 * Verifies that:
816 * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
817 * - the complete list is fetched within timeout::programListScan;
818 * - stopProgramListUpdates does not crash.
819 */
Dan Shi27506e62019-12-12 10:54:49 -0800820TEST_P(BroadcastRadioHalTest, GetProgramList) {
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800821 ASSERT_TRUE(openSession());
822
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800823 getProgramList();
824}
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800825
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800826/**
827 * Test HD_STATION_NAME correctness.
828 *
829 * Verifies that if a program on the list contains HD_STATION_NAME identifier:
830 * - the program provides station name in its metadata;
831 * - the identifier matches the name;
832 * - there is only one identifier of that type.
833 */
Dan Shi27506e62019-12-12 10:54:49 -0800834TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) {
Tomasz Wasilczykc71624f2017-12-22 10:54:34 -0800835 ASSERT_TRUE(openSession());
836
837 auto list = getProgramList();
838 if (!list) return;
839
840 for (auto&& program : *list) {
841 auto nameIds = utils::getAllIds(program.selector, IdentifierType::HD_STATION_NAME);
842 EXPECT_LE(nameIds.size(), 1u);
843 if (nameIds.size() == 0) continue;
844
845 auto name = utils::getMetadataString(program, MetadataKey::PROGRAM_NAME);
846 if (!name) name = utils::getMetadataString(program, MetadataKey::RDS_PS);
847 ASSERT_TRUE(name.has_value());
848
849 auto expectedId = utils::make_hdradio_station_name(*name);
850 EXPECT_EQ(expectedId.value, nameIds[0]);
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800851 }
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -0800852}
853
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800854/**
Tomasz Wasilczyk0d5ef5d2018-01-10 10:58:20 -0800855 * Test announcement listener registration.
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800856 *
857 * Verifies that:
Tomasz Wasilczyk0d5ef5d2018-01-10 10:58:20 -0800858 * - registerAnnouncementListener either succeeds or returns NOT_SUPPORTED;
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800859 * - if it succeeds, it returns a valid close handle (which is a nullptr otherwise);
860 * - closing handle does not crash.
861 */
Dan Shi27506e62019-12-12 10:54:49 -0800862TEST_P(BroadcastRadioHalTest, AnnouncementListenerRegistration) {
Tomasz Wasilczyk0d5ef5d2018-01-10 10:58:20 -0800863 sp<AnnouncementListenerMock> listener = new AnnouncementListenerMock();
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800864
865 Result halResult = Result::UNKNOWN_ERROR;
866 sp<ICloseHandle> closeHandle = nullptr;
867 auto cb = [&](Result result, const sp<ICloseHandle>& closeHandle_) {
868 halResult = result;
869 closeHandle = closeHandle_;
870 };
871
872 auto hidlResult =
Tomasz Wasilczyk0d5ef5d2018-01-10 10:58:20 -0800873 mModule->registerAnnouncementListener({AnnouncementType::EMERGENCY}, listener, cb);
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800874 ASSERT_TRUE(hidlResult.isOk());
875
876 if (halResult == Result::NOT_SUPPORTED) {
877 ASSERT_EQ(nullptr, closeHandle.get());
878 printSkipped("Announcements not supported");
879 return;
880 }
881
882 ASSERT_EQ(Result::OK, halResult);
883 ASSERT_NE(nullptr, closeHandle.get());
884
885 closeHandle->close();
886}
887
Dan Shiba4d5322020-07-28 13:09:30 -0700888GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BroadcastRadioHalTest);
Dan Shi27506e62019-12-12 10:54:49 -0800889INSTANTIATE_TEST_SUITE_P(
890 PerInstance, BroadcastRadioHalTest,
891 testing::ValuesIn(android::hardware::getAllHalInstanceNames(IBroadcastRadio::descriptor)),
892 android::hardware::PrintInstanceNameToString);
893
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800894} // namespace vts
895} // namespace V2_0
896} // namespace broadcastradio
897} // namespace hardware
898} // namespace android
899
900int main(int argc, char** argv) {
Tomasz Wasilczyk84ec4e12018-11-13 11:26:23 -0800901 android::base::SetDefaultTag("BcRadio.vts");
902 android::base::SetMinimumLogSeverity(android::base::VERBOSE);
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800903 ::testing::InitGoogleTest(&argc, argv);
Tomasz Wasilczyk84ec4e12018-11-13 11:26:23 -0800904 return RUN_ALL_TESTS();
Tomasz Wasilczyk31e86322017-12-05 09:36:11 -0800905}