diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-02-19 02:07:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-02-19 02:07:53 +0000 |
commit | ac5dc18df1647b9b850a8a15db05ea8c31e14623 (patch) | |
tree | 2d274224bf3bd241ce298fb17a4671043aad9ebf | |
parent | f268ae2cef0f55bce28591c84890c5b21025dc42 (diff) | |
parent | 1cfe08149119dd43625a10753f250c7c57db4568 (diff) |
Merge "wifi: fix NULL pointer in unit tests" into tm-dev
-rw-r--r-- | wifi/1.6/default/tests/mock_wifi_legacy_hal.h | 4 | ||||
-rw-r--r-- | wifi/1.6/default/tests/wifi_chip_unit_tests.cpp | 3 | ||||
-rw-r--r-- | wifi/1.6/default/wifi_legacy_hal.h | 6 |
3 files changed, 10 insertions, 3 deletions
diff --git a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h b/wifi/1.6/default/tests/mock_wifi_legacy_hal.h index b1f53273ba..85dbf0fe49 100644 --- a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h +++ b/wifi/1.6/default/tests/mock_wifi_legacy_hal.h @@ -56,6 +56,10 @@ class MockWifiLegacyHal : public WifiLegacyHal { wifi_error(const std::string& ifname, wifi_interface_type iftype)); MOCK_METHOD1(deleteVirtualInterface, wifi_error(const std::string& ifname)); MOCK_METHOD0(waitForDriverReady, wifi_error()); + MOCK_METHOD2(getSupportedIfaceName, wifi_error(uint32_t, std::string&)); + MOCK_METHOD1(registerSubsystemRestartCallbackHandler, + wifi_error(const on_subsystem_restart_callback&)); + MOCK_METHOD1(getSupportedFeatureSet, std::pair<wifi_error, uint64_t>(const std::string&)); }; } // namespace legacy_hal } // namespace implementation diff --git a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp index 48c006519f..eaab211219 100644 --- a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp @@ -278,6 +278,9 @@ class WifiChipTest : public Test { .WillRepeatedly(testing::Return(true)); EXPECT_CALL(*legacy_hal_, start()) .WillRepeatedly(testing::Return(legacy_hal::WIFI_SUCCESS)); + // Vendor HAL does not override the name by default. + EXPECT_CALL(*legacy_hal_, getSupportedIfaceName(testing::_, testing::_)) + .WillRepeatedly(testing::Return(legacy_hal::WIFI_ERROR_UNKNOWN)); } void TearDown() override { diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h index ab21e8e31f..6f42f70359 100644 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ b/wifi/1.6/default/wifi_legacy_hal.h @@ -496,7 +496,7 @@ class WifiLegacyHal { const std::string& iface_name); std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump( const std::string& iface_name); - std::pair<wifi_error, uint64_t> getSupportedFeatureSet(const std::string& iface_name); + virtual std::pair<wifi_error, uint64_t> getSupportedFeatureSet(const std::string& iface_name); // APF functions. std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities( const std::string& iface_name); @@ -564,7 +564,7 @@ class WifiLegacyHal { wifi_error registerRingBufferCallbackHandler( const std::string& iface_name, const on_ring_buffer_data_callback& on_data_callback); wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name); - wifi_error registerSubsystemRestartCallbackHandler( + virtual wifi_error registerSubsystemRestartCallbackHandler( const on_subsystem_restart_callback& on_restart_callback); std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> getRingBuffersStatus( const std::string& iface_name); @@ -637,7 +637,7 @@ class WifiLegacyHal { virtual wifi_error createVirtualInterface(const std::string& ifname, wifi_interface_type iftype); virtual wifi_error deleteVirtualInterface(const std::string& ifname); - wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname); + virtual wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname); // STA + STA functions virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname); |