wificond: Fix unit test failures
Bug: 130244585 Test: ./system/connectivity/wificond/runtests.sh Change-Id: I05fa9e0d98a867bb3eacda355c531f686b3a44d8
This commit is contained in:
parent
a5a61a8327
commit
dba3887733
|
@ -30,6 +30,8 @@ class MockNetlinkUtils : public NetlinkUtils {
|
|||
~MockNetlinkUtils() override = default;
|
||||
|
||||
MOCK_METHOD1(GetWiphyIndex, bool(uint32_t* out_wiphy_index));
|
||||
MOCK_METHOD2(GetWiphyIndex,
|
||||
bool(uint32_t* out_wiphy_index, const std::string& iface_name));
|
||||
MOCK_METHOD1(UnsubscribeMlmeEvent, void(uint32_t interface_index));
|
||||
MOCK_METHOD1(UnsubscribeRegDomainChange, void(uint32_t wiphy_index));
|
||||
MOCK_METHOD1(UnsubscribeStationEvent, void(uint32_t interface_index));
|
||||
|
|
|
@ -96,7 +96,7 @@ bool CaptureSchedScanReqFlags(
|
|||
const SchedScanIntervalSetting& /* interval_setting */,
|
||||
int32_t /* rssi_threshold_2g */,
|
||||
int32_t /* rssi_threshold_5g */,
|
||||
const SchedScanReqFlags& req_flags,
|
||||
const SchedScanReqFlags& req_flags,
|
||||
const std::vector<std::vector<uint8_t>>& /* scan_ssids */,
|
||||
const std::vector<std::vector<uint8_t>>& /* match_ssids */,
|
||||
const std::vector<uint32_t>& /* freqs */,
|
||||
|
@ -351,19 +351,15 @@ TEST_F(ScannerTest, TestStartPnoScanViaNetlinkWithLowPowerScanWiphySupport) {
|
|||
wiphy_features_, &client_interface_impl_,
|
||||
&scan_utils_, offload_service_utils_);
|
||||
SchedScanReqFlags req_flags = {};
|
||||
ON_CALL(
|
||||
scan_utils_,
|
||||
StartScheduledScan(_, _, _, _, _, _, _, _, _)).
|
||||
WillByDefault(Return(true));
|
||||
EXPECT_CALL(
|
||||
scan_utils_,
|
||||
StartScheduledScan(_, _, _, _, _, _, _, _, _)).
|
||||
WillOnce(Invoke(bind(
|
||||
CaptureSchedScanReqFlags,
|
||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, &req_flags)));
|
||||
EXPECT_TRUE(req_flags.request_low_power);
|
||||
EXPECT_TRUE(scanner_impl.startPnoScan(PnoSettings(), &success).isOk());
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_TRUE(req_flags.request_low_power);
|
||||
}
|
||||
|
||||
TEST_F(ScannerTest, TestStopPnoScanViaNetlink) {
|
||||
|
|
|
@ -80,6 +80,7 @@ class ServerTest : public ::testing::Test {
|
|||
void SetUp() override {
|
||||
ON_CALL(*if_tool_, SetUpState(_, _)).WillByDefault(Return(true));
|
||||
ON_CALL(*netlink_utils_, GetWiphyIndex(_)).WillByDefault(Return(true));
|
||||
ON_CALL(*netlink_utils_, GetWiphyIndex(_, _)).WillByDefault(Return(true));
|
||||
ON_CALL(*netlink_utils_, GetInterfaces(_, _))
|
||||
.WillByDefault(Invoke(bind(
|
||||
MockGetInterfacesResponse, mock_interfaces, true, _1, _2)));
|
||||
|
@ -155,9 +156,6 @@ TEST_F(ServerTest, CanDestroyInterfaces) {
|
|||
TEST_F(ServerTest, CanTeardownApInterface) {
|
||||
sp<IApInterface> ap_if;
|
||||
|
||||
// When we tear down the interface, we expect the iface to be unloaded.
|
||||
EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
|
||||
|
||||
EXPECT_TRUE(server_.createApInterface(kFakeInterfaceName, &ap_if).isOk());
|
||||
EXPECT_NE(nullptr, ap_if.get());
|
||||
|
||||
|
@ -174,9 +172,6 @@ TEST_F(ServerTest, CanTeardownApInterface) {
|
|||
TEST_F(ServerTest, CanTeardownClientInterface) {
|
||||
sp<IClientInterface> client_if;
|
||||
|
||||
// When we tear down the interface, we expect the iface to be unloaded.
|
||||
EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
|
||||
|
||||
EXPECT_TRUE(server_.createClientInterface(
|
||||
kFakeInterfaceName, &client_if).isOk());
|
||||
EXPECT_NE(nullptr, client_if.get());
|
||||
|
@ -202,10 +197,6 @@ TEST_F(ServerTest, CanCreateTeardownApAndClientInterface) {
|
|||
EXPECT_TRUE(server_.createApInterface(kFakeInterfaceName1, &ap_if).isOk());
|
||||
EXPECT_NE(nullptr, ap_if.get());
|
||||
|
||||
// When we tear down the interfaces, we expect the iface to be unloaded.
|
||||
EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName), Eq(false)));
|
||||
EXPECT_CALL(*if_tool_, SetUpState(StrEq(kFakeInterfaceName1), Eq(false)));
|
||||
|
||||
bool success = true;
|
||||
// Try to remove an invalid iface name, this should fail.
|
||||
EXPECT_TRUE(server_.tearDownClientInterface(
|
||||
|
|
Loading…
Reference in New Issue