Loading wifi/1.3/default/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ LOCAL_MODULE := android.hardware.wifi@1.0-service-lib LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra ifdef WIFI_HAL_INTERFACE_COMBINATIONS LOCAL_CPPFLAGS += -DWIFI_HAL_INTERFACE_COMBINATIONS="$(WIFI_HAL_INTERFACE_COMBINATIONS)" endif ifdef WIFI_HIDL_FEATURE_AWARE LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE endif Loading Loading @@ -100,6 +103,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service-tests LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra LOCAL_SRC_FILES := \ tests/hidl_struct_util_unit_tests.cpp \ tests/main.cpp \ Loading wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.wmeVoPktStats.retries); EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (int i = 0; i < legacy_stats.radios.size(); i++) { for (size_t i = 0; i < legacy_stats.radios.size(); i++) { EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, Loading @@ -233,7 +233,7 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.radios[i].V1_0.onTimeInMsForScan); EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), converted.radios[i].V1_0.txTimeInMsPerLevel.size()); for (int j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], converted.radios[i].V1_0.txTimeInMsPerLevel[j]); Loading @@ -250,21 +250,20 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.radios[i].onTimeInMsForHs20Scan); EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), converted.radios[i].channelStats.size()); for (int k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, converted.radios[i].channelStats[k].channel.width); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), converted.radios[i].channelStats[k].channel.centerFreq); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq0, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), converted.radios[i].channelStats[k].channel.centerFreq0); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq1, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), converted.radios[i].channelStats[k].channel.centerFreq1); EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].cca_busy_time, EXPECT_EQ(legacy_channel_st.cca_busy_time, converted.radios[i].channelStats[k].ccaBusyTimeInMs); EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].on_time, EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); } } Loading wifi/1.3/default/tests/mock_wifi_feature_flags.h +2 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define MOCK_WIFI_FEATURE_FLAGS_H_ #include <gmock/gmock.h> #undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_feature_flags.h" Loading @@ -32,9 +33,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags { public: MockWifiFeatureFlags(); MOCK_METHOD0(isAwareSupported, bool()); MOCK_METHOD0(isDualInterfaceSupported, bool()); MOCK_METHOD0(isApDisabled, bool()); MOCK_METHOD0(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>()); }; } // namespace feature_flags Loading wifi/1.3/default/tests/runtests.sh +1 −1 Original line number Diff line number Diff line Loading @@ -23,4 +23,4 @@ set -e $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests adb root adb sync data adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests adb shell /data/nativetest64/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests wifi/1.3/default/tests/wifi_chip_unit_tests.cpp +59 −30 Original line number Diff line number Diff line Loading @@ -44,48 +44,77 @@ namespace implementation { class WifiChipTest : public Test { protected: void setupV1IfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P}, 1}}} }; const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = { {{{{IfaceType::AP}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV1_AwareIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = { {{{{IfaceType::AP}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV1_AwareDisabledApIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(true)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV2_AwareIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = { {{{{IfaceType::STA}, 1}, {{IfaceType::AP}, 1}}}, {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV2_AwareDisabledApIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(true)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void assertNumberOfModes(uint32_t num_modes) { Loading Loading
wifi/1.3/default/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ LOCAL_MODULE := android.hardware.wifi@1.0-service-lib LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra ifdef WIFI_HAL_INTERFACE_COMBINATIONS LOCAL_CPPFLAGS += -DWIFI_HAL_INTERFACE_COMBINATIONS="$(WIFI_HAL_INTERFACE_COMBINATIONS)" endif ifdef WIFI_HIDL_FEATURE_AWARE LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE endif Loading Loading @@ -100,6 +103,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service-tests LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra LOCAL_SRC_FILES := \ tests/hidl_struct_util_unit_tests.cpp \ tests/main.cpp \ Loading
wifi/1.3/default/tests/hidl_struct_util_unit_tests.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.wmeVoPktStats.retries); EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (int i = 0; i < legacy_stats.radios.size(); i++) { for (size_t i = 0; i < legacy_stats.radios.size(); i++) { EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, Loading @@ -233,7 +233,7 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.radios[i].V1_0.onTimeInMsForScan); EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), converted.radios[i].V1_0.txTimeInMsPerLevel.size()); for (int j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], converted.radios[i].V1_0.txTimeInMsPerLevel[j]); Loading @@ -250,21 +250,20 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.radios[i].onTimeInMsForHs20Scan); EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), converted.radios[i].channelStats.size()); for (int k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, converted.radios[i].channelStats[k].channel.width); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), converted.radios[i].channelStats[k].channel.centerFreq); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq0, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), converted.radios[i].channelStats[k].channel.centerFreq0); EXPECT_EQ( legacy_stats.radios[i].channel_stats[k].channel.center_freq1, EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), converted.radios[i].channelStats[k].channel.centerFreq1); EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].cca_busy_time, EXPECT_EQ(legacy_channel_st.cca_busy_time, converted.radios[i].channelStats[k].ccaBusyTimeInMs); EXPECT_EQ(legacy_stats.radios[i].channel_stats[k].on_time, EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); } } Loading
wifi/1.3/default/tests/mock_wifi_feature_flags.h +2 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define MOCK_WIFI_FEATURE_FLAGS_H_ #include <gmock/gmock.h> #undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_feature_flags.h" Loading @@ -32,9 +33,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags { public: MockWifiFeatureFlags(); MOCK_METHOD0(isAwareSupported, bool()); MOCK_METHOD0(isDualInterfaceSupported, bool()); MOCK_METHOD0(isApDisabled, bool()); MOCK_METHOD0(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>()); }; } // namespace feature_flags Loading
wifi/1.3/default/tests/runtests.sh +1 −1 Original line number Diff line number Diff line Loading @@ -23,4 +23,4 @@ set -e $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests adb root adb sync data adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests adb shell /data/nativetest64/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests
wifi/1.3/default/tests/wifi_chip_unit_tests.cpp +59 −30 Original line number Diff line number Diff line Loading @@ -44,48 +44,77 @@ namespace implementation { class WifiChipTest : public Test { protected: void setupV1IfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P}, 1}}} }; const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = { {{{{IfaceType::AP}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV1_AwareIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsAp = { {{{{IfaceType::AP}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV1_AwareDisabledApIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(false)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(true)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinationsSta = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV2_AwareIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(false)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = { {{{{IfaceType::STA}, 1}, {{IfaceType::AP}, 1}}}, {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void setupV2_AwareDisabledApIfaceCombination() { EXPECT_CALL(*feature_flags_, isAwareSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isDualInterfaceSupported()) .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*feature_flags_, isApDisabled()) .WillRepeatedly(testing::Return(true)); // clang-format off const hidl_vec<V1_0::IWifiChip::ChipIfaceCombination> combinations = { {{{{IfaceType::STA}, 1}, {{IfaceType::P2P, IfaceType::NAN}, 1}}} }; const std::vector<V1_0::IWifiChip::ChipMode> modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on EXPECT_CALL(*feature_flags_, getChipModes()) .WillRepeatedly(testing::Return(modes)); } void assertNumberOfModes(uint32_t num_modes) { Loading