commit | 4417e323178fb6497054cd44116e4c9522a7a31e | [log] [tgz] |
---|---|---|
author | Charles Celerier <chcl@google.com> | Thu Oct 29 02:59:04 2020 +0000 |
committer | CQ Bot <commit-bot@chromium.org> | Thu Oct 29 02:59:04 2020 +0000 |
tree | 230bfc57889dabb71d06b153781c46c3f56c7b23 | |
parent | cd950d656667b671ba542f0ae29791f211fd8da1 [diff] |
[wlan] Create fake_bss! macro for mocking BssDescription values The fake_bss! macro is introduced in this change to simplify the way fake BssDescription types are created for tests. The first argument of fake_bss! is always the security type desired, and the remaining arguments override the default fields of the fake BssDescription. The security type for the fake BssDescription will determine the default values for the cap, rsne, and vendor_ies fields. The fake_bss! macro goes a long way to reduce the amount of custom "fake bss" functions implemented in various places. Before this change it was common to encounter function calls like fake_vht_bss_description() in test code. This call of course does very little to explain to the reader what part of the fake BSS is particularly important to the test. Now, the reader will encounter something like this instead. fake_bss!(Open, chan: fidl_common::WlanChan { primary: 123, cbw: fidl_common::Cbw::Cbw80P80, secondary80: 42, }), The latter makes it much more obvious which fields of the fake BSS are relevant to the test. Here are a couple more examples. protected_bss(b"foo".to_vec()) -> fake_bss!(Wpa2, ssid: b"wpa2".to_vec()) bss(-10, -10, ProtectionCfg::Wpa1) -> fake_bss!(Wpa1, rssi_dbm: -10, rcpi_dbmh: -10) Fixed: 62886 Test: fx test wlan-common-tests wlan-mlme-tests wlan-sme-tests wlanstack-tests Change-Id: I197a54a6812194f444c115f78c6bf5b0e3ab4c32 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/443497 Commit-Queue: Charles Celerier <chcl@google.com> Reviewed-by: Kiet Tran <kiettran@google.com> Testability-Review: Kiet Tran <kiettran@google.com>
Pink + Purple == Fuchsia (a new operating system)
Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.
Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.