diff --git a/tests/mock_netlink_utils.h b/tests/mock_netlink_utils.h index cc76fae..708a385 100644 --- a/tests/mock_netlink_utils.h +++ b/tests/mock_netlink_utils.h @@ -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)); diff --git a/tests/scanner_unittest.cpp b/tests/scanner_unittest.cpp index 8cb49b3..39a591e 100644 --- a/tests/scanner_unittest.cpp +++ b/tests/scanner_unittest.cpp @@ -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>& /* scan_ssids */, const std::vector>& /* match_ssids */, const std::vector& /* 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) { diff --git a/tests/server_unittest.cpp b/tests/server_unittest.cpp index c2886c2..2175cf9 100644 --- a/tests/server_unittest.cpp +++ b/tests/server_unittest.cpp @@ -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 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 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(