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 #include <android-base/logging.h>
18
19 #include <VtsHalHidlTargetTestBase.h>
20
21 #include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
22
23 #include "supplicant_hidl_call_util.h"
24 #include "supplicant_hidl_test_utils.h"
25
26 using ::android::sp;
27 using ::android::hardware::hidl_array;
28 using ::android::hardware::hidl_string;
29 using ::android::hardware::hidl_vec;
30 using ::android::hardware::Return;
31 using ::android::hardware::Void;
32 using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
33 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
34 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIfaceCallback;
35 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
36 using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
37 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
38 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
39
40 namespace {
41 constexpr uint8_t kTestMacAddr[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
42 constexpr ISupplicantStaIface::AnqpInfoId kTestAnqpInfoIds[] = {
43 ISupplicantStaIface::AnqpInfoId::VENUE_NAME,
44 ISupplicantStaIface::AnqpInfoId::NAI_REALM,
45 ISupplicantStaIface::AnqpInfoId::DOMAIN_NAME};
46 constexpr ISupplicantStaIface::Hs20AnqpSubtypes kTestHs20Types[] = {
47 ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS,
48 ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME};
49 constexpr char kTestHs20IconFile[] = "TestFile";
50 constexpr char kTestWpsDeviceName[] = "TestWpsDeviceName";
51 constexpr char kTestWpsManufacturer[] = "TestManufacturer";
52 constexpr char kTestWpsModelName[] = "TestModelName";
53 constexpr char kTestWpsModelNumber[] = "TestModelNumber";
54 constexpr char kTestWpsSerialNumber[] = "TestSerialNumber";
55 constexpr char kTestRadioWorkName[] = "TestRadioWork";
56 constexpr uint32_t kTestRadioWorkFrequency = 2412;
57 constexpr uint32_t kTestRadioWorkTimeout = 8;
58 constexpr uint32_t kTestRadioWorkId = 16;
59 constexpr int8_t kTestCountryCode[] = {'U', 'S'};
60 constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01};
61 constexpr uint16_t kTestWpsConfigMethods = 0xffff;
62 } // namespace
63
64 class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
65 public:
SetUp()66 virtual void SetUp() override {
67 startSupplicantAndWaitForHidlService();
68 EXPECT_TRUE(turnOnExcessiveLogging());
69 sta_iface_ = getSupplicantStaIface();
70 ASSERT_NE(sta_iface_.get(), nullptr);
71
72 memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
73 }
74
TearDown()75 virtual void TearDown() override { stopSupplicant(); }
76
77 protected:
78 // ISupplicantStaIface object used for all tests in this fixture.
79 sp<ISupplicantStaIface> sta_iface_;
80 // MAC address to use for various tests.
81 std::array<uint8_t, 6> mac_addr_;
82 };
83
84 class IfaceCallback : public ISupplicantStaIfaceCallback {
onNetworkAdded(uint32_t)85 Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); }
onNetworkRemoved(uint32_t)86 Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); }
onStateChanged(ISupplicantStaIfaceCallback::State,const hidl_array<uint8_t,6> &,uint32_t,const hidl_vec<uint8_t> &)87 Return<void> onStateChanged(
88 ISupplicantStaIfaceCallback::State /* newState */,
89 const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */,
90 const hidl_vec<uint8_t>& /* ssid */) override {
91 return Void();
92 }
onAnqpQueryDone(const hidl_array<uint8_t,6> &,const ISupplicantStaIfaceCallback::AnqpData &,const ISupplicantStaIfaceCallback::Hs20AnqpData &)93 Return<void> onAnqpQueryDone(
94 const hidl_array<uint8_t, 6>& /* bssid */,
95 const ISupplicantStaIfaceCallback::AnqpData& /* data */,
96 const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */)
97 override {
98 return Void();
99 }
onHs20IconQueryDone(const hidl_array<uint8_t,6> &,const hidl_string &,const hidl_vec<uint8_t> &)100 virtual Return<void> onHs20IconQueryDone(
101 const hidl_array<uint8_t, 6>& /* bssid */,
102 const hidl_string& /* fileName */,
103 const hidl_vec<uint8_t>& /* data */) override {
104 return Void();
105 }
onHs20SubscriptionRemediation(const hidl_array<uint8_t,6> &,ISupplicantStaIfaceCallback::OsuMethod,const hidl_string &)106 virtual Return<void> onHs20SubscriptionRemediation(
107 const hidl_array<uint8_t, 6>& /* bssid */,
108 ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */,
109 const hidl_string& /* url*/) override {
110 return Void();
111 }
onHs20DeauthImminentNotice(const hidl_array<uint8_t,6> &,uint32_t,uint32_t,const hidl_string &)112 Return<void> onHs20DeauthImminentNotice(
113 const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* reasonCode */,
114 uint32_t /* reAuthDelayInSec */,
115 const hidl_string& /* url */) override {
116 return Void();
117 }
onDisconnected(const hidl_array<uint8_t,6> &,bool,ISupplicantStaIfaceCallback::ReasonCode)118 Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */,
119 bool /* locallyGenerated */,
120 ISupplicantStaIfaceCallback::ReasonCode
121 /* reasonCode */) override {
122 return Void();
123 }
onAssociationRejected(const hidl_array<uint8_t,6> &,ISupplicantStaIfaceCallback::StatusCode,bool)124 Return<void> onAssociationRejected(
125 const hidl_array<uint8_t, 6>& /* bssid */,
126 ISupplicantStaIfaceCallback::StatusCode /* statusCode */,
127 bool /*timedOut */) override {
128 return Void();
129 }
onAuthenticationTimeout(const hidl_array<uint8_t,6> &)130 Return<void> onAuthenticationTimeout(
131 const hidl_array<uint8_t, 6>& /* bssid */) override {
132 return Void();
133 }
onBssidChanged(ISupplicantStaIfaceCallback::BssidChangeReason,const hidl_array<uint8_t,6> &)134 Return<void> onBssidChanged(
135 ISupplicantStaIfaceCallback::BssidChangeReason /* reason */,
136 const hidl_array<uint8_t, 6>& /* bssid */) override {
137 return Void();
138 }
onEapFailure()139 Return<void> onEapFailure() override { return Void(); }
onWpsEventSuccess()140 Return<void> onWpsEventSuccess() override { return Void(); }
onWpsEventFail(const hidl_array<uint8_t,6> &,ISupplicantStaIfaceCallback::WpsConfigError,ISupplicantStaIfaceCallback::WpsErrorIndication)141 Return<void> onWpsEventFail(
142 const hidl_array<uint8_t, 6>& /* bssid */,
143 ISupplicantStaIfaceCallback::WpsConfigError /* configError */,
144 ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */)
145 override {
146 return Void();
147 }
onWpsEventPbcOverlap()148 Return<void> onWpsEventPbcOverlap() override { return Void(); }
onExtRadioWorkStart(uint32_t)149 Return<void> onExtRadioWorkStart(uint32_t /* id */) override {
150 return Void();
151 }
onExtRadioWorkTimeout(uint32_t)152 Return<void> onExtRadioWorkTimeout(uint32_t /* id*/) override {
153 return Void();
154 }
155 };
156
157 /*
158 * Create:
159 * Ensures that an instance of the ISupplicantStaIface proxy object is
160 * successfully created.
161 */
TEST(SupplicantStaIfaceHidlTestNoFixture,Create)162 TEST(SupplicantStaIfaceHidlTestNoFixture, Create) {
163 startSupplicantAndWaitForHidlService();
164 EXPECT_NE(nullptr, getSupplicantStaIface().get());
165 stopSupplicant();
166 }
167
168 /*
169 * RegisterCallback
170 */
TEST_F(SupplicantStaIfaceHidlTest,RegisterCallback)171 TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback) {
172 sta_iface_->registerCallback(
173 new IfaceCallback(), [](const SupplicantStatus& status) {
174 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
175 });
176 }
177
178 /*
179 * GetName
180 */
TEST_F(SupplicantStaIfaceHidlTest,GetName)181 TEST_F(SupplicantStaIfaceHidlTest, GetName) {
182 const auto& status_and_interface_name = HIDL_INVOKE(sta_iface_, getName);
183 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
184 status_and_interface_name.first.code);
185 EXPECT_FALSE(std::string(status_and_interface_name.second).empty());
186 }
187
188 /*
189 * GetType
190 */
TEST_F(SupplicantStaIfaceHidlTest,GetType)191 TEST_F(SupplicantStaIfaceHidlTest, GetType) {
192 const auto& status_and_interface_type = HIDL_INVOKE(sta_iface_, getType);
193 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
194 status_and_interface_type.first.code);
195 EXPECT_EQ(status_and_interface_type.second, IfaceType::STA);
196 }
197
198 /*
199 * listNetworks.
200 */
TEST_F(SupplicantStaIfaceHidlTest,listNetworks)201 TEST_F(SupplicantStaIfaceHidlTest, listNetworks) {
202 sta_iface_->listNetworks([](const SupplicantStatus& status,
203 const hidl_vec<SupplicantNetworkId>& ids) {
204 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
205 EXPECT_EQ(0u, ids.size());
206 });
207
208 sp<ISupplicantStaNetwork> sta_network = createSupplicantStaNetwork();
209 EXPECT_NE(nullptr, sta_network.get());
210
211 sta_iface_->listNetworks([](const SupplicantStatus& status,
212 const hidl_vec<SupplicantNetworkId>& ids) {
213 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
214 EXPECT_LT(0u, ids.size());
215 });
216 }
217
218 /*
219 * Reassociate.
220 */
TEST_F(SupplicantStaIfaceHidlTest,Reassociate)221 TEST_F(SupplicantStaIfaceHidlTest, Reassociate) {
222 sta_iface_->reassociate([](const SupplicantStatus& status) {
223 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
224 });
225 }
226
227 /*
228 * Reconnect.
229 */
TEST_F(SupplicantStaIfaceHidlTest,Reconnect)230 TEST_F(SupplicantStaIfaceHidlTest, Reconnect) {
231 sta_iface_->reconnect([](const SupplicantStatus& status) {
232 EXPECT_EQ(SupplicantStatusCode::FAILURE_IFACE_NOT_DISCONNECTED,
233 status.code);
234 });
235 }
236
237 /*
238 * Disconnect.
239 */
TEST_F(SupplicantStaIfaceHidlTest,Disconnect)240 TEST_F(SupplicantStaIfaceHidlTest, Disconnect) {
241 sta_iface_->disconnect([](const SupplicantStatus& status) {
242 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
243 });
244 }
245
246 /*
247 * SetPowerSave.
248 */
TEST_F(SupplicantStaIfaceHidlTest,SetPowerSave)249 TEST_F(SupplicantStaIfaceHidlTest, SetPowerSave) {
250 sta_iface_->setPowerSave(true, [](const SupplicantStatus& status) {
251 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
252 });
253 sta_iface_->setPowerSave(false, [](const SupplicantStatus& status) {
254 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
255 });
256 }
257
258 /*
259 * InitiateTdlsDiscover.
260 */
TEST_F(SupplicantStaIfaceHidlTest,InitiateTdlsDiscover)261 TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsDiscover) {
262 sta_iface_->initiateTdlsDiscover(
263 mac_addr_, [](const SupplicantStatus& status) {
264 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
265 });
266 }
267
268 /*
269 * InitiateTdlsSetup.
270 */
TEST_F(SupplicantStaIfaceHidlTest,InitiateTdlsSetup)271 TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsSetup) {
272 sta_iface_->initiateTdlsSetup(
273 mac_addr_, [](const SupplicantStatus& status) {
274 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
275 });
276 }
277
278 /*
279 * InitiateTdlsTeardown.
280 */
TEST_F(SupplicantStaIfaceHidlTest,InitiateTdlsTeardown)281 TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsTeardown) {
282 sta_iface_->initiateTdlsTeardown(
283 mac_addr_, [](const SupplicantStatus& status) {
284 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
285 });
286 }
287
288 /*
289 * InitiateAnqpQuery.
290 */
TEST_F(SupplicantStaIfaceHidlTest,InitiateAnqpQuery)291 TEST_F(SupplicantStaIfaceHidlTest, InitiateAnqpQuery) {
292 std::vector<ISupplicantStaIface::AnqpInfoId> anqp_ids(
293 kTestAnqpInfoIds, kTestAnqpInfoIds + sizeof(kTestAnqpInfoIds));
294 std::vector<ISupplicantStaIface::Hs20AnqpSubtypes> hs_types(
295 kTestHs20Types, kTestHs20Types + sizeof(kTestHs20Types));
296 sta_iface_->initiateAnqpQuery(
297 mac_addr_, anqp_ids, hs_types, [](const SupplicantStatus& status) {
298 // These requests will fail unless the BSSID mentioned is actually
299 // present in scan results.
300 EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
301 });
302 }
303
304 /*
305 * InitiateHs20IconQuery.
306 */
TEST_F(SupplicantStaIfaceHidlTest,InitiateHs20IconQuery)307 TEST_F(SupplicantStaIfaceHidlTest, InitiateHs20IconQuery) {
308 sta_iface_->initiateHs20IconQuery(
309 mac_addr_, kTestHs20IconFile, [](const SupplicantStatus& status) {
310 // These requests will fail unless the BSSID mentioned is actually
311 // present in scan results.
312 EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
313 });
314 }
315
316 /*
317 * GetMacAddress.
318 */
TEST_F(SupplicantStaIfaceHidlTest,GetMacAddress)319 TEST_F(SupplicantStaIfaceHidlTest, GetMacAddress) {
320 sta_iface_->getMacAddress([](const SupplicantStatus& status,
321 const hidl_array<uint8_t, 6>& mac_addr) {
322 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
323 std::array<uint8_t, 6> std_mac_addr(mac_addr);
324 EXPECT_GT(6, std::count(std_mac_addr.begin(), std_mac_addr.end(), 0));
325 });
326 }
327
328 /*
329 * StartRxFilter.
330 */
TEST_F(SupplicantStaIfaceHidlTest,StartRxFilter)331 TEST_F(SupplicantStaIfaceHidlTest, StartRxFilter) {
332 sta_iface_->startRxFilter([](const SupplicantStatus& status) {
333 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
334 });
335 }
336
337 /*
338 * StopRxFilter.
339 */
TEST_F(SupplicantStaIfaceHidlTest,StopRxFilter)340 TEST_F(SupplicantStaIfaceHidlTest, StopRxFilter) {
341 sta_iface_->stopRxFilter([](const SupplicantStatus& status) {
342 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
343 });
344 }
345
346 /*
347 * AddRxFilter.
348 */
TEST_F(SupplicantStaIfaceHidlTest,AddRxFilter)349 TEST_F(SupplicantStaIfaceHidlTest, AddRxFilter) {
350 sta_iface_->addRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
351 [](const SupplicantStatus& status) {
352 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
353 status.code);
354 });
355 sta_iface_->addRxFilter(ISupplicantStaIface::RxFilterType::V6_MULTICAST,
356 [](const SupplicantStatus& status) {
357 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
358 status.code);
359 });
360 }
361
362 /*
363 * RemoveRxFilter.
364 */
TEST_F(SupplicantStaIfaceHidlTest,RemoveRxFilter)365 TEST_F(SupplicantStaIfaceHidlTest, RemoveRxFilter) {
366 sta_iface_->removeRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
367 [](const SupplicantStatus& status) {
368 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
369 status.code);
370 });
371 sta_iface_->removeRxFilter(ISupplicantStaIface::RxFilterType::V6_MULTICAST,
372 [](const SupplicantStatus& status) {
373 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
374 status.code);
375 });
376 }
377
378 /*
379 * SetBtCoexistenceMode.
380 */
TEST_F(SupplicantStaIfaceHidlTest,SetBtCoexistenceMode)381 TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceMode) {
382 sta_iface_->setBtCoexistenceMode(
383 ISupplicantStaIface::BtCoexistenceMode::ENABLED,
384 [](const SupplicantStatus& status) {
385 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
386 });
387 sta_iface_->setBtCoexistenceMode(
388 ISupplicantStaIface::BtCoexistenceMode::DISABLED,
389 [](const SupplicantStatus& status) {
390 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
391 });
392 sta_iface_->setBtCoexistenceMode(
393 ISupplicantStaIface::BtCoexistenceMode::SENSE,
394 [](const SupplicantStatus& status) {
395 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
396 });
397 }
398
399 /*
400 * SetBtCoexistenceScanModeEnabled.
401 */
TEST_F(SupplicantStaIfaceHidlTest,SetBtCoexistenceScanModeEnabled)402 TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceScanModeEnabled) {
403 sta_iface_->setBtCoexistenceScanModeEnabled(
404 true, [](const SupplicantStatus& status) {
405 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
406 });
407 sta_iface_->setBtCoexistenceScanModeEnabled(
408 false, [](const SupplicantStatus& status) {
409 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
410 });
411 }
412
413 /*
414 * SetSuspendModeEnabled.
415 */
TEST_F(SupplicantStaIfaceHidlTest,SetSuspendModeEnabled)416 TEST_F(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) {
417 sta_iface_->setSuspendModeEnabled(true, [](const SupplicantStatus& status) {
418 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
419 });
420 sta_iface_->setSuspendModeEnabled(
421 false, [](const SupplicantStatus& status) {
422 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
423 });
424 }
425
426 /*
427 * SetCountryCode.
428 */
TEST_F(SupplicantStaIfaceHidlTest,SetCountryCode)429 TEST_F(SupplicantStaIfaceHidlTest, SetCountryCode) {
430 sta_iface_->setCountryCode(
431 kTestCountryCode, [](const SupplicantStatus& status) {
432 EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
433 });
434 }
435
436 /*
437 * SetWpsDeviceName
438 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsDeviceName)439 TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceName) {
440 EXPECT_EQ(
441 SupplicantStatusCode::SUCCESS,
442 HIDL_INVOKE(sta_iface_, setWpsDeviceName, kTestWpsDeviceName).code);
443 }
444
445 /*
446 * SetWpsDeviceType
447 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsDeviceType)448 TEST_F(SupplicantStaIfaceHidlTest, SetWpsDeviceType) {
449 EXPECT_EQ(
450 SupplicantStatusCode::SUCCESS,
451 HIDL_INVOKE(sta_iface_, setWpsDeviceType, kTestWpsDeviceType).code);
452 }
453
454 /*
455 * SetWpsManufacturer
456 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsManufacturer)457 TEST_F(SupplicantStaIfaceHidlTest, SetWpsManufacturer) {
458 EXPECT_EQ(
459 SupplicantStatusCode::SUCCESS,
460 HIDL_INVOKE(sta_iface_, setWpsManufacturer, kTestWpsManufacturer).code);
461 }
462
463 /*
464 * SetWpsModelName
465 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsModelName)466 TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelName) {
467 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
468 HIDL_INVOKE(sta_iface_, setWpsModelName, kTestWpsModelName).code);
469 }
470
471 /*
472 * SetWpsModelNumber
473 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsModelNumber)474 TEST_F(SupplicantStaIfaceHidlTest, SetWpsModelNumber) {
475 EXPECT_EQ(
476 SupplicantStatusCode::SUCCESS,
477 HIDL_INVOKE(sta_iface_, setWpsModelNumber, kTestWpsModelNumber).code);
478 }
479
480 /*
481 * SetWpsSerialNumber
482 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsSerialNumber)483 TEST_F(SupplicantStaIfaceHidlTest, SetWpsSerialNumber) {
484 EXPECT_EQ(
485 SupplicantStatusCode::SUCCESS,
486 HIDL_INVOKE(sta_iface_, setWpsSerialNumber, kTestWpsSerialNumber).code);
487 }
488
489 /*
490 * SetWpsConfigMethods
491 */
TEST_F(SupplicantStaIfaceHidlTest,SetWpsConfigMethods)492 TEST_F(SupplicantStaIfaceHidlTest, SetWpsConfigMethods) {
493 EXPECT_EQ(
494 SupplicantStatusCode::SUCCESS,
495 HIDL_INVOKE(sta_iface_, setWpsConfigMethods, kTestWpsConfigMethods)
496 .code);
497 }
498
499 /*
500 * SetExternalSim
501 */
TEST_F(SupplicantStaIfaceHidlTest,SetExternalSim)502 TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) {
503 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
504 HIDL_INVOKE(sta_iface_, setExternalSim, true).code);
505 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
506 HIDL_INVOKE(sta_iface_, setExternalSim, false).code);
507 }
508
509 /*
510 * AddExtRadioWork
511 */
TEST_F(SupplicantStaIfaceHidlTest,AddExtRadioWork)512 TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) {
513 const auto& status_and_radio_work_id =
514 HIDL_INVOKE(sta_iface_, addExtRadioWork, kTestRadioWorkName,
515 kTestRadioWorkFrequency, kTestRadioWorkTimeout);
516 EXPECT_EQ(SupplicantStatusCode::SUCCESS,
517 status_and_radio_work_id.first.code);
518 // removeExtRadio only succeeds if the added radio work hasn't started yet.
519 // So there this no guaranteed result from calling removeExtRadioWork here.
520 // That being said, currently we are not able to test addExtRadioWork and
521 // removeExtRadioWork in a row.
522 }
523
524 /*
525 * RemoveExtRadioWork
526 */
TEST_F(SupplicantStaIfaceHidlTest,RemoveExtRadioWork)527 TEST_F(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) {
528 // This fails because there is no on going radio work with kTestRadioWorkId.
529 EXPECT_NE(
530 SupplicantStatusCode::SUCCESS,
531 HIDL_INVOKE(sta_iface_, removeExtRadioWork, kTestRadioWorkId).code);
532 }
533