diff options
author | Ningyuan Wang | 2017-08-01 23:04:08 -0500 |
---|---|---|
committer | android-build-merger | 2017-08-01 23:04:08 -0500 |
commit | 7fcbe884c8b6f3957ef8bbb38335f7cbd408f070 (patch) | |
tree | 1254959f8b5314b182f003b4644104afb2a810a3 | |
parent | af01f9f2cd9f642b77699ea82a753e5d0895b7ac (diff) | |
parent | 2047993daf8798103bec42211c73db08c2481e1b (diff) | |
download | system-connectivity-wificond-7fcbe884c8b6f3957ef8bbb38335f7cbd408f070.tar.gz system-connectivity-wificond-7fcbe884c8b6f3957ef8bbb38335f7cbd408f070.tar.xz system-connectivity-wificond-7fcbe884c8b6f3957ef8bbb38335f7cbd408f070.zip |
Retrieve scan plan capabilities from kernel am: 514a184b8e
am: 2047993daf
Change-Id: I005e6956e54bd1619384b577b50ac0ee98f2a25f
-rw-r--r-- | client_interface_impl.cpp | 6 | ||||
-rw-r--r-- | net/netlink_utils.cpp | 16 | ||||
-rw-r--r-- | net/netlink_utils.h | 18 | ||||
-rw-r--r-- | tests/netlink_utils_unittest.cpp | 219 |
4 files changed, 182 insertions, 77 deletions
diff --git a/client_interface_impl.cpp b/client_interface_impl.cpp index 58edbbb..974ff17 100644 --- a/client_interface_impl.cpp +++ b/client_interface_impl.cpp | |||
@@ -164,6 +164,12 @@ void ClientInterfaceImpl::Dump(std::stringstream* ss) const { | |||
164 | << static_cast<int>(scan_capabilities_.max_num_sched_scan_ssids) << endl; | 164 | << static_cast<int>(scan_capabilities_.max_num_sched_scan_ssids) << endl; |
165 | *ss << "Max number of match sets for scheduled scan: " | 165 | *ss << "Max number of match sets for scheduled scan: " |
166 | << static_cast<int>(scan_capabilities_.max_match_sets) << endl; | 166 | << static_cast<int>(scan_capabilities_.max_match_sets) << endl; |
167 | *ss << "Maximum number of scan plans: " | ||
168 | << scan_capabilities_.max_num_scan_plans << endl; | ||
169 | *ss << "Max scan plan interval in seconds: " | ||
170 | << scan_capabilities_.max_scan_plan_interval << endl; | ||
171 | *ss << "Max scan plan iterations: " | ||
172 | << scan_capabilities_.max_scan_plan_iterations << endl; | ||
167 | *ss << "Device supports random MAC for single shot scan: " | 173 | *ss << "Device supports random MAC for single shot scan: " |
168 | << wiphy_features_.supports_random_mac_oneshot_scan << endl; | 174 | << wiphy_features_.supports_random_mac_oneshot_scan << endl; |
169 | *ss << "Device supports random MAC for scheduled scan: " | 175 | *ss << "Device supports random MAC for scheduled scan: " |
diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp index 0fa0116..18246f7 100644 --- a/net/netlink_utils.cpp +++ b/net/netlink_utils.cpp | |||
@@ -246,6 +246,17 @@ bool NetlinkUtils::ParseScanCapabilities( | |||
246 | return false; | 246 | return false; |
247 | } | 247 | } |
248 | 248 | ||
249 | // Use default value 0 for scan plan capabilities if attributes are missing. | ||
250 | uint32_t max_num_scan_plans = 0; | ||
251 | packet->GetAttributeValue(NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, | ||
252 | &max_num_scan_plans); | ||
253 | uint32_t max_scan_plan_interval = 0; | ||
254 | packet->GetAttributeValue(NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, | ||
255 | &max_scan_plan_interval); | ||
256 | uint32_t max_scan_plan_iterations = 0; | ||
257 | packet->GetAttributeValue(NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, | ||
258 | &max_scan_plan_iterations); | ||
259 | |||
249 | uint8_t max_match_sets; | 260 | uint8_t max_match_sets; |
250 | if (!packet->GetAttributeValue(NL80211_ATTR_MAX_MATCH_SETS, | 261 | if (!packet->GetAttributeValue(NL80211_ATTR_MAX_MATCH_SETS, |
251 | &max_match_sets)) { | 262 | &max_match_sets)) { |
@@ -255,7 +266,10 @@ bool NetlinkUtils::ParseScanCapabilities( | |||
255 | } | 266 | } |
256 | *out_scan_capabilities = ScanCapabilities(max_num_scan_ssids, | 267 | *out_scan_capabilities = ScanCapabilities(max_num_scan_ssids, |
257 | max_num_sched_scan_ssids, | 268 | max_num_sched_scan_ssids, |
258 | max_match_sets); | 269 | max_match_sets, |
270 | max_num_scan_plans, | ||
271 | max_scan_plan_interval, | ||
272 | max_scan_plan_iterations); | ||
259 | return true; | 273 | return true; |
260 | } | 274 | } |
261 | 275 | ||
diff --git a/net/netlink_utils.h b/net/netlink_utils.h index f8b9c0e..f1e43b5 100644 --- a/net/netlink_utils.h +++ b/net/netlink_utils.h | |||
@@ -65,16 +65,30 @@ struct ScanCapabilities { | |||
65 | ScanCapabilities() = default; | 65 | ScanCapabilities() = default; |
66 | ScanCapabilities(uint8_t max_num_scan_ssids_, | 66 | ScanCapabilities(uint8_t max_num_scan_ssids_, |
67 | uint8_t max_num_sched_scan_ssids_, | 67 | uint8_t max_num_sched_scan_ssids_, |
68 | uint8_t max_match_sets_) | 68 | uint8_t max_match_sets_, |
69 | uint32_t max_num_scan_plans_, | ||
70 | uint32_t max_scan_plan_interval_, | ||
71 | uint32_t max_scan_plan_iterations_) | ||
69 | : max_num_scan_ssids(max_num_scan_ssids_), | 72 | : max_num_scan_ssids(max_num_scan_ssids_), |
70 | max_num_sched_scan_ssids(max_num_sched_scan_ssids_), | 73 | max_num_sched_scan_ssids(max_num_sched_scan_ssids_), |
71 | max_match_sets(max_match_sets_) {} | 74 | max_match_sets(max_match_sets_), |
75 | max_num_scan_plans(max_num_scan_plans_), | ||
76 | max_scan_plan_interval(max_scan_plan_interval_), | ||
77 | max_scan_plan_iterations(max_scan_plan_iterations_) {} | ||
72 | // Number of SSIDs you can scan with a single scan request. | 78 | // Number of SSIDs you can scan with a single scan request. |
73 | uint8_t max_num_scan_ssids; | 79 | uint8_t max_num_scan_ssids; |
74 | // Number of SSIDs you can scan with a single scheduled scan request. | 80 | // Number of SSIDs you can scan with a single scheduled scan request. |
75 | uint8_t max_num_sched_scan_ssids; | 81 | uint8_t max_num_sched_scan_ssids; |
76 | // Maximum number of sets that can be used with NL80211_ATTR_SCHED_SCAN_MATCH. | 82 | // Maximum number of sets that can be used with NL80211_ATTR_SCHED_SCAN_MATCH. |
77 | uint8_t max_match_sets; | 83 | uint8_t max_match_sets; |
84 | // Maximum number of scan plans that can be specified. | ||
85 | uint32_t max_num_scan_plans; | ||
86 | // Maximum interval in seconds for a particular scan plan that can be | ||
87 | // specified. | ||
88 | uint32_t max_scan_plan_interval; | ||
89 | // Maximum number of iterations for a particular scan plan that can be | ||
90 | // specified. | ||
91 | uint32_t max_scan_plan_iterations; | ||
78 | }; | 92 | }; |
79 | 93 | ||
80 | struct WiphyFeatures { | 94 | struct WiphyFeatures { |
diff --git a/tests/netlink_utils_unittest.cpp b/tests/netlink_utils_unittest.cpp index b1a7939..646d4a9 100644 --- a/tests/netlink_utils_unittest.cpp +++ b/tests/netlink_utils_unittest.cpp | |||
@@ -42,6 +42,9 @@ namespace { | |||
42 | constexpr uint8_t kFakeMaxNumScanSSIDs = 10; | 42 | constexpr uint8_t kFakeMaxNumScanSSIDs = 10; |
43 | constexpr uint8_t kFakeMaxNumSchedScanSSIDs = 16; | 43 | constexpr uint8_t kFakeMaxNumSchedScanSSIDs = 16; |
44 | constexpr uint8_t kFakeMaxMatchSets = 18; | 44 | constexpr uint8_t kFakeMaxMatchSets = 18; |
45 | constexpr uint8_t kFakeMaxNumScanPlans = 8; | ||
46 | constexpr uint8_t kFakeMaxScanPlanIntervals = 80; | ||
47 | constexpr uint8_t kFakeMaxScanPlanIterations = 10; | ||
45 | constexpr uint16_t kFakeFamilyId = 14; | 48 | constexpr uint16_t kFakeFamilyId = 14; |
46 | constexpr uint32_t kFakeFrequency1 = 2412; | 49 | constexpr uint32_t kFakeFrequency1 = 2412; |
47 | constexpr uint32_t kFakeFrequency2 = 2437; | 50 | constexpr uint32_t kFakeFrequency2 = 2437; |
@@ -80,6 +83,116 @@ NL80211Packet CreateControlMessageAck() { | |||
80 | return CreateControlMessageError(0); | 83 | return CreateControlMessageError(0); |
81 | } | 84 | } |
82 | 85 | ||
86 | void AppendScanCapabilitiesAttributes(NL80211Packet* packet, | ||
87 | bool supports_scan_plan) { | ||
88 | packet->AddAttribute(NL80211Attr<uint8_t>(NL80211_ATTR_MAX_NUM_SCAN_SSIDS, | ||
89 | kFakeMaxNumScanSSIDs)); | ||
90 | packet->AddAttribute(NL80211Attr<uint8_t>( | ||
91 | NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, | ||
92 | kFakeMaxNumSchedScanSSIDs)); | ||
93 | packet->AddAttribute(NL80211Attr<uint8_t>(NL80211_ATTR_MAX_MATCH_SETS, | ||
94 | kFakeMaxMatchSets)); | ||
95 | if (supports_scan_plan) { | ||
96 | packet->AddAttribute(NL80211Attr<uint32_t>( | ||
97 | NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS, | ||
98 | kFakeMaxNumScanPlans)); | ||
99 | packet->AddAttribute(NL80211Attr<uint32_t>( | ||
100 | NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL, | ||
101 | kFakeMaxScanPlanIntervals)); | ||
102 | packet->AddAttribute(NL80211Attr<uint32_t>( | ||
103 | NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, | ||
104 | kFakeMaxScanPlanIterations)); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | void AppendBandInfoAttributes(NL80211Packet* packet) { | ||
109 | NL80211NestedAttr freq_2g_1(1); | ||
110 | NL80211NestedAttr freq_2g_2(2); | ||
111 | NL80211NestedAttr freq_2g_3(3); | ||
112 | NL80211NestedAttr freq_5g_1(4); | ||
113 | NL80211NestedAttr freq_5g_2(5); | ||
114 | NL80211NestedAttr freq_dfs_1(6); | ||
115 | freq_2g_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
116 | kFakeFrequency1)); | ||
117 | freq_2g_2.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
118 | kFakeFrequency2)); | ||
119 | freq_2g_3.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
120 | kFakeFrequency3)); | ||
121 | freq_5g_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
122 | kFakeFrequency4)); | ||
123 | freq_5g_2.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
124 | kFakeFrequency5)); | ||
125 | // DFS frequency. | ||
126 | freq_dfs_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
127 | kFakeFrequency6)); | ||
128 | freq_dfs_1.AddAttribute(NL80211Attr<uint32_t>( | ||
129 | NL80211_FREQUENCY_ATTR_DFS_STATE, | ||
130 | NL80211_DFS_USABLE)); | ||
131 | |||
132 | NL80211NestedAttr band_2g_freqs(NL80211_BAND_ATTR_FREQS); | ||
133 | NL80211NestedAttr band_5g_freqs(NL80211_BAND_ATTR_FREQS); | ||
134 | band_2g_freqs.AddAttribute(freq_2g_1); | ||
135 | band_2g_freqs.AddAttribute(freq_2g_2); | ||
136 | band_2g_freqs.AddAttribute(freq_2g_3); | ||
137 | band_5g_freqs.AddAttribute(freq_5g_1); | ||
138 | band_5g_freqs.AddAttribute(freq_5g_2); | ||
139 | band_5g_freqs.AddAttribute(freq_dfs_1); | ||
140 | |||
141 | NL80211NestedAttr band_2g_attr(1); | ||
142 | NL80211NestedAttr band_5g_attr(2); | ||
143 | band_2g_attr.AddAttribute(band_2g_freqs); | ||
144 | band_5g_attr.AddAttribute(band_5g_freqs); | ||
145 | |||
146 | NL80211NestedAttr band_attr(NL80211_ATTR_WIPHY_BANDS); | ||
147 | band_attr.AddAttribute(band_2g_attr); | ||
148 | band_attr.AddAttribute(band_5g_attr); | ||
149 | |||
150 | packet->AddAttribute(band_attr); | ||
151 | } | ||
152 | |||
153 | void AppendWiphyFeaturesAttributes(NL80211Packet* packet) { | ||
154 | packet->AddAttribute(NL80211Attr<uint32_t>( | ||
155 | NL80211_ATTR_FEATURE_FLAGS, | ||
156 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR)); | ||
157 | } | ||
158 | |||
159 | void VerifyScanCapabilities(const ScanCapabilities& scan_capabilities, | ||
160 | bool supports_scan_plan) { | ||
161 | EXPECT_EQ(scan_capabilities.max_num_scan_ssids, | ||
162 | kFakeMaxNumScanSSIDs); | ||
163 | EXPECT_EQ(scan_capabilities.max_num_sched_scan_ssids, | ||
164 | kFakeMaxNumSchedScanSSIDs); | ||
165 | EXPECT_EQ(scan_capabilities.max_match_sets, | ||
166 | kFakeMaxMatchSets); | ||
167 | if (supports_scan_plan) { | ||
168 | EXPECT_EQ(scan_capabilities.max_num_scan_plans, | ||
169 | kFakeMaxNumScanPlans); | ||
170 | EXPECT_EQ(scan_capabilities.max_scan_plan_interval, | ||
171 | kFakeMaxScanPlanIntervals); | ||
172 | EXPECT_EQ(scan_capabilities.max_scan_plan_iterations, | ||
173 | kFakeMaxScanPlanIterations); | ||
174 | } else { | ||
175 | EXPECT_EQ(scan_capabilities.max_num_scan_plans, (unsigned int) 0); | ||
176 | EXPECT_EQ(scan_capabilities.max_scan_plan_interval, (unsigned int) 0); | ||
177 | EXPECT_EQ(scan_capabilities.max_scan_plan_iterations, (unsigned int) 0); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | void VerifyBandInfo(const BandInfo& band_info) { | ||
182 | vector<uint32_t> band_2g_expected = {kFakeFrequency1, | ||
183 | kFakeFrequency2, kFakeFrequency3}; | ||
184 | vector<uint32_t> band_5g_expected = {kFakeFrequency4, kFakeFrequency5}; | ||
185 | vector<uint32_t> band_dfs_expected = {kFakeFrequency6}; | ||
186 | EXPECT_EQ(band_info.band_2g, band_2g_expected); | ||
187 | EXPECT_EQ(band_info.band_5g, band_5g_expected); | ||
188 | EXPECT_EQ(band_info.band_dfs, band_dfs_expected); | ||
189 | } | ||
190 | |||
191 | void VerifyWiphyFeatures(const WiphyFeatures& wiphy_features) { | ||
192 | EXPECT_TRUE(wiphy_features.supports_random_mac_oneshot_scan); | ||
193 | EXPECT_FALSE(wiphy_features.supports_random_mac_sched_scan); | ||
194 | } | ||
195 | |||
83 | } // namespace | 196 | } // namespace |
84 | 197 | ||
85 | class NetlinkUtilsTest : public ::testing::Test { | 198 | class NetlinkUtilsTest : public ::testing::Test { |
@@ -314,64 +427,39 @@ TEST_F(NetlinkUtilsTest, CanGetWiphyInfo) { | |||
314 | new_wiphy.AddAttribute(NL80211Attr<uint32_t>(NL80211_ATTR_WIPHY, | 427 | new_wiphy.AddAttribute(NL80211Attr<uint32_t>(NL80211_ATTR_WIPHY, |
315 | kFakeWiphyIndex)); | 428 | kFakeWiphyIndex)); |
316 | 429 | ||
317 | // Insert band information to mock netlink response. | 430 | AppendBandInfoAttributes(&new_wiphy); |
318 | 431 | AppendScanCapabilitiesAttributes(&new_wiphy, true); | |
319 | NL80211NestedAttr freq_2g_1(1); | 432 | AppendWiphyFeaturesAttributes(&new_wiphy); |
320 | NL80211NestedAttr freq_2g_2(2); | ||
321 | NL80211NestedAttr freq_2g_3(3); | ||
322 | NL80211NestedAttr freq_5g_1(4); | ||
323 | NL80211NestedAttr freq_5g_2(5); | ||
324 | NL80211NestedAttr freq_dfs_1(6); | ||
325 | freq_2g_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
326 | kFakeFrequency1)); | ||
327 | freq_2g_2.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
328 | kFakeFrequency2)); | ||
329 | freq_2g_3.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
330 | kFakeFrequency3)); | ||
331 | freq_5g_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
332 | kFakeFrequency4)); | ||
333 | freq_5g_2.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
334 | kFakeFrequency5)); | ||
335 | // DFS frequency. | ||
336 | freq_dfs_1.AddAttribute(NL80211Attr<uint32_t>(NL80211_FREQUENCY_ATTR_FREQ, | ||
337 | kFakeFrequency6)); | ||
338 | freq_dfs_1.AddAttribute(NL80211Attr<uint32_t>( | ||
339 | NL80211_FREQUENCY_ATTR_DFS_STATE, | ||
340 | NL80211_DFS_USABLE)); | ||
341 | |||
342 | NL80211NestedAttr band_2g_freqs(NL80211_BAND_ATTR_FREQS); | ||
343 | NL80211NestedAttr band_5g_freqs(NL80211_BAND_ATTR_FREQS); | ||
344 | band_2g_freqs.AddAttribute(freq_2g_1); | ||
345 | band_2g_freqs.AddAttribute(freq_2g_2); | ||
346 | band_2g_freqs.AddAttribute(freq_2g_3); | ||
347 | band_5g_freqs.AddAttribute(freq_5g_1); | ||
348 | band_5g_freqs.AddAttribute(freq_5g_2); | ||
349 | band_5g_freqs.AddAttribute(freq_dfs_1); | ||
350 | 433 | ||
351 | NL80211NestedAttr band_2g_attr(1); | 434 | vector<NL80211Packet> response = {new_wiphy}; |
352 | NL80211NestedAttr band_5g_attr(2); | ||
353 | band_2g_attr.AddAttribute(band_2g_freqs); | ||
354 | band_5g_attr.AddAttribute(band_5g_freqs); | ||
355 | 435 | ||
356 | NL80211NestedAttr band_attr(NL80211_ATTR_WIPHY_BANDS); | 436 | EXPECT_CALL(*netlink_manager_, SendMessageAndGetResponses(_, _)). |
357 | band_attr.AddAttribute(band_2g_attr); | 437 | WillOnce(DoAll(MakeupResponse(response), Return(true))); |
358 | band_attr.AddAttribute(band_5g_attr); | ||
359 | 438 | ||
360 | new_wiphy.AddAttribute(band_attr); | 439 | BandInfo band_info; |
440 | ScanCapabilities scan_capabilities; | ||
441 | WiphyFeatures wiphy_features; | ||
442 | EXPECT_TRUE(netlink_utils_->GetWiphyInfo(kFakeWiphyIndex, | ||
443 | &band_info, | ||
444 | &scan_capabilities, | ||
445 | &wiphy_features)); | ||
446 | VerifyBandInfo(band_info); | ||
447 | VerifyScanCapabilities(scan_capabilities, true); | ||
448 | VerifyWiphyFeatures(wiphy_features); | ||
449 | } | ||
361 | 450 | ||
362 | // Insert scan capabilities to mock netlink response. | 451 | TEST_F(NetlinkUtilsTest, CanGetWiphyInfoScanPlanNotSupported) { |
363 | new_wiphy.AddAttribute(NL80211Attr<uint8_t>(NL80211_ATTR_MAX_NUM_SCAN_SSIDS, | 452 | NL80211Packet new_wiphy( |
364 | kFakeMaxNumScanSSIDs)); | 453 | netlink_manager_->GetFamilyId(), |
365 | new_wiphy.AddAttribute(NL80211Attr<uint8_t>( | 454 | NL80211_CMD_NEW_WIPHY, |
366 | NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, | 455 | netlink_manager_->GetSequenceNumber(), |
367 | kFakeMaxNumSchedScanSSIDs)); | 456 | getpid()); |
368 | new_wiphy.AddAttribute(NL80211Attr<uint8_t>(NL80211_ATTR_MAX_MATCH_SETS, | 457 | new_wiphy.AddAttribute(NL80211Attr<uint32_t>(NL80211_ATTR_WIPHY, |
369 | kFakeMaxMatchSets)); | 458 | kFakeWiphyIndex)); |
370 | 459 | ||
371 | // Insert wiphy features to mock netlink response. | 460 | AppendBandInfoAttributes(&new_wiphy); |
372 | new_wiphy.AddAttribute(NL80211Attr<uint32_t>( | 461 | AppendScanCapabilitiesAttributes(&new_wiphy, false); |
373 | NL80211_ATTR_FEATURE_FLAGS, | 462 | AppendWiphyFeaturesAttributes(&new_wiphy); |
374 | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR)); | ||
375 | 463 | ||
376 | vector<NL80211Packet> response = {new_wiphy}; | 464 | vector<NL80211Packet> response = {new_wiphy}; |
377 | 465 | ||
@@ -385,29 +473,12 @@ TEST_F(NetlinkUtilsTest, CanGetWiphyInfo) { | |||
385 | &band_info, | 473 | &band_info, |
386 | &scan_capabilities, | 474 | &scan_capabilities, |
387 | &wiphy_features)); | 475 | &wiphy_features)); |
388 | 476 | VerifyBandInfo(band_info); | |
389 | // Verify band information. | 477 | VerifyScanCapabilities(scan_capabilities, false); |
390 | vector<uint32_t> band_2g_expected = {kFakeFrequency1, | 478 | VerifyWiphyFeatures(wiphy_features); |
391 | kFakeFrequency2, kFakeFrequency3}; | ||
392 | vector<uint32_t> band_5g_expected = {kFakeFrequency4, kFakeFrequency5}; | ||
393 | vector<uint32_t> band_dfs_expected = {kFakeFrequency6}; | ||
394 | EXPECT_EQ(band_info.band_2g, band_2g_expected); | ||
395 | EXPECT_EQ(band_info.band_5g, band_5g_expected); | ||
396 | EXPECT_EQ(band_info.band_dfs, band_dfs_expected); | ||
397 | |||
398 | // Verify scan capabilities. | ||
399 | EXPECT_EQ(scan_capabilities.max_num_scan_ssids, | ||
400 | kFakeMaxNumScanSSIDs); | ||
401 | EXPECT_EQ(scan_capabilities.max_num_sched_scan_ssids, | ||
402 | kFakeMaxNumSchedScanSSIDs); | ||
403 | EXPECT_EQ(scan_capabilities.max_match_sets, | ||
404 | kFakeMaxMatchSets); | ||
405 | |||
406 | // Verify wiphy features. | ||
407 | EXPECT_TRUE(wiphy_features.supports_random_mac_oneshot_scan); | ||
408 | EXPECT_FALSE(wiphy_features.supports_random_mac_sched_scan); | ||
409 | } | 479 | } |
410 | 480 | ||
481 | |||
411 | TEST_F(NetlinkUtilsTest, CanHandleGetWiphyInfoError) { | 482 | TEST_F(NetlinkUtilsTest, CanHandleGetWiphyInfoError) { |
412 | // Mock an error response from kernel. | 483 | // Mock an error response from kernel. |
413 | vector<NL80211Packet> response = {CreateControlMessageError(kFakeErrorCode)}; | 484 | vector<NL80211Packet> response = {CreateControlMessageError(kFakeErrorCode)}; |