diff options
author | android-build-team Robot | 2018-04-16 02:21:06 -0500 |
---|---|---|
committer | android-build-team Robot | 2018-04-16 02:21:06 -0500 |
commit | a22e6d9b45f569e54ff1a9f135391579b3cef70a (patch) | |
tree | fbaa7241290673ec46a7864b0b55df58651d70c5 | |
parent | 8474aad58120e73876c8c09dc78552bdcb69f260 (diff) | |
parent | 4524827699df6ca754bbc104b722e506f19afd36 (diff) | |
download | platform-hardware-interfaces-a22e6d9b45f569e54ff1a9f135391579b3cef70a.tar.gz platform-hardware-interfaces-a22e6d9b45f569e54ff1a9f135391579b3cef70a.tar.xz platform-hardware-interfaces-a22e6d9b45f569e54ff1a9f135391579b3cef70a.zip |
Snap for 4723085 from 4524827699df6ca754bbc104b722e506f19afd36 to pi-release
Change-Id: I6a8c46ee10fb431c7db8c5f635c0eddcceaf4698
-rw-r--r-- | wifi/1.2/vts/functional/wifi_sta_iface_hidl_test.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/wifi/1.2/vts/functional/wifi_sta_iface_hidl_test.cpp b/wifi/1.2/vts/functional/wifi_sta_iface_hidl_test.cpp index fd4a671c..92f5d145 100644 --- a/wifi/1.2/vts/functional/wifi_sta_iface_hidl_test.cpp +++ b/wifi/1.2/vts/functional/wifi_sta_iface_hidl_test.cpp | |||
@@ -14,6 +14,9 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <numeric> | ||
18 | #include <vector> | ||
19 | |||
17 | #include <android-base/logging.h> | 20 | #include <android-base/logging.h> |
18 | 21 | ||
19 | #include <android/hardware/wifi/1.2/IWifiStaIface.h> | 22 | #include <android/hardware/wifi/1.2/IWifiStaIface.h> |
@@ -24,8 +27,9 @@ | |||
24 | #include "wifi_hidl_test_utils.h" | 27 | #include "wifi_hidl_test_utils.h" |
25 | 28 | ||
26 | using ::android::sp; | 29 | using ::android::sp; |
27 | using ::android::hardware::wifi::V1_2::IWifiStaIface; | 30 | using ::android::hardware::wifi::V1_0::CommandId; |
28 | using ::android::hardware::wifi::V1_0::WifiStatusCode; | 31 | using ::android::hardware::wifi::V1_0::WifiStatusCode; |
32 | using ::android::hardware::wifi::V1_2::IWifiStaIface; | ||
29 | 33 | ||
30 | /** | 34 | /** |
31 | * Fixture to use for all STA Iface HIDL interface tests. | 35 | * Fixture to use for all STA Iface HIDL interface tests. |
@@ -40,6 +44,13 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { | |||
40 | virtual void TearDown() override { stopWifi(); } | 44 | virtual void TearDown() override { stopWifi(); } |
41 | 45 | ||
42 | protected: | 46 | protected: |
47 | bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask cap_mask) { | ||
48 | const auto& status_and_caps = | ||
49 | HIDL_INVOKE(wifi_sta_iface_, getCapabilities); | ||
50 | EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); | ||
51 | return (status_and_caps.second & cap_mask) != 0; | ||
52 | } | ||
53 | |||
43 | sp<IWifiStaIface> wifi_sta_iface_; | 54 | sp<IWifiStaIface> wifi_sta_iface_; |
44 | }; | 55 | }; |
45 | 56 | ||
@@ -54,3 +65,45 @@ TEST_F(WifiStaIfaceHidlTest, SetMacAddress) { | |||
54 | EXPECT_EQ(WifiStatusCode::SUCCESS, | 65 | EXPECT_EQ(WifiStatusCode::SUCCESS, |
55 | HIDL_INVOKE(wifi_sta_iface_, setMacAddress, kMac).code); | 66 | HIDL_INVOKE(wifi_sta_iface_, setMacAddress, kMac).code); |
56 | } | 67 | } |
68 | |||
69 | /* | ||
70 | * ReadApfPacketFilterData: | ||
71 | * Ensures that we can read the APF working memory when supported. | ||
72 | * | ||
73 | * TODO: Test disabled because we can't even test reading and writing the APF | ||
74 | * memory while the interface is in disconnected state (b/73804303#comment25). | ||
75 | * There's a pending bug on VTS infra to add such support (b/32974062). | ||
76 | * TODO: We can't execute APF opcodes from this test because there's no way | ||
77 | * to loop test packets through the wifi firmware (b/73804303#comment29). | ||
78 | */ | ||
79 | TEST_F(WifiStaIfaceHidlTest, DISABLED_ReadApfPacketFilterData) { | ||
80 | if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) { | ||
81 | // Disable test if APF packet filer is not supported. | ||
82 | LOG(WARNING) << "TEST SKIPPED: APF packet filtering not supported"; | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | const auto& status_and_caps = | ||
87 | HIDL_INVOKE(wifi_sta_iface_, getApfPacketFilterCapabilities); | ||
88 | EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); | ||
89 | LOG(WARNING) << "StaApfPacketFilterCapabilities: version=" | ||
90 | << status_and_caps.second.version | ||
91 | << " maxLength=" << status_and_caps.second.maxLength; | ||
92 | |||
93 | const CommandId kCmd = 0; // Matches what WifiVendorHal.java uses. | ||
94 | const uint32_t kDataSize = | ||
95 | std::min(status_and_caps.second.maxLength, static_cast<uint32_t>(500)); | ||
96 | |||
97 | // Create a buffer and fill it with some values. | ||
98 | std::vector<uint8_t> data(kDataSize); | ||
99 | std::iota(data.begin(), data.end(), 0); | ||
100 | |||
101 | EXPECT_EQ( | ||
102 | HIDL_INVOKE(wifi_sta_iface_, installApfPacketFilter, kCmd, data).code, | ||
103 | WifiStatusCode::SUCCESS); | ||
104 | const auto& status_and_data = | ||
105 | HIDL_INVOKE(wifi_sta_iface_, readApfPacketFilterData); | ||
106 | EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_data.first.code); | ||
107 | |||
108 | EXPECT_EQ(status_and_data.second, data); | ||
109 | } | ||