diff options
author | Roshan Pius <rpius@google.com> | 2016-12-16 11:10:01 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-14 10:10:12 -0700 |
commit | 036da68261170345c53c32ed8f59a30d42f1ceb8 (patch) | |
tree | 586eda298ca0dd7817dc260f2f731baa52c569a3 /wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp | |
parent | 2e429d6b644d7aeae5ecd521b3f020ec595ed6dd (diff) |
supplicant(vts): More tests
These tests just invoke the HIDL interface API's and ensure
that they succeed or not. Some of these API's (especially P2P) need
multi device testing (AP, Peer) to ensure that they work.
Bug: 33457575
Test: adb shell /data/supplicant_hidl_test
Change-Id: Ibf547b5ed95895c429c8bcb59e4c43b3b436338f
Diffstat (limited to 'wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp')
-rw-r--r-- | wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp index ab1b6a3e55..c6ac03ce64 100644 --- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp +++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp @@ -18,8 +18,33 @@ #include <VtsHalHidlTargetTestBase.h> +#include <android/hardware/wifi/supplicant/1.0/ISupplicant.h> + #include "supplicant_hidl_test_utils.h" +using ::android::sp; +using ::android::hardware::hidl_vec; +using ::android::hardware::wifi::supplicant::V1_0::ISupplicant; +using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; +using ::android::hardware::wifi::supplicant::V1_0::IfaceType; + +class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase { + public: + virtual void SetUp() override { + startSupplicantAndWaitForHidlService(); + supplicant_ = getSupplicant(); + ASSERT_NE(supplicant_.get(), nullptr); + } + + virtual void TearDown() override { stopSupplicant(); } + + protected: + // ISupplicant object used for all tests in this fixture. + sp<ISupplicant> supplicant_; +}; + /* * Create: * Ensures that an instance of the ISupplicant proxy object is @@ -30,3 +55,131 @@ TEST(SupplicantHidlTestNoFixture, Create) { EXPECT_NE(nullptr, getSupplicant().get()); stopSupplicant(); } + +/* + * ListInterfaces + */ +TEST_F(SupplicantHidlTest, ListInterfaces) { + std::vector<ISupplicant::IfaceInfo> ifaces; + supplicant_->listInterfaces( + [&](const SupplicantStatus& status, + const hidl_vec<ISupplicant::IfaceInfo>& hidl_ifaces) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + ifaces = hidl_ifaces; + }); + + EXPECT_NE(ifaces.end(), + std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { + return iface.type == IfaceType::STA; + })); + EXPECT_NE(ifaces.end(), + std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) { + return iface.type == IfaceType::P2P; + })); +} + +/* + * GetInterface + */ +TEST_F(SupplicantHidlTest, GetInterface) { + std::vector<ISupplicant::IfaceInfo> ifaces; + supplicant_->listInterfaces( + [&](const SupplicantStatus& status, + const hidl_vec<ISupplicant::IfaceInfo>& hidl_ifaces) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + ifaces = hidl_ifaces; + }); + + ASSERT_NE(0u, ifaces.size()); + supplicant_->getInterface( + ifaces[0], + [&](const SupplicantStatus& status, const sp<ISupplicantIface>& iface) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + EXPECT_NE(nullptr, iface.get()); + }); +} + +/* + * SetDebugParams + */ +TEST_F(SupplicantHidlTest, SetDebugParams) { + bool show_timestamp = true; + bool show_keys = true; + ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE; + + supplicant_->setDebugParams(level, + show_timestamp, // show timestamps + show_keys, // show keys + [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + status.code); + }); +} + +/* + * GetDebugLevel + */ +TEST_F(SupplicantHidlTest, GetDebugLevel) { + bool show_timestamp = true; + bool show_keys = true; + ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE; + + supplicant_->setDebugParams(level, + show_timestamp, // show timestamps + show_keys, // show keys + [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + status.code); + }); + EXPECT_EQ(level, supplicant_->getDebugLevel()); +} + +/* + * IsDebugShowTimestampEnabled + */ +TEST_F(SupplicantHidlTest, IsDebugShowTimestampEnabled) { + bool show_timestamp = true; + bool show_keys = true; + ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE; + + supplicant_->setDebugParams(level, + show_timestamp, // show timestamps + show_keys, // show keys + [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + status.code); + }); + EXPECT_EQ(show_timestamp, supplicant_->isDebugShowTimestampEnabled()); +} + +/* + * IsDebugShowKeysEnabled + */ +TEST_F(SupplicantHidlTest, IsDebugShowKeysEnabled) { + bool show_timestamp = true; + bool show_keys = true; + ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE; + + supplicant_->setDebugParams(level, + show_timestamp, // show timestamps + show_keys, // show keys + [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + status.code); + }); + EXPECT_EQ(show_keys, supplicant_->isDebugShowKeysEnabled()); +} + +/* + * SetConcurrenyPriority + */ +TEST_F(SupplicantHidlTest, SetConcurrencyPriority) { + supplicant_->setConcurrencyPriority( + IfaceType::STA, [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + }); + supplicant_->setConcurrencyPriority( + IfaceType::P2P, [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + }); +} |